function jellythemes_photos_list($atts, $content = null)
{
    extract(shortcode_atts(array('limit' => 8), $atts));
    $return = '
		        <nav class="primary"><ul>
	                          <li><a class="selected" href="#" data-filter="*"><span>' . __('All photos', 'jellythemes') . '</span></a></li>';
    $types = get_terms('type', array('hide_empty' => 0));
    if ($types && !is_wp_error($types)) {
        foreach ($types as $type) {
            $return .= '<li><a href="#" data-filter=".' . esc_js($type->slug) . '"><span>' . $type->name . '</span></a></li>';
        }
    }
    $return .= '</ul></nav>
                        <div class="portfolio">';
    $photos = new WP_Query(array('post_type' => 'photo', 'posts_per_page' => esc_attr($limit)));
    while ($photos->have_posts()) {
        $photos->the_post();
        $term_list = wp_get_post_terms(get_the_ID(), 'type', array("fields" => "names"));
        $images = rwmb_meta('_jellythemes_project_images', 'type=plupload_image', get_the_ID());
        foreach ($images as $image) {
            $img = wp_get_attachment_image($image['ID'], 'full', false, array('class' => 'img-responsive'));
            $src = wp_get_attachment_image_src($image['ID'], 'full');
        }
        $return .= '<article class="' . implode(' ', get_post_class('entry')) . '">
			                                <a class="swipebox" href="' . $src[0] . '">
			                                ' . $img . '
			                                <span class="magnifier"></span>
			                                </a>
			                            </article>';
    }
    $return .= '</div>';
    return $return;
}
Example #2
1
 /**
  * Get field HTML
  *
  * @param $html
  * @param $field
  * @param $meta
  *
  * @return string
  */
 static function html($html, $meta, $field)
 {
     $options = $field['options'];
     $terms = get_terms($options['taxonomy'], $options['args']);
     $html = '';
     // Checkbox LIST
     if ('checkbox_list' === $options['type']) {
         $html = array();
         foreach ($terms as $term) {
             $checked = checked(in_array($term->slug, $meta), true, false);
             $html[] = "<label><input type='checkbox' name='{$field['field_name']}' value='{$term->slug}'{$checked} /> {$term->name}</label>";
         }
         $html = implode('<br />', $html);
     } elseif ('checkbox_tree' === $options['type']) {
         $elements = self::process_terms($terms);
         $html .= self::walk_checkbox_tree($meta, $field, $elements, $field['options']['parent'], true);
     } elseif ('select_tree' == $options['type']) {
         $elements = self::process_terms($terms);
         $html .= self::walk_select_tree($meta, $field, $elements, $field['options']['parent'], '', true);
     } else {
         $multiple = $field['multiple'] ? " multiple='multiple' style='height: auto;'" : "'";
         $html .= "<select name='{$field['field_name']}'{$multiple}>";
         foreach ($terms as $term) {
             $selected = selected(in_array($term->slug, $meta), true, false);
             $html .= "<option value='{$term->slug}'{$selected}>{$term->name}</option>";
         }
         $html .= "</select>";
     }
     return $html;
 }
 protected function get_values()
 {
     $terms = array();
     // Load all available event categories
     $source = get_terms(TribeEvents::TAXONOMY, array('orderby' => 'name', 'order' => 'ASC'));
     if (empty($source) || is_wp_error($source)) {
         return array();
     }
     // Preprocess the terms
     foreach ($source as $term) {
         $terms[(int) $term->term_id] = $term;
         $term->parent = (int) $term->parent;
         $term->depth = 0;
         $term->children = array();
     }
     // Initally copy the source list of terms to our ordered list
     $ordered_terms = $terms;
     // Re-order!
     foreach ($terms as $id => $term) {
         // Skip root elements
         if (0 === $term->parent) {
             continue;
         }
         // Reposition child terms within the ordered terms list
         unset($ordered_terms[$id]);
         $term->depth = $terms[$term->parent]->depth + 1;
         $terms[$term->parent]->children[$id] = $term;
     }
     // Finally flatten out and return
     return $this->flattened_term_list($ordered_terms);
 }
Example #4
0
function sf_ajax_optionsearch()
{
    $data = array();
    $i = 0;
    preg_match_all('^(.*)\\[(.*)\\]^', $_POST['val'], $match);
    $data_type = $match[1][0];
    $data_value = $match[2][0];
    if ($data_type == 'meta') {
        $terms = get_postmeta_values($data_value);
        if (is_array($terms)) {
            foreach ($terms as $term) {
                $data[$i]['key'] = $term->meta_value;
                $data[$i]['val'] = $term->meta_value;
                $i++;
            }
        }
    } elseif ($data_type == 'tax') {
        $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true);
        $terms = get_terms($data_value, $args);
        if (is_array($terms)) {
            foreach ($terms as $term) {
                $data[$i]['key'] = $term->term_id;
                $data[$i]['val'] = $term->name;
                $i++;
            }
        }
    }
    echo json_encode($data);
    die;
}
Example #5
0
function hmp_category_meta_box($post)
{
    global $post;
    ?>
	<p><label for="hmp_portfolio_category">Category</label></p>
	<select name="hmp_portfolio_category">
		<option value="">Select Category...</option>
		<?php 
    $cats = get_terms('hmp-entry-category', array('hide_empty' => false));
    $obj_cat = wp_get_object_terms($post->ID, 'hmp-entry-category');
    $obj_cat = $obj_cat[0];
    foreach ($cats as $cat) {
        ?>
			<option <?php 
        if ($cat->term_id == $obj_cat->term_id) {
            echo 'selected="selected" ';
        }
        ?>
value="<?php 
        echo $cat->term_id;
        ?>
"><?php 
        echo $cat->name;
        ?>
</option>
		<?php 
    }
    ?>
	</select>
	<p><label for="hmp_portfolio_new_category">Add New Category</label></p>
	<input name="hmp_portfolio_new_category" type="text" />
	<?php 
}
function uni_calendar_display_categories()
{
    ?>
			<div class="pagePanel clear">
            <?php 
    $aEventCats = get_terms('uni_calendar_event_cat');
    if (!empty($aEventCats) && !is_wp_error($aEventCats)) {
        ?>
				<ul class="productFilter classesFilter clear">
                    <li><a class="active" data-filter="all" href="#"><?php 
        _e('All', 'uni-calendar');
        ?>
 </a></li>
                <?php 
        foreach ($aEventCats as $oTerm) {
            ?>
					<li><a data-filter="<?php 
            echo $oTerm->slug;
            ?>
" href="#"><?php 
            echo $oTerm->name;
            ?>
</a></li>
				<?php 
        }
        ?>
				</ul>
            <?php 
    }
    ?>
			</div>
    <?php 
}
Example #7
0
 /**
  * Generates the HTML for a taxonomy selector.
  *
  * @param array $view_args Arguments to the parent view
  * @param bool  $tag       whether it's tags or categories.
  *
  * @return string          Markup for categories selector
  */
 protected function _get_html_for_taxonomy($view_args, $tag = false)
 {
     $taxonomy_name = 'events_categories';
     $type = 'category';
     $type_for_filter = 'cat_ids';
     $type_for_view_args = 'categories';
     if (true === $tag) {
         $taxonomy_name = 'events_tags';
         $type = 'tag';
         $type_for_filter = 'tag_ids';
         $type_for_view_args = 'tags';
     }
     $terms = get_terms($taxonomy_name, array('orderby' => 'name'));
     if (empty($terms)) {
         return '';
     }
     foreach ($terms as &$term) {
         $href = $this->_registry->get('html.element.href', $view_args, $type);
         $href->set_term_id($term->term_id);
         $term->href = $href->generate_href();
         if (false === $tag) {
             $taxonomy = $this->_registry->get('view.event.taxonomy');
             $term->color = $taxonomy->get_category_color_square($term->term_id);
         }
     }
     $href_for_clearing_filter = $this->generate_href_without_arguments($view_args, array($type_for_filter));
     $args = array($type_for_view_args => $terms, 'selected_' . $type_for_filter => $view_args[$type_for_filter], 'data_type' => $view_args['data_type'], 'clear_filter' => $href_for_clearing_filter, 'text_clear_category_filter' => __('Clear category filter', AI1EC_PLUGIN_NAME), 'text_categories' => __('Categories', AI1EC_PLUGIN_NAME), 'text_clear_tag_filter' => __('Clear tag filter', AI1EC_PLUGIN_NAME), 'text_tags' => __('Tags', AI1EC_PLUGIN_NAME));
     $loader = $this->_registry->get('theme.loader');
     return $loader->get_file($type_for_view_args . '.twig', $args, false)->get_content();
 }
 public function get_shows($hide_empty = true)
 {
     $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => $hide_empty, 'cache_domain' => 'core');
     $podcast_show_slug = dipo_get_podcast_show_slug();
     $podcast_show = get_terms($podcast_show_slug, $args);
     return isset($podcast_show) ? $podcast_show : null;
 }
function smamo_widgets_init()
{
    $terms = get_terms('tax_widget', array('orderby' => 'id', 'hide_empty' => false));
    foreach ($terms as $widget) {
        register_sidebar(array('id' => $widget->slug, 'name' => $widget->name, 'description' => $widget->description, 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>'));
    }
}
 public function cleanup($opt = NULL, $cpt = NULL, $tax = NULL)
 {
     // Perform security checks.
     if (self::authorize() == TRUE) {
         // Remove plugin options from wp_options database table.
         if ($opt) {
             foreach ($opt as $option) {
                 delete_option($option);
             }
         }
         // Remove plugin-specific custom post type entries.
         if ($cpt) {
             $entries = get_posts(array('post_type' => $cpt, 'numberposts' => -1));
             foreach ($entries as $entry) {
                 wp_delete_post($entry->ID, TRUE);
             }
         }
         // Remove plugin-specific custom taxonomy terms.
         if ($tax) {
             global $wp_taxonomies;
             foreach ($tax as $taxonomy) {
                 register_taxonomy($taxonomy['taxonomy'], $taxonomy['object_type']);
                 $terms = get_terms($taxonomy['taxonomy'], array('hide_empty' => 0));
                 foreach ($terms as $term) {
                     wp_delete_term($term->term_id, $taxonomy['taxonomy']);
                 }
                 delete_option($taxonomy['taxonomy'] . '_children');
                 unset($wp_taxonomies[$taxonomy['taxonomy']]);
             }
         }
     }
 }
Example #11
0
function get_category_list()
{
    $terms = get_terms('category', 'orderby=name&hide_empty=0');
    // 获取到的分类数量
    $count = count($terms);
    $data = array();
    if ($count > 0) {
        // 循环输出所有分类信息
        foreach ($terms as $term) {
            $term_array = get_object_vars($term);
            // ["term_id"]=> string(1) "7"
            // ["name"]=> string(7) "ASP.NET"
            // ["slug"]=> string(6) "aspnet"
            // ["term_group"]=> string(1) "0"
            // ["term_taxonomy_id"]=> string(1) "7"
            // ["taxonomy"]=> string(8) "category"
            // ["description"]=> string(0) ""
            //["parent"]=> string(1) "4"
            // ["count"]=> string(1) "1" }
            // echo '<li><a href="'.get_term_link($term, $term->slug).'" title="'.$term->name.'">'.$term->name.'</a></li>';
            $array = array('text' => $term_array['name'], 'id' => $term_array['term_id'], 'count' => $term_array['count'], 'description' => $term_array['description'], 'iconCls' => 'x-fa fa-inbox', 'leaf' => true);
            // if (!$is_leaf) {
            // $array =array_merge($array, $NextAgent);
            // }
            array_push($data, $array);
        }
    }
    $res = new Response();
    $res->success = true;
    $res->message = '';
    $res->data = $data;
    echo $res->to_json();
}
Example #12
0
/**
 * List all (or limited) product categories
 **/
function woocommerce_product_categories($atts)
{
    global $woocommerce_loop;
    extract(shortcode_atts(array('number' => null, 'orderby' => 'name', 'order' => 'ASC', 'columns' => '4', 'hide_empty' => 1), $atts));
    if (isset($atts['ids'])) {
        $ids = explode(',', $atts['ids']);
        $ids = array_map('trim', $ids);
    } else {
        $ids = array();
    }
    $hide_empty = $hide_empty == true || $hide_empty == 1 ? 1 : 0;
    $args = array('number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids);
    $terms = get_terms('product_cat', $args);
    $woocommerce_loop['columns'] = $columns;
    ob_start();
    if ($product_categories) {
        echo '<ul class="products">';
        foreach ($product_categories as $category) {
            woocommerce_get_template('content-product_cat.php', array('category' => $category));
        }
        echo '</ul>';
    }
    wp_reset_query();
    return ob_get_clean();
}
 function gdlr_add_import_action()
 {
     // setting > reading area
     update_option('show_on_front', 'page');
     update_option('page_on_front', 3720);
     update_option('page_for_posts', 0);
     // style-custom file
     if ($_POST['import-file'] == 'demo.xml') {
         $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default.txt';
         $default_admin_option = unserialize(file_get_contents($default_file));
         update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
         $source = get_template_directory() . '/stylesheet/style-custom-light.css';
         $destination = get_template_directory() . '/stylesheet/style-custom.css';
         copy($source, $destination);
     } else {
         if ($_POST['import-file'] == 'demo-dark.xml') {
             $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default-dark.txt';
             $default_admin_option = unserialize(file_get_contents($default_file));
             update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
             $source = get_template_directory() . '/stylesheet/style-custom-dark.css';
             $destination = get_template_directory() . '/stylesheet/style-custom.css';
             copy($source, $destination);
         } else {
             if ($_POST['import-file'] == 'demo-modern.xml') {
                 $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default-modern.txt';
                 $default_admin_option = unserialize(file_get_contents($default_file));
                 update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
                 $source = get_template_directory() . '/stylesheet/style-custom-modern.css';
                 $destination = get_template_directory() . '/stylesheet/style-custom.css';
                 copy($source, $destination);
             } else {
                 if ($_POST['import-file'] == 'demo-hostel.xml') {
                     $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default-hostel.txt';
                     $default_admin_option = unserialize(file_get_contents($default_file));
                     update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
                     $source = get_template_directory() . '/stylesheet/style-custom-hostel.css';
                     $destination = get_template_directory() . '/stylesheet/style-custom.css';
                     copy($source, $destination);
                 }
             }
         }
     }
     // menu to themes location
     $nav_id = 0;
     $navs = get_terms('nav_menu', array('hide_empty' => true));
     foreach ($navs as $nav) {
         if ($nav->name == 'Main menu') {
             $nav_id = $nav->term_id;
             break;
         }
     }
     set_theme_mod('nav_menu_locations', array('main_menu' => $nav_id));
     // import the widget
     $widget_file = GDLR_LOCAL_PATH . '/plugins/goodlayers-importer-widget.txt';
     $widget_data = unserialize(file_get_contents($widget_file));
     // retrieve widget data
     foreach ($widget_data as $key => $value) {
         update_option($key, $value);
     }
 }
Example #14
0
function vbegy_register_meta_boxes()
{
    global $prefix;
    if (!class_exists('RW_Meta_Box')) {
        return;
    }
    $options_categories = array();
    $options_categories_obj = get_categories();
    foreach ($options_categories_obj as $category) {
        $options_categories[$category->cat_ID] = $category->cat_name;
    }
    $sidebars = get_option('sidebars');
    $new_sidebars = array('default' => 'Default');
    foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) {
        $new_sidebars[$sidebar['id']] = $sidebar['name'];
    }
    // Menus
    $menus = array();
    $all_menus = get_terms('nav_menu', array('hide_empty' => true));
    foreach ($all_menus as $menu) {
        $menus[$menu->term_id] = $menu->name;
    }
    $meta_boxes = array();
    $post_types = get_post_types();
    $meta_boxes[] = array('id' => 'blog', 'title' => 'Blog Options', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => "Post number", 'desc' => "put the post number", 'id' => $prefix . 'post_number_b', 'type' => 'text', 'std' => "5"), array('name' => "Order by", 'desc' => "Select the post order by .", 'id' => $prefix . "orderby_post_b", 'std' => array("recent"), 'type' => "select", 'options' => array('recent' => 'Recent', 'popular' => 'Popular', 'random' => 'Random')), array('name' => "Display by", 'id' => $prefix . "post_display_b", 'type' => 'select', 'options' => array('lasts' => 'Lasts', 'single_category' => 'Single category', 'multiple_categories' => 'Multiple categories', 'posts' => 'Custom posts'), 'std' => array('lasts')), array('name' => 'Single category', 'id' => $prefix . 'post_single_category_b', 'type' => 'select', 'options' => $options_categories), array('name' => "Post categories", 'desc' => "Select the post categories .", 'id' => $prefix . "post_categories_b", 'options' => $options_categories, 'type' => 'checkbox_list'), array('name' => "Post ids", 'desc' => "Type the post ids .", 'id' => $prefix . "post_posts_b", 'std' => '', 'type' => 'text')));
    $meta_boxes[] = array('id' => 'contact_us', 'title' => 'Contact us Options', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => 'Map', 'desc' => 'Put the code iframe map .', 'id' => $prefix . 'contact_map', 'std' => '<iframe height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=egypt&amp;hl=en&amp;sll=26.820553,30.802498&amp;sspn=16.874794,19.753418&amp;hnear=Egypt&amp;t=m&amp;z=6&amp;output=embed"></iframe>', 'type' => 'textarea'), array('name' => 'Form shortcode', 'desc' => 'Put the form shortcode .', 'id' => $prefix . 'contact_form', 'type' => 'text'), array('name' => 'About widget enable or disable', 'desc' => 'About widget enable or disable .', 'id' => $prefix . 'about_widget', 'std' => 1, 'type' => 'checkbox'), array('name' => 'About content', 'desc' => 'Put the about content .', 'id' => $prefix . 'about_content', 'type' => 'textarea'), array('name' => 'Address', 'desc' => 'Put the address .', 'id' => $prefix . 'address', 'type' => 'text'), array('name' => 'Phone', 'desc' => 'Put the phone .', 'id' => $prefix . 'phone', 'type' => 'text'), array('name' => 'Email', 'desc' => 'Put the email .', 'id' => $prefix . 'email', 'type' => 'text'), array('name' => 'Social enable or disable', 'desc' => 'Social widget enable or disable .', 'id' => $prefix . 'social', 'std' => 1, 'type' => 'checkbox'), array('name' => 'Facebook', 'desc' => 'Put the facebook .', 'id' => $prefix . 'facebook', 'type' => 'text'), array('name' => 'Twitter', 'desc' => 'Put the twitter .', 'id' => $prefix . 'twitter', 'type' => 'text'), array('name' => 'Youtube', 'desc' => 'Put the youtube .', 'id' => $prefix . 'youtube', 'type' => 'text'), array('name' => 'Linkedin', 'desc' => 'Put the linkedin .', 'id' => $prefix . 'linkedin', 'type' => 'text'), array('name' => 'Google plus', 'desc' => 'Put the google plus .', 'id' => $prefix . 'google_plus', 'type' => 'text'), array('name' => 'Instagram', 'desc' => 'Put the instagram .', 'id' => $prefix . 'instagram', 'type' => 'text'), array('name' => 'Dribbble', 'desc' => 'Put the dribbble .', 'id' => $prefix . 'dribbble', 'type' => 'text'), array('name' => 'Pinterest', 'desc' => 'Put the pinterest .', 'id' => $prefix . 'pinterest', 'type' => 'text'), array('name' => 'Rss enable or disable', 'desc' => 'Rss widget enable or disable .', 'id' => $prefix . 'rss', 'std' => 1, 'type' => 'checkbox')));
    $meta_boxes[] = array('id' => 'ask_me', 'title' => 'Home Options', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => 'Home top box enable or disable', 'desc' => 'Home top box enable or disable .', 'id' => $prefix . 'index_top_box', 'std' => 1, 'type' => 'checkbox'), array('name' => 'Home top box layout', 'desc' => 'Home top box layout .', 'id' => $prefix . 'index_top_box_layout', 'std' => '1', 'class' => 'index_top_box_layout', 'type' => 'radio', 'options' => array("1" => "Style 1", "2" => "Style 2")), array('name' => 'Remove the content ?', 'desc' => 'Remove the content ( Title, content, buttons and ask question ) ?', 'id' => $prefix . 'remove_index_content', 'type' => 'checkbox'), array('name' => 'Home top box background', 'desc' => 'Home top box background .', 'id' => $prefix . 'index_top_box_background', 'std' => 'background', 'class' => 'index_top_box_background', 'type' => 'radio', 'options' => array("background" => "Background", "slideshow" => "Slideshow")), array('name' => 'Upload your images', 'id' => $prefix . "upload_images_home", 'type' => 'image_advanced'), array('name' => "Background color", 'id' => $prefix . "background_color_home", 'type' => 'color'), array('name' => 'Background', 'id' => $prefix . "background_img_home", 'type' => 'upload'), array('name' => "Background repeat", 'id' => $prefix . "background_repeat_home", 'type' => 'select', 'options' => array('repeat' => 'repeat', 'no-repeat' => 'no-repeat', 'repeat-x' => 'repeat-x', 'repeat-y' => 'repeat-y')), array('name' => "Background fixed", 'id' => $prefix . "background_fixed_home", 'type' => 'select', 'options' => array('fixed' => 'fixed', 'scroll' => 'scroll')), array('name' => "Background position x", 'id' => $prefix . "background_position_x_home", 'type' => 'select', 'options' => array('left' => 'left', 'center' => 'center', 'right' => 'right')), array('name' => "Background position y", 'id' => $prefix . "background_position_y_home", 'type' => 'select', 'options' => array('top' => 'top', 'center' => 'center', 'bottom' => 'bottom')), array('name' => "Full Screen Background", 'id' => $prefix . "background_full_home", 'type' => 'checkbox', 'std' => 0), array('name' => 'Home top box title', 'desc' => 'Put the Home top box title .', 'id' => $prefix . 'index_title', 'std' => 'Welcome to Ask me', 'type' => 'text'), array('name' => 'Home top box content', 'desc' => 'Put the Home top box content .', 'id' => $prefix . 'index_content', 'std' => 'Duis dapibus aliquam mi, eget euismod sem scelerisque ut. Vivamus at elit quis urna adipiscing iaculis. Curabitur vitae velit in neque dictum blandit. Proin in iaculis neque.', 'type' => 'textarea'), array('name' => 'About Us title', 'desc' => 'Put the About Us title .', 'id' => $prefix . 'index_about', 'std' => 'About Us', 'type' => 'text'), array('name' => 'About Us link', 'desc' => 'Put the About Us link .', 'id' => $prefix . 'index_about_h', 'std' => '#', 'type' => 'text'), array('name' => 'Join Now title', 'desc' => 'Put the Join Now title .', 'id' => $prefix . 'index_join', 'std' => 'Join Now', 'type' => 'text'), array('name' => 'Join Now link', 'desc' => 'Put the Join Now link .', 'id' => $prefix . 'index_join_h', 'std' => '#', 'type' => 'text'), array('name' => 'About Us title if login', 'desc' => 'Put the About Us title if login .', 'id' => $prefix . 'index_about_login', 'std' => 'About Us', 'type' => 'text'), array('name' => 'About Us link if login', 'desc' => 'Put the About Us link if login .', 'id' => $prefix . 'index_about_h_login', 'std' => '#', 'type' => 'text'), array('name' => 'Ask question title if login', 'desc' => 'Put the Ask question title if login .', 'id' => $prefix . 'index_join_login', 'std' => 'Ask question', 'type' => 'text'), array('name' => 'Ask question link if login', 'desc' => 'Put the Ask question link if login .', 'id' => $prefix . 'index_join_h_login', 'std' => '#', 'type' => 'text'), array('name' => "Page style", 'id' => $prefix . "index_tabs", 'type' => 'select', 'options' => array(1 => "Tabs", 2 => 'Recent questions', 3 => 'Page content')), array('name' => 'Tabs pagination enable or disable', 'desc' => 'Tabs pagination enable or disable .', 'id' => $prefix . 'pagination_tabs', 'std' => 1, 'type' => 'checkbox'), array('name' => 'Choose your tabs', 'id' => $prefix . 'what_tab', 'options' => array("recent_questions" => "Recent Questions", "most_responses" => "Most Responses / answers", "recently_answered" => "Recently Answered", "no_answers" => "No answers", "most_visit" => "Most Visit", "most_vote" => "Most Vote", "recent_posts" => "Recent Posts"), 'std' => array("recent_questions", "most_responses", "recently_answered", "no_answers"), 'type' => 'checkbox_list'), array('name' => 'Posts per page', 'desc' => 'Put the Posts per page .', 'id' => $prefix . 'posts_per_page', 'std' => '10', 'type' => 'text')));
    $meta_boxes[] = array('id' => 'post_page', 'title' => 'Post and Page Options', 'pages' => array('post', 'page', 'question', 'product'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => 'Layout', 'id' => $prefix . "layout", 'class' => 'radio_no_margin', 'type' => 'radio', 'options' => array('default' => '', 'full' => '', 'fixed' => '', 'fixed_2' => ''), 'std' => 'default'), array('name' => 'Choose page / post template', 'id' => $prefix . "home_template", 'class' => 'radio_no_margin', 'type' => 'radio', 'options' => array('default' => '', 'grid_1200' => '', 'grid_970' => ''), 'std' => 'default'), array('name' => 'Choose page / post skin', 'id' => $prefix . "site_skin_l", 'class' => 'radio_no_margin', 'type' => 'radio', 'options' => array('default' => '', 'site_light' => '', 'site_dark' => ''), 'std' => 'default'), array('name' => 'Choose Your Skin', 'id' => $prefix . "skin", 'class' => 'radio_no_margin', 'type' => 'radio', 'options' => array('default' => '', 'skin' => '', 'blue' => '', 'gray' => '', 'green' => '', 'moderate_cyan' => '', 'orange' => '', 'purple' => '', 'red' => '', 'strong_cyan' => '', 'yellow' => ''), 'std' => 'default'), array('name' => 'Primary Color', 'id' => $prefix . "primary_color", 'type' => 'color'), array('name' => 'Secondary Color', 'id' => $prefix . "secondary_color", 'type' => 'color'), array('name' => 'Background', 'id' => $prefix . "background_img", 'type' => 'upload'), array('name' => "Background color", 'id' => $prefix . "background_color", 'type' => 'color'), array('name' => "Background repeat", 'id' => $prefix . "background_repeat", 'type' => 'select', 'options' => array('repeat' => 'repeat', 'no-repeat' => 'no-repeat', 'repeat-x' => 'repeat-x', 'repeat-y' => 'repeat-y')), array('name' => "Background fixed", 'id' => $prefix . "background_fixed", 'type' => 'select', 'options' => array('fixed' => 'fixed', 'scroll' => 'scroll')), array('name' => "Background position x", 'id' => $prefix . "background_position_x", 'type' => 'select', 'options' => array('left' => 'left', 'center' => 'center', 'right' => 'right')), array('name' => "Background position y", 'id' => $prefix . "background_position_y", 'type' => 'select', 'options' => array('top' => 'top', 'center' => 'center', 'bottom' => 'bottom')), array('name' => "Full Screen Background", 'id' => $prefix . "background_full", 'type' => 'checkbox', 'std' => 0), array('name' => 'Sidebar', 'id' => $prefix . "sidebar", 'class' => 'radio_no_margin', 'type' => 'radio', 'options' => array('default' => '', 'right' => '', 'full' => '', 'left' => ''), 'std' => 'default'), array('name' => 'Select your sidebar', 'id' => $prefix . 'what_sidebar', 'type' => 'select', 'options' => $new_sidebars), array('name' => 'Head post', 'id' => $prefix . 'what_post', 'type' => 'select', 'options' => array('image' => "Featured Image", 'google' => "Google Map", 'slideshow' => "Slideshow", 'video' => "Video"), 'std' => array('image'), 'desc' => 'Choose from here the post type .'), array('name' => 'Google map', 'desc' => "Put your google map html", 'id' => $prefix . "google", 'type' => 'textarea', 'cols' => "40", 'rows' => "8"), array('name' => 'Slideshow ?', 'id' => $prefix . 'slideshow_type', 'type' => 'select', 'options' => array('custom_slide' => "Custom Slideshow", 'upload_images' => "Upload your images"), 'std' => array('custom_slide')), array('id' => $prefix . 'slideshow_post', 'type' => 'note'), array('name' => 'Upload your images', 'id' => $prefix . "upload_images", 'type' => 'image_advanced'), array('name' => 'Video type', 'id' => $prefix . 'video_post_type', 'type' => 'select', 'options' => array('youtube' => "Youtube", 'vimeo' => "Vimeo", 'daily' => "Dialymotion", 'html5' => "HTML 5"), 'std' => array('youtube'), 'desc' => 'Choose from here the video type'), array('name' => 'Video ID', 'id' => $prefix . 'video_post_id', 'desc' => 'Put here the video id : http://www.youtube.com/watch?v=sdUUx5FdySs EX : "sdUUx5FdySs"', 'type' => 'text', 'std' => ''), array('name' => 'Video Image', 'desc' => 'Upload a image, or enter URL to an image if it is already uploaded. ', 'id' => $prefix . 'video_image', 'std' => '', 'type' => 'upload'), array('name' => 'Mp4 video', 'id' => $prefix . 'video_mp4', 'desc' => 'Put here the mp4 video', 'type' => 'text', 'std' => ''), array('name' => 'M4v video', 'id' => $prefix . 'video_m4v', 'desc' => 'Put here the m4v video', 'type' => 'text', 'std' => ''), array('name' => 'Webm video', 'id' => $prefix . 'video_webm', 'desc' => 'Put here the webm video', 'type' => 'text', 'std' => ''), array('name' => 'Ogv video', 'id' => $prefix . 'video_ogv', 'desc' => 'Put here the ogv video', 'type' => 'text', 'std' => ''), array('name' => 'Wmv video', 'id' => $prefix . 'video_wmv', 'desc' => 'Put here the wmv video', 'type' => 'text', 'std' => ''), array('name' => 'Flv video', 'id' => $prefix . 'video_flv', 'desc' => 'Put here the flv video', 'type' => 'text', 'std' => '')));
    $meta_boxes[] = array('id' => 'single_page', 'title' => 'Single Pages Options', 'pages' => array('post', 'page', 'question', 'product'), 'context' => 'side', 'priority' => 'default', 'fields' => array(array('name' => 'Choose a custom page setting', 'desc' => 'Choose a custom page setting .', 'id' => $prefix . 'custom_page_setting', 'type' => 'checkbox'), array('name' => 'Sticky sidebar enable or disable', 'desc' => 'Sticky sidebar enable or disable .', 'id' => $prefix . 'sticky_sidebar_s', 'std' => 'on', 'type' => 'checkbox'), array('name' => 'Post meta enable or disable', 'desc' => 'Post meta enable or disable .', 'id' => $prefix . 'post_meta_s', 'std' => 'on', 'type' => 'checkbox'), array('name' => 'Share enable or disable', 'desc' => 'Share enable or disable .', 'id' => $prefix . 'post_share_s', 'std' => 'on', 'type' => 'checkbox'), array('name' => 'Author info box enable or disable', 'desc' => 'Author info box enable or disable .', 'id' => $prefix . 'post_author_box_s', 'std' => 'on', 'type' => 'checkbox'), array('name' => 'Related post enable or disable', 'desc' => 'Related post enable or disable .', 'id' => $prefix . 'related_post_s', 'std' => 'on', 'type' => 'checkbox'), array('name' => 'Comments enable or disable', 'desc' => 'Comments enable or disable .', 'id' => $prefix . 'post_comments_s', 'std' => 'on', 'type' => 'checkbox'), array('name' => 'Navigation post enable or disable', 'desc' => 'Navigation post ( next and previous posts) enable or disable .', 'id' => $prefix . 'post_navigation_s', 'std' => 'on', 'type' => 'checkbox')));
    $meta_boxes[] = array('id' => 'advertising', 'title' => 'Advertising Options', 'pages' => array('post', 'page', 'question', 'product'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => "Advertising after header", 'id' => $prefix . 'header_adv_n', 'type' => 'heading'), array('name' => 'Advertising type', 'desc' => 'Advertising type .', 'id' => $prefix . 'header_adv_type', 'std' => 'custom_image', 'type' => 'radio', 'class' => 'radio', 'options' => array("display_code" => "Display code", "custom_image" => "Custom Image")), array('name' => 'Image URL', 'desc' => 'Upload a image, or enter URL to an image if it is already uploaded. ', 'id' => $prefix . 'header_adv_img', 'std' => '', 'type' => 'upload'), array('name' => 'Advertising url', 'desc' => 'Advertising url. ', 'id' => $prefix . 'header_adv_href', 'std' => '#', 'type' => 'text'), array('name' => "Advertising Code html ( Ex: Google ads)", 'desc' => "Advertising Code html ( Ex: Google ads)", 'id' => $prefix . 'header_adv_code', 'std' => '', 'type' => 'textarea'), array('name' => "Advertising after share and tags ( in post and question )", 'id' => $prefix . 'share_adv_n', 'type' => 'heading'), array('name' => 'Advertising type', 'desc' => 'Advertising type .', 'id' => $prefix . 'share_adv_type', 'std' => 'custom_image', 'type' => 'radio', 'class' => 'radio', 'options' => array("display_code" => "Display code", "custom_image" => "Custom Image")), array('name' => 'Image URL', 'desc' => 'Upload a image, or enter URL to an image if it is already uploaded. ', 'id' => $prefix . 'share_adv_img', 'std' => '', 'type' => 'upload'), array('name' => 'Advertising url', 'desc' => 'Advertising url. ', 'id' => $prefix . 'share_adv_href', 'std' => '#', 'type' => 'text'), array('name' => "Advertising Code html ( Ex: Google ads)", 'desc' => "Advertising Code html ( Ex: Google ads)", 'id' => $prefix . 'share_adv_code', 'std' => '', 'type' => 'textarea'), array('name' => "Advertising after content", 'id' => $prefix . 'content_adv_n', 'type' => 'heading'), array('name' => 'Advertising type', 'desc' => 'Advertising type .', 'id' => $prefix . 'content_adv_type', 'std' => 'custom_image', 'type' => 'radio', 'class' => 'radio', 'options' => array("display_code" => "Display code", "custom_image" => "Custom Image")), array('name' => 'Image URL', 'desc' => 'Upload a image, or enter URL to an image if it is already uploaded. ', 'id' => $prefix . 'content_adv_img', 'std' => '', 'type' => 'upload'), array('name' => 'Advertising url', 'desc' => 'Advertising url. ', 'id' => $prefix . 'content_adv_href', 'std' => '#', 'type' => 'text'), array('name' => "Advertising Code html ( Ex: Google ads)", 'desc' => "Advertising Code html ( Ex: Google ads)", 'id' => $prefix . 'content_adv_code', 'std' => '', 'type' => 'textarea')));
    foreach ($meta_boxes as $meta_box) {
        new RW_Meta_Box($meta_box);
    }
}
 /**
  * Displays the 'tagcloud' display type
  *
  * @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
  */
 function index_action($displayed_gallery, $return = FALSE)
 {
     $display_settings = $displayed_gallery->display_settings;
     $application = $this->object->get_registry()->get_utility('I_Router')->get_routed_app();
     $tag = $this->param('gallerytag');
     // we're looking at a tag, so show images w/that tag as a thumbnail gallery
     if (!is_home() && !empty($tag)) {
         return $this->object->get_registry()->get_utility('I_Displayed_Gallery_Renderer')->display_images(array('source' => 'tags', 'container_ids' => array(esc_attr($tag)), 'display_type' => $display_settings['display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $display_settings));
     }
     $defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
     $args = wp_parse_args('', $defaults);
     // Always query top tags
     $tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
     foreach ($tags as $key => $tag) {
         $tags[$key]->link = $this->object->set_param_for($application->get_routed_url(TRUE), 'gallerytag', $tag->slug);
         $tags[$key]->id = $tag->term_id;
     }
     $params = $display_settings;
     $params['inner_content'] = $displayed_gallery->inner_content;
     $params['storage'] =& $storage;
     $params['tagcloud'] = wp_generate_tag_cloud($tags, $args);
     $params['displayed_gallery_id'] = $displayed_gallery->id();
     $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
     return $this->object->render_partial('photocrati-nextgen_basic_tagcloud#nextgen_basic_tagcloud', $params, $return);
 }
 public static function search_terms($request = null)
 {
     $response = (object) array('status' => false, 'message' => __('Your request has failed', 'fakerpress'), 'results' => array(), 'more' => true);
     if (!Admin::$is_ajax && is_null($request) || !is_user_logged_in()) {
         return Admin::$is_ajax ? exit(json_encode($response)) : $response;
     }
     $request = (object) wp_parse_args($request, array('search' => isset($_POST['search']) ? $_POST['search'] : '', 'post_type' => isset($_POST['post_type']) ? $_POST['post_type'] : null, 'page' => absint(isset($_POST['page']) ? $_POST['page'] : 0), 'page_limit' => absint(isset($_POST['page_limit']) ? $_POST['page_limit'] : 10)));
     if (is_null($request->post_type) || empty($request->post_type)) {
         $request->post_type = get_post_types(array('public' => true));
     }
     $response->status = true;
     $response->message = __('Request successful', 'fakerpress');
     preg_match('/@(\\w+)/i', $request->search, $response->regex);
     if (!empty($response->regex)) {
         $request->search = array_filter(array_map('trim', explode('|', str_replace($response->regex[0], '|', $request->search))));
         $request->search = reset($request->search);
         $taxonomies = $response->regex[1];
     } else {
         $taxonomies = get_object_taxonomies($request->post_type);
     }
     $response->taxonomies = get_object_taxonomies($request->post_type, 'objects');
     $response->results = get_terms((array) $taxonomies, array('hide_empty' => false, 'search' => $request->search, 'number' => $request->page_limit, 'offset' => $request->page_limit * ($request->page - 1)));
     if (empty($response->results) || count($response->results) < $request->page_limit) {
         $response->more = false;
     }
     return Admin::$is_ajax ? exit(json_encode($response)) : $response;
 }
Example #17
0
function _zn_documentation($options)
{
    $categories = get_terms('documentation_category', array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'show_count ' => 1));
    $limit = '6';
    if (!empty($options['doc_num_items'])) {
        $limit = $options['doc_num_items'];
    }
    $count = count($categories);
    $i = 1;
    foreach ($categories as $category) {
        if ($i % 2 == 1) {
            echo '<div class="row-fluid zn_photo_gallery">';
        }
        echo '<div class="span6">';
        echo '<h3><a href="' . get_term_link($category->slug, 'documentation_category') . '">' . $category->name . ' (' . $category->count . ')</a></h3>';
        $args = array('post_type' => 'documentation', 'post_status' => 'publish', 'posts_per_page' => $limit, 'documentation_category' => $category->slug);
        $zn_doc = new WP_Query($args);
        echo '<ol>';
        while ($zn_doc->have_posts()) {
            $zn_doc->the_post();
            global $post;
            echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
        }
        // end loop
        echo "</ol>";
        echo '</div>';
        if ($i % 2 == 0 || $i == $count) {
            echo '</div>';
        }
        $i++;
    }
}
Example #18
0
 /**
  * Get all terms in the given taxonomy.
  *
  * @param  string|\Tev\Taxonomy\Model\Taxonomy $taxonomy Taxonomy object or name
  * @return \Tev\Term\Model\Term[]
  */
 public function getByTaxonomy($taxonomy)
 {
     if (!$taxonomy instanceof Taxonomy) {
         $taxonomy = $this->taxonomyFactory->create($taxonomy);
     }
     return $this->convertTermsArray(get_terms($taxonomy->getName(), array('hide_empty' => false)), $taxonomy);
 }
/**
 * Create the function to output the contents of our Dashboard Widget.
 */
function bbconnect_workqueues_actions_dashboard_widget_function()
{
    echo ' <table cellspacing="0" class="widefat gf_dashboard_view" style="border:0px;">' . "\n";
    echo '        <thead>' . "\n";
    echo '            <tr>' . "\n";
    echo '                <td class="gf_dashboard_form_title_header" style="font-style: italic; font-weight: bold; padding: 8px 18px!important; text-align: left">Workqueue</td>' . "\n";
    echo '                <td class="gf_dashboard_entries_unread_header" style="font-style: italic; font-weight: bold; padding: 8px 18px!important; text-align: center">For Action</td>' . "\n";
    echo '            </tr>' . "\n";
    echo '        </thead>' . "\n";
    echo '        <tbody class="list:user user-list">' . "\n";
    $taxonomies = array('bb_note_type');
    $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'fields' => 'all');
    $note_types = get_terms($taxonomies, $args);
    foreach ($note_types as $note_type) {
        if ($note_type->parent == 0) {
            continue;
        }
        // Display whatever it is you want to show.
        $args = array('posts_per_page' => -1, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'bb_note', 'post_status' => 'publish', 'meta_query' => array(array('key' => '_bbc_action_required', 'value' => 'true')), 'bb_note_type' => $note_type->slug);
        $notes = get_posts($args);
        if (count($notes) > 0) {
            echo bbconnect_workqueues_actions_dashboard_widget_row($note_type->term_id, $note_type->name, $note_type->slug, count($notes));
        }
    }
    echo '         </tbody>' . "\n";
    echo '     </table>' . "\n";
}
Example #20
0
 public static function gzd_json_search_delivery_time()
 {
     ob_start();
     check_ajax_referer('search-products', 'security');
     $term = (string) wc_clean(stripslashes($_GET['term']));
     $terms = array();
     if (empty($term)) {
         die;
     }
     $args = array('hide_empty' => false);
     if (is_numeric($term)) {
         $args['include'] = array(absint($term));
     } else {
         $args['name__like'] = (string) $term;
     }
     $query = get_terms('product_delivery_time', $args);
     if (!empty($query)) {
         foreach ($query as $term) {
             $terms[$term->term_id] = rawurldecode($term->name);
         }
     } else {
         $terms[rawurldecode($term)] = rawurldecode(sprintf(__("%s [new]", "woocommerce-germanized"), $term));
     }
     wp_send_json($terms);
 }
function appthemes_get_custom_taxonomy($post_id, $tax_name, $tax_arg)
{
    $tax_array = get_terms($tax_name, array('hide_empty' => '0'));
    if ($tax_array && sizeof($tax_array) > 0) {
        if (is_object_in_term($post_id, $tax_name)) {
            foreach ($tax_array as $tax_val) {
                if (is_object_in_term($post_id, $tax_name, array($tax_val->term_id))) {
                    switch ($tax_arg) {
                        case 'slug':
                            $link = get_term_link($tax_val, $tax_name);
                            if (is_wp_error($link)) {
                                return $link;
                            }
                            return $link;
                            break;
                        case 'slug_name':
                            return $tax_val->slug;
                            break;
                        case 'name':
                            return $tax_val->name;
                            break;
                        case 'term_id':
                            return $tax_val->term_id;
                            break;
                        default:
                            return;
                            break;
                    }
                    // end switch
                }
            }
        }
    }
}
Example #22
0
function nectar_metabox_page()
{
    $options = get_option('salient');
    if (!empty($options['transparent-header']) && $options['transparent-header'] == '1') {
        $disable_transparent_header = array('name' => __('Disable Transparency From Navigation', NECTAR_THEME_NAME), 'desc' => __('You can use this option to force your navigation header to stay a solid color even if it qualifies to trigger the <a target="_blank" href="' . admin_url('?page=redux_options&tab=4#header-padding') . '"> transparent effect</a> you have activated in the Salient options panel.', NECTAR_THEME_NAME), 'id' => '_disable_transparent_header', 'type' => 'checkbox', 'std' => '');
        $force_transparent_header = array('name' => __('Force Transparency On Navigation', NECTAR_THEME_NAME), 'desc' => __('You can use this option to force your navigation header to start transparent even if it does not qualify to trigger the <a target="_blank" href="' . admin_url('?page=redux_options&tab=4#header-padding') . '"> transparent effect</a> you have activated in the Salient options panel.', NECTAR_THEME_NAME), 'id' => '_force_transparent_header', 'type' => 'checkbox', 'std' => '');
    } else {
        $disable_transparent_header = null;
        $force_transparent_header = null;
    }
    #-----------------------------------------------------------------#
    # Header Settings
    #-----------------------------------------------------------------#
    $meta_box = array('id' => 'nectar-metabox-page-header', 'title' => __('Page Header Settings', NECTAR_THEME_NAME), 'description' => __('Here you can configure how your page header will appear. <br/> For a full width background image behind your header text, simply upload the image below. To have a standard header just fill out the fields below and don\'t upload an image.', NECTAR_THEME_NAME), 'post_type' => 'page', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Page Header Image', NECTAR_THEME_NAME), 'desc' => __('The image should be between 1600px - 2000px wide and have a minimum height of 475px for best results. Click "Browse" to upload and then "Insert into Post".', NECTAR_THEME_NAME), 'id' => '_nectar_header_bg', 'type' => 'file', 'std' => ''), array('name' => __('Parallax Header?', NECTAR_THEME_NAME), 'desc' => __('If you would like your header to have a parallax scroll effect check this box.', NECTAR_THEME_NAME), 'id' => '_nectar_header_parallax', 'type' => 'checkbox', 'std' => 1), array('name' => __('Page Header Height', NECTAR_THEME_NAME), 'desc' => __('How tall do you want your header? <br/>Don\'t include "px" in the string. e.g. 350 <br/><strong>This only applies when you are using an image/bg color.</strong>', NECTAR_THEME_NAME), 'id' => '_nectar_header_bg_height', 'type' => 'text', 'std' => ''), array('name' => __('Page Header Title', NECTAR_THEME_NAME), 'desc' => __('Enter in the page header title', NECTAR_THEME_NAME), 'id' => '_nectar_header_title', 'type' => 'text', 'std' => ''), array('name' => __('Page Header Subtitle', NECTAR_THEME_NAME), 'desc' => __('Enter in the page header subtitle', NECTAR_THEME_NAME), 'id' => '_nectar_header_subtitle', 'type' => 'text', 'std' => ''), array('name' => __('Text Alignment', NECTAR_THEME_NAME), 'desc' => __('Choose how you would like your header text to be aligned', NECTAR_THEME_NAME), 'id' => '_nectar_page_header_alignment', 'type' => 'choice_below', 'options' => array('left' => 'Left', 'center' => 'Center', 'right' => 'Right'), 'std' => 'left'), array('name' => __('Page Header Background Color', NECTAR_THEME_NAME), 'desc' => __('Set your desired page header background color if not using an image', NECTAR_THEME_NAME), 'id' => '_nectar_header_bg_color', 'type' => 'color', 'std' => ''), array('name' => __('Page Header Font Color', NECTAR_THEME_NAME), 'desc' => __('Set your desired page header font color', NECTAR_THEME_NAME), 'id' => '_nectar_header_font_color', 'type' => 'color', 'std' => ''), $disable_transparent_header, $force_transparent_header));
    $callback = create_function('$post,$meta_box', 'nectar_create_meta_box( $post, $meta_box["args"] );');
    add_meta_box($meta_box['id'], $meta_box['title'], $callback, $meta_box['post_type'], $meta_box['context'], $meta_box['priority'], $meta_box);
    #-----------------------------------------------------------------#
    # Portfolio Display Settings
    #-----------------------------------------------------------------#
    $portfolio_types = get_terms('project-type');
    $types_options = array("all" => "All");
    foreach ($portfolio_types as $type) {
        $types_options[$type->slug] = $type->name;
    }
    $meta_box = array('id' => 'nectar-metabox-portfolio-display', 'title' => __('Portfolio Display Settings', NECTAR_THEME_NAME), 'description' => __('Here you can configure which categories will display in your portfolio.', NECTAR_THEME_NAME), 'post_type' => 'page', 'context' => 'side', 'priority' => 'core', 'fields' => array(array('name' => 'Portfolio Categories', 'desc' => '', 'id' => 'nectar-metabox-portfolio-display', 'type' => 'multi-select', 'options' => $types_options, 'std' => 'all'), array('name' => 'Display Sortable', 'desc' => 'Should these portfolio items be sortable?', 'id' => 'nectar-metabox-portfolio-display-sortable', 'type' => 'checkbox', 'std' => '1')));
    $callback = create_function('$post,$meta_box', 'nectar_create_meta_box( $post, $meta_box["args"] );');
    add_meta_box($meta_box['id'], $meta_box['title'], $callback, $meta_box['post_type'], $meta_box['context'], $meta_box['priority'], $meta_box);
}
 /**
  * Return the terms for the given type.
  *
  * @param int $site_id Blog ID.
  *
  * @return array
  */
 public function get_terms_for_site($site_id)
 {
     $out = [];
     switch_to_blog($site_id);
     $taxonomy_object = get_taxonomy($this->taxonomy_name);
     if (!current_user_can($taxonomy_object->cap->edit_terms)) {
         $terms = [];
     } else {
         $terms = get_terms($this->taxonomy_name, ['hide_empty' => FALSE]);
     }
     foreach ($terms as $term) {
         if (is_taxonomy_hierarchical($this->taxonomy_name)) {
             $ancestors = get_ancestors($term->term_id, $this->taxonomy_name);
             if (!empty($ancestors)) {
                 foreach ($ancestors as $ancestor) {
                     $parent_term = get_term($ancestor, $this->taxonomy_name);
                     $term->name = $parent_term->name . '/' . $term->name;
                 }
             }
         }
         $out[$term->term_taxonomy_id] = esc_html($term->name);
     }
     restore_current_blog();
     uasort($out, 'strcasecmp');
     return $out;
 }
Example #24
0
 /**
  * List terms in a taxonomy.
  *
  * ## OPTIONS
  *
  * <taxonomy>...
  * : List terms of one or more taxonomies
  *
  * [--<field>=<value>]
  * : Filter by one or more fields (see get_terms() $args parameter for a list of fields).
  *
  * [--field=<field>]
  * : Prints the value of a single field for each term.
  *
  * [--fields=<fields>]
  * : Limit the output to specific object fields.
  *
  * [--format=<format>]
  * : Accepted values: table, csv, json, count, yaml. Default: table
  *
  * ## AVAILABLE FIELDS
  *
  * These fields will be displayed by default for each term:
  *
  * * term_id
  * * term_taxonomy_id
  * * name
  * * slug
  * * description
  * * parent
  * * count
  *
  * There are no optionally available fields.
  *
  * ## EXAMPLES
  *
  *     wp term list category --format=csv
  *
  *     wp term list post_tag --fields=name,slug
  *
  * @subcommand list
  */
 public function list_($args, $assoc_args)
 {
     foreach ($args as $taxonomy) {
         if (!taxonomy_exists($taxonomy)) {
             WP_CLI::error("Taxonomy {$taxonomy} doesn't exist.");
         }
     }
     $formatter = $this->get_formatter($assoc_args);
     $defaults = array('hide_empty' => false);
     $assoc_args = array_merge($defaults, $assoc_args);
     if (!empty($assoc_args['term_id'])) {
         $term = get_term_by('id', $assoc_args['term_id'], $args[0]);
         $terms = array($term);
     } else {
         $terms = get_terms($args, $assoc_args);
     }
     $terms = array_map(function ($term) {
         $term->count = (int) $term->count;
         $term->parent = (int) $term->parent;
         return $term;
     }, $terms);
     if ('ids' == $formatter->format) {
         $terms = wp_list_pluck($terms, 'term_id');
         echo implode(' ', $terms);
     } else {
         $formatter->display_items($terms);
     }
 }
 /**
  * Show the tag cloud
  */
 public function show_tag_filter($shortcode_atts)
 {
     if (isset($shortcode_atts['show_tags']) && ($shortcode_atts['show_tags'] === false || (string) $shortcode_atts['show_tags'] == 'false')) {
         return;
     }
     if (wp_count_terms('job_listing_tag') == 0) {
         return;
     }
     wp_register_script('wp-job-manager-ajax-tag-filters', JOB_MANAGER_TAGS_PLUGIN_URL . '/assets/js/tag-filter.js', array('jquery'), '1.0', true);
     $args_data = array('orderby' => 'count', 'order' => 'DESC');
     $jobs_tags_data = get_terms('job_listing_tag', $args_data);
     $queried_object = get_queried_object();
     foreach ($jobs_tags_data as $key => $jobs_tag_data) {
         if ($jobs_tag_data->count > 1) {
             $jobs_txt = 'jobs';
             $font_size = 2;
         } else {
             $jobs_txt = 'job';
             $font_size = 1;
         }
         //if($queried_object->term_id == $jobs_tag_data->term_id){ $active_class = 'activee'; }
         $anchor_data[] = '<a href="#" id="test_' . $key . '" "class="tag-link-' . $jobs_tag_data->term_id . ' ' . $active_class . ' show_bg_tag" title="' . $jobs_tag_data->count . ' ' . $jobs_txt . '" style="font-size: ' . $font_size . 'em;">' . $jobs_tag_data->name . '</a>';
     }
     $anchor_tag_data = array('anchor_tag_data' => $anchor_data);
     //anchor_tag_data
     wp_localize_script('wp-job-manager-ajax-tag-filters', 'anchor_tag_data_object', $anchor_tag_data);
     wp_enqueue_script('wp-job-manager-ajax-tag-filters', JOB_MANAGER_TAGS_PLUGIN_URL . '/assets/js/tag-filter.js', array('jquery'), '1.0', true);
     echo '<div class="filter_wide filter_by_tag">' . __('Filter by tag:', 'wp-job-manager-tags') . ' <span class="filter_by_tag_cloud"></span></div>';
 }
 public function init()
 {
     global $post;
     $this->objValues = array();
     if (isset($post)) {
         $terms = wp_get_post_terms($post->ID, $this->getName(), array("fields" => "all"));
         foreach ($terms as $n => $term) {
             $this->values[] = $term->slug;
             $this->valuesId[] = $term->term_id;
             $this->objValues[$term->slug] = $term;
         }
     }
     $all = $this->buildTerms(get_terms($this->getName(), array('hide_empty' => 0, 'fields' => 'all')));
     $childs = array();
     $names = array();
     foreach ($all as $term) {
         $names[$term['term_id']] = $term['name'];
         if (!isset($childs[$term['parent']]) || !is_array($childs[$term['parent']])) {
             $childs[$term['parent']] = array();
         }
         $childs[$term['parent']][] = $term['term_id'];
     }
     //        ksort($childs);
     $this->childs = $childs;
     $this->names = $names;
 }
 /**
  * downloads_by_category function.
  *
  * @access public
  * @param int $show_counts (default: 1)
  * @param int $hierarchical (default: 1)
  * @param int $show_uncategorized (default: 1)
  * @param string $orderby (default: '')
  * @return void
  */
 public function downloads_by_category($show_counts = 1, $hierarchical = 1, $show_uncategorized = 1, $orderby = '')
 {
     global $typenow, $wp_query;
     if ($typenow != 'dlm_download') {
         return;
     }
     include_once 'class-dlm-category-walker.php';
     $r = array();
     $r['pad_counts'] = 1;
     $r['hierarchical'] = $hierarchical;
     $r['hide_empty'] = 1;
     $r['show_count'] = $show_counts;
     $r['selected'] = isset($wp_query->query['dlm_download_category']) ? $wp_query->query['dlm_download_category'] : '';
     $r['menu_order'] = false;
     if ($orderby == 'order') {
         $r['menu_order'] = 'asc';
     } elseif ($orderby) {
         $r['orderby'] = $orderby;
     }
     $terms = get_terms('dlm_download_category', $r);
     if (!$terms) {
         return;
     }
     $output = "<select name='dlm_download_category' id='dropdown_dlm_download_category'>";
     $output .= '<option value="" ' . selected(isset($_GET['dlm_download_category']) ? $_GET['dlm_download_category'] : '', '', false) . '>' . __('Select a category', 'download-monitor') . '</option>';
     $output .= $this->walk_category_dropdown_tree($terms, 0, $r);
     $output .= "</select>";
     echo $output;
 }
 public function dispatch()
 {
     // Check there are categories available
     if (count(get_terms(WPBDP_CATEGORY_TAX, array('hide_empty' => false))) == 0) {
         if (current_user_can('administrator')) {
             return wpbdp_render_msg(_x('There are no categories assigned to the business directory yet. You need to assign some categories to the business directory. Only admins can see this message. Regular users are seeing a message that they cannot add their listing at this time. Listings cannot be added until you assign categories to the business directory.', 'templates', 'WPBDM'), 'error');
         } else {
             return wpbdp_render_msg(_x('Your listing cannot be added at this time. Please try again later. If this is not the first time you see this warning, please ask the site administrator to set up one or more categories inside the Directory.', 'templates', 'WPBDM'), 'error');
         }
     }
     // Login required?
     if (wpbdp_get_option('require-login') && !is_user_logged_in()) {
         return wpbdp_render('parts/login-required', array(), false);
     }
     if ($this->state->editing) {
         $current_user = wp_get_current_user();
         if (get_post($this->state->listing_id)->post_author != $current_user->ID && !current_user_can('administrator')) {
             return wpbdp_render_msg(_x('You are not authorized to edit this listing.', 'templates', 'WPBDM'), 'error');
         }
     }
     $callback = 'step_' . $this->state->step;
     if (method_exists($this, $callback)) {
         return call_user_func(array(&$this, $callback));
     } else {
         return 'STEP NOT IMPLEMENTED YET: ' . $this->state->get_step();
     }
 }
Example #29
0
 /**
  * Get field HTML
  *
  * @param $field
  * @param $meta
  *
  * @return string
  */
 static function html($meta, $field)
 {
     $options = $field['options'];
     $terms = get_terms($options['taxonomy'], $options['args']);
     $field['options'] = self::get_options($terms);
     $html = '';
     switch ($options['type']) {
         case 'checkbox_list':
             $html = RWMB_Checkbox_List_Field::html($meta, $field);
             break;
         case 'checkbox_tree':
             $elements = self::process_terms($terms);
             $html .= self::walk_checkbox_tree($meta, $field, $elements, $options['parent'], true);
             break;
         case 'select_tree':
             $elements = self::process_terms($terms);
             $html .= self::walk_select_tree($meta, $field, $elements, $options['parent'], true);
             break;
         case 'select_advanced':
             $html = RWMB_Select_Advanced_Field::html($meta, $field);
             break;
         case 'select':
         default:
             $html = RWMB_Select_Field::html($meta, $field);
     }
     return $html;
 }
 /**
  * Suggest
  *
  * Echo a JSON-ified array of posts of the given post-type and
  * the requested search-term and then die silently
  */
 public static function suggest()
 {
     $json = new MslsJson();
     if (filter_has_var(INPUT_POST, 'blog_id')) {
         switch_to_blog(filter_input(INPUT_POST, 'blog_id', FILTER_SANITIZE_NUMBER_INT));
         $args = array('orderby' => 'name', 'order' => 'ASC', 'number' => 10, 'hide_empty' => 0);
         if (filter_has_var(INPUT_POST, 's')) {
             $args['s'] = sanitize_text_field(filter_input(INPUT_POST, 's'));
         }
         /**
          * Overrides the query-args for the suggest fields
          * @since 0.9.9
          * @param array $args
          */
         $args = (array) apply_filters('msls_post_tag_suggest_args', $args);
         foreach (get_terms(sanitize_text_field(filter_input(INPUT_POST, 'post_type')), $args) as $term) {
             /**
              * Manipulates the term object before using it
              * @since 0.9.9
              * @param StdClass $term
              */
             $term = apply_filters('msls_post_tag_suggest_term', $term);
             if (is_object($term)) {
                 $json->add($term->term_id, $term->name);
             }
         }
         restore_current_blog();
     }
     wp_die($json->encode());
 }