My custom taxonomies are not showing up in the admin menus - wordpress-theming

Hello, nice to meet you all in advance, this is my first post in this forum.
I am offering an update to one of my old WordPress themes.
I have already registered some custom taxonomies, but now I have a problem:
My taxonomies are not displayed in the navigation menus of the WordPress dashboard:
See this
This is my code:
if ( ! function_exists( 'nf_register_taxonomies' ) ) {
function nf_register_taxonomies() {
// Directors
$directors_labels = array(
'name' => __( 'Director', 'nf-languages' ),
'singular_name' => __( 'Director', 'nf-languages' ),
'search_items' => __( 'Search in Directors', 'nf-languages' ),
'all_items' => __( 'All Directors', 'nf-languages' ),
'parent_item' => __( 'Parent Director', 'nf-languages' ),
'parent_item_colon' => __( 'Parent Director:', 'nf-languages' ),
'edit_item' => __( 'Edit Director', 'nf-languages' ),
'update_item' => __( 'Update Director', 'nf-languages' ),
'add_new_item' => __( 'Add New Director', 'nf-languages' ),
'new_item_name' => __( 'Director Name', 'nf-languages' ),
'menu_name' => __( 'Directors', 'nf-languages' ),
);
$directors_args = array(
'hierarchical' => false,
'labels' => $directors_labels,
'show_ui' => true,
'show_admin_column' => true,
'show_in_rest' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'director' ),
);
register_taxonomy( 'directors', array(
'series',
'movie'
), $directors_args );
}
add_action( 'init', 'nf_register_taxonomies', 0 );}
I have a clue but I don't know what the problem is and how to solve it, my taxonomy name is "directors", if I rename it to "director" the problem will be solved. But I don't want to change the name of this taxonomy.
Does anyone know how to solve this problem?

Related

Move widget area on inner pages

I have added a widget area to my home page below front page 1 all good, what i want to do is on all pages except the home page have the same widget but just move it to above the footer
the above just shows the widget above the footer on all pages - can some one point me in the right direction please thanks in advanceenter code here
genesis_register_sidebar( array(
'id' => 'newsletter',
'name' => __( 'Newsletter Widget', 'genesis' ),
'description' => __( 'Newsletter Widget Area', 'monochrome-pro' ),
) );
add_action( 'genesis_after_front-page-1_widget_area', 'add_genesis_widget_area' );
if ( is_home() && is_front_page() ) {
function add_genesis_widget_area() {
genesis_widget_area( 'newsletter', array(
'before' => '<div class="newsletter widget-area">',
'after' => '</div>',
) );
}
}
add_action( 'genesis_after_footer', 'add_genesis_widget_area2' );
if ( !is_home() && !is_front_page() ) {
function add_genesis_widget_area2() {
genesis_widget_area( 'newsletter', array(
'before' => '<div class="newsletter widget-area">',
'after' => '</div>',
) );
}
}

How to use fontawesome in param visual composer?

I code element with visual composer. I want to use fontawesome in element.
Code here show list font-awesome in param visual composer
<code>
array(
'type' => 'iconpicker',
'heading' => esc_html__('Fontawesome', 'interior'),
'param_name' => 'fontawesome_icon',
'settings' => array(
'type' => 'fontawesome'
),
'description' => esc_html__( 'Fontawesome list. Pickup your choice.', 'interior'
),
'dependency' => array(
'element' => 'icon_type',
'value' => array( 'fontawesome-icon' )
)
</code>
I showed list icon in element but i chosen it don't saved and i don't know get value font-awsome display html.
Help me!!!
I have made a code only for Font Awesome Icon... You can try this
below code. it's tested and definitely works. here I have used
"Facebook" in title...Let me know via comment if you found any issue
in code or having any trouble for this.
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
if( !class_exists( 'RN_FA_Icon_list' ) ) {
class RN_FA_Icon_list {
private $shortcode;
function __construct() {
/* shortcode base */
$this->shortcode = 'rn_fa_icon_list';
add_action( 'init', array( $this, 'rn_map_shortcode' ) );
add_shortcode( $this->shortcode, array( $this, 'rn_create_shortcode' ) );
}
function rn_map_shortcode( $atts, $content = NULL ) {
if( function_exists( 'vc_map' ) ) {
vc_map(
array(
'name' => esc_html__( 'Font Awesome Icon', 'rn_shortcodes' ),
//'icon' => RN_SHORTCODES_URL . '/admin/img/vc_icons/fancy-list.png',
'base' => $this->shortcode,
'category' => 'Structual',
'class' => 'rn-vc-icon-module rn-structual-module',
'content_element' => true,
'params' => array(
array(
'type' => 'textfield',
'heading' => esc_html__( 'Description', 'rn_shortcodes' ),
'description' => esc_html__( 'Only for internal use. This adds a label to Visual Composer for an easier element identification.', 'rn_shortcodes' ),
'param_name' => 'list_description',
'admin_label' => true,
'group' => 'General'
),
array(
'type' => 'iconpicker',
'heading' => __( 'Icon', 'js_composer' ),
'param_name' => 'icon_fontawesome',
'value' => 'fa fa-adjust',
'group' => 'General',
'settings' => array(
'emptyIcon' => false,
'type' => 'fontawesome',
'iconsPerPage' => 4000,
),
'dependency' => array(
'element' => 'type',
'value' => 'fontawesome',
),
'description' => __( 'Select icon from library.', 'js_composer' ),
),
array(
'type' => 'css_editor',
'param_name' => 'css',
'group' => esc_html__( 'Design Options', 'rn_shortcodes' ),
),
)
)
); /* end mapping */
}
}
function rn_create_shortcode( $atts, $content = NULL ) {
extract( shortcode_atts( array (
'icon_fontawesome' => '',
'css' => ''
), $atts ) );
/* extract list items */
if( function_exists('vc_param_group_parse_atts') && !empty( $values ) ) {
$values = vc_param_group_parse_atts( $values );
}
/* unique listz ID */
$id = uniqid("rn_fa_");
$output = '';
$output .= '<div id="' . esc_attr( $id ) . '">';
$output .= '<i class="' . $icon_fontawesome . '"></i> Facebook';
$output .= '</div>';
return '<div class="wpb_content_element ' . apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class( $css, ' ' ), $this->shortcode, $atts ) . '">' . $output . '</div>';
}
}
}
new RN_FA_Icon_list;
?>

Woocommerce payment gateway integration

Have a problem with latest woocommerce version payment gateway integration.
I recently started using woocommerce for a friend and he was having woocommerce version 1.6.5.2. But now he updated his woocommerce to latest version (2.0.12).
He had some custom made payment gateway that worked on the 1.6 version but now it doesnt.
This is the custom payment gateway code:
/*
Plugin Name ......
.../*
$post_perma = trim( esc_url ( $_SERVER['REQUEST_URI'] ), '/' );
add_action('plugins_loaded', 'woocommerce_rba_etomitreba_init', 0);
if($post_perma == 'uspjeh'||$post_perma == 'greska') {
add_filter('the_content', 'after_processing');
}
function after_processing() {
global $post, $post_perma, $woocommerce;
if($post_perma == 'uspjeh') {
if(isset($_POST['OrderID'])&&isset($_POST['ApprovalCode'])) {
echo '<div class="notify notify-success">Not Important;)</div>';
$order = new WC_Order( $_POST['OrderID'] );
$order->payment_complete();
$order->status = 'completed';
$woocommerce->cart->empty_cart();
unset($_SESSION['order_awaiting_payment']);
}
else {
echo '<div class="notify notify-error">Not Important</div>';
}
}
if($post_perma == 'greska') {
echo '<div class="notify notify-error">DNot Important</div>';
}
}
function woocommerce_rba_etomitreba_init() {
if ( !class_exists( 'WC_Payment_Gateway' ) ) return;
class WC_Raiffeisen_Bank_eToMiTreba extends WC_Payment_Gateway {
public function __construct() {
$this->id = 'rba_etomitreba';
$this->method_title = __( 'Raiffeisen Bank', 'woocommerce' );
$this->icon = apply_filters('woocommerce_cheque_icon', '');
$this->has_fields = false;
// Load the form fields.
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Not Important', 'woothemes' ),
'type' => 'checkbox',
'label' => __( 'Not Important', 'woothemes' ),
'default' => 'yes'
),
'merchant-id' => array(
'title' => __( 'Not Important', 'woothemes' ),
'type' => 'text',
'description' => __( 'Not Important', 'woothemes' ),
'default' => __( '', 'woothemes' )
),
'terminal-id' => array(
'title' => __( 'Not Important', 'woothemes' ),
'type' => 'text',
'description' => __( 'Not Important', 'woothemes' ),
'default' => __( '', 'woothemes' )
),
'rsa-private-key' => array(
'title' => __( 'Not Important', 'woothemes' ),
'type' => 'textarea',
'description' => __( 'Not Important', 'woothemes' ),
'default' => __( '', 'woothemes' )
),
'title' => array(
'title' => __( 'Not Important', 'woothemes' ),
'type' => 'text',
'description' => __( '', 'woothemes' ),
'default' => __( 'Not Important', 'woothemes' )
),
'description' => array(
'title' => __( 'Not Important', 'woothemes' ),
'type' => 'textarea',
'description' => __( '', 'woothemes' ),
'default' => 'Not Important.'
)
);
// Load the settings.
$this->init_settings();
$this->title = $this->settings['title'];
$this->description = $this->settings['description'];
// Actions
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
}
public function process_payment( $order_id ) {
$order = new WC_Order( $order_id );
$order->shipping_first_name;
$order->shipping_last_name;
$order->get_shipping_address();
$url_gateway = 'Not Important';
$merchant_id = 'xxxxx';
$terminal_id = 'xxxxx';
$total = $order->get_total()*100; // kn to lp conversion
$currency_id = 191;
$time = new DateTime('', new DateTimeZone('Europe/Zagreb'));
$purchase_time = $time->format('ymdHis');
$locale = 'hr';
$ordered_items = $order->get_items();
foreach($ordered_items as $item) {
$ordered_items_array[] = $item['name'];
}
$ordered_items = implode(', ',$ordered_items_array);
$purchase_desc = $time->format('d.m.Y. H:i:s').' - '.$order->shipping_first_name.' '.$order->shipping_last_name.' : '.$ordered_items;
$session_id = session_id();
$data = "$merchant_id;$terminal_id;$purchase_time;$order_id;$currency_id;$total;$session_id;";
$priv_key = $this->settings['rsa-private-key'];
$pkeyid = openssl_get_privatekey($priv_key);
openssl_sign($data, $signature, $pkeyid);
openssl_free_key($pkeyid);
$b64sign = base64_encode($signature);
$signature = $b64sign;
//$order->update_status('on-hold', __('Not Important', 'woothemes'));
echo '
<form name="ordersend" action="'.$url_gateway.'" method="post">
<input name="Version" type="hidden" value="1" >
<input name="MerchantID" type="hidden" value="'.$merchant_id.'" >
<input name="TerminalID" type="hidden" value="'.$terminal_id.'" >
<input name="TotalAmount" type="hidden" value="'.$total.'">
<input name="SD" type="hidden" value="'.$session_id.'">
<input name="Currency" type="hidden" value="'.$currency_id.'" >
<input name="Locale" type="hidden" value="'.$locale.'">
<input name="OrderID" type="hidden" value="'.$order_id.'" >
<input name="PurchaseTime" type="hidden" value="'.$purchase_time.'">
<input name="PurchaseDesc" type="hidden" value="'.$purchase_desc.'" >
<input name="Signature" type="hidden" value="'.$signature.'" >
</form>
<script language="javascript">
<!--
document.forms["ordersend"].submit();
--></script>
';
/*
return array (
'result' => 'success'
);*/
}
public function admin_options() {
?>
<img src="<?php echo 'Not Important ?>" width="664" height="114" />
<h3><?php _e('Not Important', 'woothemes'); ?></h3>
<p><?php _e('Not Important'); ?></p>
<table class="form-table">
<?php
// Generate the HTML For the settings form.
$this->generate_settings_html();
?>
</table>
<?php
} // End admin_options()
}
function woocommerce_raiffeisen_bank_etomitreba_gateway($methods) {
$methods[] = 'WC_Raiffeisen_Bank_eToMiTreba';
return $methods;
}
add_filter('woocommerce_payment_gateways', 'woocommerce_raiffeisen_bank_etomitreba_gateway' );
}
Its just a compatibility issue but as i said, i am new to woocommerce and not so experienced with php. Any help would be greatly appreciated.
Change
add_action('woocommerce_update_options_payment_gateways', array(&$this, process_admin_options'));
to
if ( version_compare( WOOCOMMERCE_VERSION, '2.0.0', '>=' ) ) {
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( &$this, 'process_admin_options' ) );
} else {
add_action( 'woocommerce_update_options_payment_gateways', array( &$this, 'process_admin_options' ) );
}

How to add raw HTML in Yii CMenu label

I create a menu like a Twitter Bootstrap navbar with CMenu widget:
<?php
$this->widget( 'zii.widgets.CMenu', array(
'items' => array(
array(
'label' => 'Home',
'url' => array( '/site/index' ),
),
array(
'label' => 'Dropdown <b class="caret"></b>',
'url' => '#',
'submenuOptions' => array( 'class' => 'dropdown-menu' ),
'items' => array(
array(
'label' => 'Submenu Item 1',
'url' => array( '/user/create' ),
),
array(
'label' => 'Submenu Item 1',
'url' => array( '/user/list' ),
),
),
'itemOptions' => array( 'class' => 'dropdown' ),
'linkOptions' => array( 'class' => 'dropdown-toggle', 'data-toggle' => 'dropdown' ),
),
'htmlOptions' => array( 'class' => 'nav' ),
)); ?>
This code generate menu with 2 items in it and 1 submenu for second menu item. Fine. But only thing, which not worked is 'label' => 'Dropdown <b class="caret"></b>', in 9th line. It rendered as Dropdown <b class="caret"></b> on page. So I see caption 'Dropdown <b class="caret"></b>' instead of Dropdown ▼.
How I can change code to show unescaped HTML in menu label?
Thanks for your attention.
You have to set encodeLabel attribute of CMenu to false
<?php
$this->widget('zii.widgets.CMenu', array(
'encodeLabel' => false,
'htmlOptions' => array('class' => 'nav'),
'items' => array(
array(
'label' => 'Home',
'url' => array('/site/index'),
),
array(
'label' => 'Dropdown <b class="caret"></b>',
'url' => '#',
'submenuOptions' => array('class' => 'dropdown-menu'),
'items' => array(
array(
'label' => 'Submenu Item 1',
'url' => array('/user/create'),
),
array(
'label' => 'Submenu Item 1',
'url' => array('/user/list'),
),
),
'itemOptions' => array('class' => 'dropdown'),
'linkOptions' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'),
),
),
));
?>
My solution is creating CMenu extension:
layout/main.php
'submenuOptions'=>array('class'=>'dropdown-menu'),
'itemOptions'=>array('class'=>'dropdown'),
'linkOptions'=>array('class'=>'dropdown-toggle', 'data-toggle'=>'dropdown'),
// Dropdown arrow toggle
'dropdownArrow'=>true,
ext/widgets/BootstrapCMenu.php
class BootstrapCMenu extends CMenu {
protected function renderMenuItem($item)
{
if(isset($item['url']))
{
$item['label'] .= ($item['dropdownArrow']) ? ' <b class="caret"></b>' : '';
$label=$this->linkLabelWrapper===null ? $item['label'] : CHtml::tag($this->linkLabelWrapper, $this->linkLabelWrapperHtmlOptions, $item['label']);
return CHtml::link($label,$item['url'],isset($item['linkOptions']) ? $item['linkOptions'] : array());
}
else
return CHtml::tag('span',isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);
}
}
In Yii 2.0, for adding glyphicon in navbar menu you can follow the below info.
Edit in vendor\yiisoft\yii2-bootstrap\Nav.php under renderItem function the following code:
if(isset($item['icons']))
$label=Html::tag('span', '', ['class' => 'glyphicon glyphicon-'.$item['icons']]).$label;
Now, you can directly use any icon from your code with icons option as
<?php
$this->widget( 'zii.widgets.CMenu', array(
'items' => array(
array(
'label' => 'Home',
'url' => array( '/site/index' ),
'icons'=> 'home',
),
array(
'label' => 'Dropdown <b class="caret"></b>',
'url' => '#',
'submenuOptions' => array( 'class' => 'dropdown-menu' ),
'items' => array(
array(
'label' => 'Submenu Item 1',
'url' => array( '/user/create' ),
),
array(
'label' => 'Submenu Item 1',
'url' => array( '/user/list' ),
),
),
'itemOptions' => array( 'class' => 'dropdown' ),
'linkOptions' => array( 'class' => 'dropdown-toggle', 'data-toggle' => 'dropdown' ),
),
'htmlOptions' => array( 'class' => 'nav' ),
)); ?>
You can make the corresponding changes even in older versions of yii.

Drupal Html array. How to reference a changing radio selection within a fieldset

I cannot make this Drupal html array fire the visible property on change of radio option. I have moved everything inside of the fieldset, not sure if this makes any difference.
Does anyone know why it isn't firing?
function services_formation_founders($form, &$form_state) {
$form = array();
$form['#tree'] = TRUE;
$form['description'] = array(
'#type' => 'item',
'#title' => t('Founders form'),
);
$form['founder']['add_officer'] = array(
'#type' => 'fieldset',
'#title' => t('Add Founder'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#states' => array(
'visible' => array(TRUE,
),
),
);
$form['founder']['add_officer']['founder_type'] = array(
'#type' => 'radios',
'#options' => array(
'individual' => t('Individual'),
'corporate' => t('Corporation'),
),
'#default_value'=>'individual',
'#title' => t('What type of Founder?')
);
if (empty($form_state['num_names'])) {
$form_state['num_names'] = 1;
}
$form['founder']['add_officer']['individual'] = array(
'#type' => 'textfield',
'#title' => t('Individual'),
'#states' => array(
'visible' => array(
':input[name="founder_type"' => array('value' => "individual"),
),
),
);
$form['founder']['add_officer']['corporation'] = array(
'#type' => 'textfield',
'#title' => t('Corporation'),
'#states' => array(
'visible' => array(
':input[name="founder_type"' => array('value' => "corporate"),
),
),
);
return $form;
}
Place $ sign at line no 2
$form = array();