Example #1
1
function noelie_product_categories()
{
    if (is_woocommerce_activated()) {
        global $woocommerce_loop;
        $woosave_loop = $woocommerce_loop;
        $woocommerce_loop['columns'] = 3;
        ob_start();
        $args = array('taxonomy' => 'product_cat', 'orderby' => 'name', 'show_count' => 0, 'pad_counts' => 0, 'hierarchical' => 1, 'title_li' => '', 'hide_empty' => 0);
        $all_categories = get_categories($args);
        $nbrr = count($all_categories);
        echo '<section class="storefront-product-section storefront-product-categories">';
        echo '<h2 class="section-title">' . __('Product Categories', 'storefront') . '</h2>';
        ?>
		<div class="woocommerce columns-<?php 
        echo $woocommerce_loop['columns'];
        ?>
">
 		<ul class="products">
<?php 
        $nbr = 1;
        foreach ($all_categories as $cat) {
            if ($cat->category_parent == 0 && $nb < $woocommerce_loop['columns']) {
                $category_id = $cat->term_id;
                wc_get_template('content-product_cat.php', array('category' => $cat));
                ++$nb;
                /*get_term_link($cat->slug, 'product_cat')*/
            }
        }
        ob_get_contents();
        $woocommerce_loop = $woosave_loop;
    }
}
 /**
  *
  * @return array;
  */
 public function getPicklistOptions()
 {
     $tax_args = array('public' => true, '_builtin' => false);
     $taxonomies = get_taxonomies($tax_args);
     $taxonomies[] = 'category';
     $args = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => $taxonomies, 'pad_counts' => true);
     $categories = get_categories($args);
     $children = array();
     if ($categories) {
         foreach ($categories as $v) {
             $v->title = $v->cat_name;
             $v->parent_id = $v->category_parent;
             $v->id = $v->cat_ID;
             $pt = $v->category_parent;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     //treecurse function from functions.php
     $list = treerecurse($children);
     $mitems = array();
     foreach ($list as $item) {
         $mitems[$item->id] = $item->treename;
     }
     return $mitems;
 }
 function widget($args, $instance)
 {
     extract($args);
     $warrior_category_list_title = apply_filters('widget_title', empty($instance['warrior_category_list_title']) ? esc_html__('Categories', 'newmagz') : $instance['warrior_category_list_title'], $instance, $this->id_base);
     echo $before_widget;
     echo '<div class="category-widget">';
     echo $before_title . esc_attr($warrior_category_list_title) . $after_title;
     echo '<div class="categories">';
     echo '<ul>';
     $taxonomy = 'category';
     $a = 1;
     $tax_terms = get_categories();
     foreach ($tax_terms as $tax_term) {
         echo '<li>';
         echo '<div class="number">' . $a++ . '</div>';
         echo '<div class="summary">';
         echo '<a href="' . esc_url(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf(esc_html__("View all posts in %s", "newmagz"), $tax_term->name) . '" ' . '>' . $tax_term->name . '<small>' . $tax_term->category_count . esc_html__(' Articles', 'newmagz') . '</small></a>';
         echo '</div>';
         echo '</li>';
     }
     echo '</ul>';
     echo '</div>';
     echo '</div>';
     echo $after_widget;
 }
Example #4
0
    function form($instance)
    {
        $defaults = array('pppage' => '10', 'filter' => 'all');
        $instance = wp_parse_args($instance, $defaults);
        extract($instance);
        $args = array('orderby' => 'name', 'hide_empty' => 0, 'hierarchical' => 1, 'taxonomy' => 'client-category');
        $filter_options = get_categories($args);
        ?>
	
	<p class="description">
		<label for="<?php 
        echo $this->get_field_id('pppage');
        ?>
">
			Posts Per Page
			<?php 
        echo aq_field_input('pppage', $block_id, $pppage, $size = 'full', $type = 'number');
        ?>
		</label>
	</p>
	
	<p class="description">
		<label for="<?php 
        echo $this->get_field_id('filter');
        ?>
">
			Show Clients from a specific category?<br />
			<?php 
        echo ebor_portfolio_field_select('filter', $block_id, $filter_options, $filter);
        ?>
		</label>
	</p>
		
	<?php 
    }
 function render($atts, $content = null)
 {
     parent::render($atts);
     $buffy = '';
     extract(shortcode_atts(array('limit' => '6', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'header_color' => ''), $atts));
     $cat_args = array('show_count' => true, 'orderby' => 'count', 'hide_empty' => false, 'order' => 'DESC', 'number' => $limit + 1, 'exclude' => get_cat_ID(TD_FEATURED_CAT));
     // exclude categories from the demo
     if (TD_DEPLOY_MODE == 'demo' or TD_DEPLOY_MODE == 'dev') {
         $cat_args['exclude'] = '44,45,46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 110, ' . get_cat_ID(TD_FEATURED_CAT);
     }
     $categories = get_categories($cat_args);
     $buffy .= '<div class="td_block_wrap td_popular_categories widget widget_categories">';
     $buffy .= $this->get_block_title();
     if (!empty($categories)) {
         $buffy .= '<ul class="td-pb-padding-side">';
         foreach ($categories as $category) {
             if (strtolower($category->cat_name) != 'uncategorized') {
                 $buffy .= '<li><a href="' . get_category_link($category->cat_ID) . '">' . $category->name . '<span class="td-cat-no">' . $category->count . '</span></a></li>';
             }
         }
         $buffy .= '</ul>';
     }
     $buffy .= '</div> <!-- ./block -->';
     return $buffy;
 }
Example #6
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);
    }
}
/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the "id" fields, make sure to use all lowercase and no spaces.
 *  
 */
function optionsframework_options()
{
    $themename = 'wp_get_theme' ? wp_get_theme() : wp_get_theme();
    $themename = $themename['Name'];
    $shortname = "of";
    //Stylesheet Reader
    $alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow");
    // Test data
    $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
    // Multicheck Array
    $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
    // Multicheck Defaults
    $multicheck_defaults = array("one" => "1", "five" => "1");
    // Background Defaults
    $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
    // Pull all the categories into an array
    $options_categories = array();
    $options_categories_obj = get_categories();
    foreach ($options_categories_obj as $category) {
        $options_categories[$category->cat_ID] = $category->cat_name;
    }
    // Pull all the pages into an array
    $options_pages = array();
    $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
    $options_pages[''] = 'Select a page:';
    foreach ($options_pages_obj as $page) {
        $options_pages[$page->ID] = $page->post_title;
    }
    // If using image radio buttons, define a directory path
    $imagepath = get_stylesheet_directory_uri() . '/images/';
    $options = array(array("name" => __("General Settings", "wrockmetro"), "type" => "heading"), array("name" => __("Custom Favicon URL", "wrockmetro"), "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "wrockmetro_favicon", "type" => "upload"), array("name" => __("Latest Posts", "wrockmetro"), "desc" => "Show 5 Latest Posts with Thumbnail in Sidebar.", "id" => "wrockmetro_activate_ltposts", "std" => "1", "type" => "checkbox"), array("name" => __("Show Author Profile", "wrockmetro"), "desc" => "Check the box to show Author Profile Below the Post.", "id" => "wrockmetro_author", "std" => "", "type" => "checkbox"), array("name" => __("Ads Management", "wrockmetro"), "type" => "heading"), array("name" => "Activate Ads Space Below Navigation", "desc" => "Activate Ads Space Below Navigation and put code in below test field.", "id" => "wrockmetro_banner", "std" => "", "type" => "checkbox"), array("name" => __("Ads code Below Main Navigation.", "wrockmetro"), "desc" => "Enter your ads code here, preferably a 728*15 link list unit, or a 728*90 lead-board ad.", "id" => "wrockmetro_banner_top", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Single Post", "wrockmetro"), "desc" => "Path of the image to be displayed in sidebar section.", "id" => "wrockmetro_ad2", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Footer", "wrockmetro"), "desc" => "Paste Ad Code for Footer Area below navigation.", "id" => "wrockmetro_ad1", "std" => "", "type" => "textarea"), $options[] = array("name" => __("Custom CSS", "wrockmetro"), "type" => "heading"), array("name" => __("Custom CSS", "wrockmetro"), "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "wrockmetro_customcss", "std" => "", "type" => "textarea"), array("name" => __("Social Media", "wrockmetro"), "type" => "heading"), array("name" => __("Show Social Follow ICONs", "wrockmetro"), "desc" => "Check the box to show social sites Follows buttons in Sidebar.", "id" => "wrockmetro_sharebut", "std" => "", "type" => "checkbox"), array("name" => __("Facebook URL", "wrockmetro"), "desc" => "Enter your Facebook URL if you have one", "id" => "wrockmetro_fb", "std" => "", "type" => "text"), array("name" => __("Twitter URL", "wrockmetro"), "desc" => "Enter your Twitter URL if you have one", "id" => "wrockmetro_tw", "std" => "", "type" => "text"), array("name" => __("RSS Feed URL", "wrockmetro"), "desc" => "Enter your RSS Feed URL if you have one", "id" => "wrockmetro_rss", "std" => "", "type" => "text"), array("name" => __("Google+ URL", "wrockmetro"), "desc" => "Enter your Google+ Link if you have one", "id" => "wrockmetro_gp", "std" => "", "type" => "text"), array("name" => __("Linked In URL", "wrockmetro"), "desc" => "Enter your Linkedin URL if you have one", "id" => "wrockmetro_in", "std" => "", "type" => "text"), array("name" => __("YouTube In URL", "wrockmetro"), "desc" => "Enter your YouTube URL if you have one", "id" => "wrockmetro_youtube", "std" => "", "type" => "text"), array("name" => __("Pinterest In URL", "wrockmetro"), "desc" => "Enter your Pinterest URL if you have one", "id" => "wrockmetro_pinterest", "std" => "", "type" => "text"), array("name" => __("Stumbleupon In URL", "wrockmetro"), "desc" => "Enter your Stumbleupon URL if you have one", "id" => "wrockmetro_stumbleupon", "std" => "", "type" => "text"), array("name" => __("Instagram In URL", "wrockmetro"), "desc" => "Enter your Instagram URL if you have one", "id" => "wrockmetro_instagram", "std" => "", "type" => "text"), array("name" => __("email In URL", "wrockmetro"), "desc" => "Enter your email URL if you have one", "id" => "wrockmetro_email", "std" => "", "type" => "text"));
    update_option('of_themename', $themename);
    return $options;
}
/**
 * Remove the 'category' base from category URIs.
 */
function smittenkitchen_filter_category_rewrite_rules($rules)
{
    $categories = get_categories(array('hide_empty' => false));
    if (is_array($categories) && !empty($categories)) {
        $slugs = array();
        foreach ($categories as $category) {
            if (is_object($category) && !is_wp_error($category)) {
                if (0 == $category->category_parent) {
                    $slugs[] = $category->slug;
                } else {
                    $slugs[] = trim(get_category_parents($category->term_id, false, '/', true), '/');
                }
            }
        }
        if (!empty($slugs)) {
            $rules = array();
            foreach ($slugs as $slug) {
                $rules['(' . $slug . ')/feed/(feed|rdf|rss|rss2|atom)?/?$'] = 'index.php?category_name=$matches[1]&amp;feed=$matches[2]';
                $rules['(' . $slug . ')/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&amp;feed=$matches[2]';
                $rules['(' . $slug . ')(/page/(\\d+))?/?$'] = 'index.php?category_name=$matches[1]&amp;paged=$matches[3]';
            }
        }
    }
    return $rules;
}
Example #9
0
function tst_get_user_skills($member_id)
{
    global $ITV_USER_SKILLS_EXCLUDE_CATEGORIES;
    $user_skills = get_user_meta($member_id, 'user_skills', true);
    if (!is_array($user_skills)) {
        $user_skills = $user_skills ? array($user_skills) : array();
    }
    $categories = get_categories(array('taxonomy' => 'category', 'hide_empty' => 0));
    $categories_filtered = array();
    $parent_categories = array();
    foreach ($categories as $category) {
        if (array_search($category->slug, $ITV_USER_SKILLS_EXCLUDE_CATEGORIES) === false) {
            $category_hash = (array) $category;
            $category_hash['checked'] = array_search($category->term_id, $user_skills) === false ? false : true;
            if ($category->parent) {
                $parent_categories[$category->parent] = 1;
            }
            $categories_filtered[] = $category_hash;
        }
    }
    $categories = array();
    foreach ($categories_filtered as $category) {
        if (!isset($parent_categories[$category['term_id']])) {
            $categories[] = $category;
        }
    }
    usort($categories, function ($a, $b) {
        return $a['parent'] > $b['parent'] ? -1 : 1;
    });
    return $categories;
}
 /**
  * get all tags
  *
  * @return array
  */
 public static function getTags()
 {
     $taxonomy = 'post_tag';
     $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 0, 'taxonomy' => $taxonomy);
     $tags = get_categories($args);
     return $tags;
 }
Example #11
0
function venedor_page_get_postdata()
{
    global $page_meta_boxes, $wp_registered_sidebars;
    // Page Meta Options
    $theme_layouts = venedor_ct_layouts();
    $theme_layouts = array_merge(array("widewidth" => "Wide Width"), $theme_layouts);
    $sidebar_options = venedor_ct_sidebars();
    $banner_type = venedor_ct_banner_type();
    $banner_width = venedor_ct_banner_width();
    $layer_sliders = venedor_ct_layer_sliders();
    $rev_sliders = venedor_ct_rev_sliders();
    $portfolio_columns = array("2" => "2 Columns", "3" => "3 Columns", "4" => "4 Columns");
    $portfolio_cats = array();
    $portfolio_cats[0] = 'All Categories';
    $pcats = get_categories(array('taxonomy' => 'portfolio_cat'));
    foreach ($pcats as $pcat) {
        $portfolio_cats[$pcat->term_id] = $pcat->name;
    }
    $faq_cats = array();
    $faq_cats[0] = 'All Categories';
    $fcats = get_categories(array('taxonomy' => 'faq_cat'));
    foreach ($fcats as $fcat) {
        $faq_cats[$fcat->term_id] = $fcat->name;
    }
    // Page Meta Boxes
    $page_meta_boxes = array("breadcrumbs" => venedor_labels_meta("breadcrumbs", "Breadcrumbs", "Disable breadcrumbs", "checkbox"), "title" => venedor_labels_meta("title", "Page Title", "Hide page title", "checkbox"), "layout" => venedor_labels_meta("layout", "Layout", "Select the layout.", "radio", "fullwidth", "radio", $theme_layouts), "sidebar" => venedor_labels_meta("sidebar", "Sidebar", "Select the sidebar you would like to display. <strong>Note</strong>: You must first create the sidebar under <strong>Appearance > Sidebars</strong>.", "customselect", "blog-sidebar", "", $sidebar_options), "header_on_banner" => venedor_labels_meta("header_on_banner", "Header on Banner", "Show header on banner. When select <strong>\"Banner Type\"</strong> to <strong>\"Layerslider\"</strong>, <strong>\"Revolution Slider\"</strong> or <strong>\"Banner\"</strong>, this option will be work.", "checkbox"), "bg_rev_slider" => venedor_labels_meta("bg_rev_slider", "Background Slider", "Select the Background Revolution Slider. If you should select <strong>\"Banner Type\"</strong> to <strong>\"Revolution Slider\"</strong>, this will be <strong>synchronize</strong> with <strong>banner revolution slider</strong>.", "customselect", "", "", $rev_sliders), "banner_type" => venedor_labels_meta("banner_type", "Banner Type", "Select the banner type which display above the page content.", "customselect", "", "", $banner_type), "banner_width" => venedor_labels_meta("banner_width", "Banner Width", "Select the banner width", "radio", "wide", "radio", $banner_width), "layer_slider" => venedor_labels_meta("layer_slider", "LayerSlider", "Select the LayerSlider.", "customselect", "", "", $layer_sliders), "rev_slider" => venedor_labels_meta("rev_slider", "Revolution Slider", "Select the Revolution Slider.", "customselect", "", "", $rev_sliders), "banner" => venedor_labels_meta("banner", "Banner", "", "textarea"), "product_slider" => venedor_labels_meta("product_slider", "Product Slider", "Comma separated list of product id.", "text"), "infinite_scroll" => venedor_labels_meta("infinite_scroll", "Infinite Scroll", "Enable infinite scroll. Use in <strong>Portfolio</strong> templates.", "checkbox"), "portfolio_columns" => venedor_labels_meta("portfolio_columns", "Portfolio Columns", "The number of the columns in the portfolio page. Use in <strong>Portfolio</strong> template.", "radio", "4", "radio", $portfolio_columns), "portfolio_cat" => venedor_labels_meta("portfolio_cat", "Portfolio Category", "Select the portfolio categories. Use in <strong>Portfolio</strong> template.", "multi_checkbox", "", "", $portfolio_cats), "portfolio_filters" => venedor_labels_meta("portfolio_filters", "Portfolio Filters", "Show the portfolio filters. Use in <strong>Portfolio</strong> template.", "checkbox"), "faq_cat" => venedor_labels_meta("faq_cat", "FAQ Category", "Select the faq categories. Use in <strong>FAQs</strong> template.", "multi_checkbox", "", "", $faq_cats), "faq_filters" => venedor_labels_meta("faq_filters", "FAQ Filters", "Show the faq filters. Use in <strong>FAQs</strong> template.", "checkbox"), "content_top" => venedor_labels_meta("content_top", "Content Top", "Input the content top block.", "text"), "content_bottom" => venedor_labels_meta("content_bottom", "Content Bottom", "Input the content bottom block.", "text"));
}
 function get_filterby_terms()
 {
     $filtertype = $_POST['filtertype'];
     $terms = array();
     switch ($filtertype) {
         case 'category':
             $cats = get_categories();
             foreach ($cats as $cat) {
                 $terms[$cat->term_id] = $cat->name;
             }
             break;
         case 'tag':
             $tags = get_tags();
             foreach ($tags as $tag) {
                 $terms[$tag->slug] = $tag->name;
             }
             break;
         case 'post_type':
             $terms = $this->project_organizer->available_post_types();
             break;
     }
     $terms = apply_filters('anth_get_posts_by', $terms, $filtertype);
     print json_encode($terms);
     die;
 }
Example #13
0
/**
 * Display a list categories
 * @param array $args
 * @return bool
 */
function zfwca_list_categories($args = array())
{
    $defaults = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'exclude' => '', 'include' => '', 'exclude_tree' => '', 'current_category' => 0, 'taxonomy' => 'category');
    $r = wp_parse_args($args, $defaults);
    $r['walker'] = new ZFWCA_Post_Category_Walker();
    if (!isset($r['class'])) {
        $r['class'] = 'category' == $r['taxonomy'] ? 'categories' : $r['taxonomy'];
    }
    extract($r);
    if (!taxonomy_exists($taxonomy)) {
        return false;
    }
    $categories = get_categories($r);
    $output = '';
    if (empty($categories)) {
        $output .= 'No categories';
    } else {
        if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
            $current_term_object = get_queried_object();
            if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
                $r['current_category'] = get_queried_object_id();
            }
        }
        $output .= walk_category_tree($categories, 0, $r);
    }
    $output = apply_filters('zfwca_wp_list_categories', $output, $args);
    return $output;
}
function no_category_base_rewrite_rules($category_rewrite)
{
    //var_dump($category_rewrite); // For Debugging
    $category_rewrite = array();
    $categories = get_categories(array('hide_empty' => false));
    foreach ($categories as $category) {
        $category_nicename = $category->slug;
        if ($category->parent == $category->cat_ID) {
            // recursive recursion
            $category->parent = 0;
        } elseif ($category->parent != 0) {
            $category_nicename = get_category_parents($category->parent, false, '/', true) . $category_nicename;
        }
        $category_rewrite['(' . $category_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
        $category_rewrite['(' . $category_nicename . ')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
        $category_rewrite['(' . $category_nicename . ')/?$'] = 'index.php?category_name=$matches[1]';
    }
    // Redirect support from Old Category Base
    global $wp_rewrite;
    $old_category_base = get_option('category_base') ? get_option('category_base') : 'category';
    $old_category_base = trim($old_category_base, '/');
    $category_rewrite[$old_category_base . '/(.*)$'] = 'index.php?category_redirect=$matches[1]';
    //var_dump($category_rewrite); // For Debugging
    return $category_rewrite;
}
/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the "id" fields, make sure to use all lowercase and no spaces.
 *  
 */
function optionsframework_options()
{
    // Test data
    $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
    // Multicheck Array
    $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
    // Multicheck Defaults
    $multicheck_defaults = array("one" => "1", "five" => "1");
    // Background Defaults
    $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
    // Pull all the categories into an array
    $options_categories = array();
    $options_categories_obj = get_categories();
    foreach ($options_categories_obj as $category) {
        $options_categories[$category->cat_ID] = $category->cat_name;
    }
    // Pull all the pages into an array
    $options_pages = array();
    $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
    $options_pages[''] = 'Select a page:';
    foreach ($options_pages_obj as $page) {
        $options_pages[$page->ID] = $page->post_title;
    }
    // If using image radio buttons, define a directory path
    $imagepath = get_bloginfo('stylesheet_directory') . '/admin/images/';
    $options_menu_page = array('name' => 'general', 'pagename' => 'general-options', 'title' => 'General Settings');
    $options = array();
    $options = array(array("name" => "Basic Settings", "type" => "heading"), array("name" => "Input Text Mini", "desc" => "A mini text input field.", "id" => "example_text_mini", "std" => "Default", "class" => "mini", "type" => "text"), array("name" => "Input Text", "desc" => "A text input field.", "id" => "example_text", "std" => "Default Value", "type" => "text"), array("name" => "Textarea", "desc" => "Textarea description.", "id" => "example_textarea", "std" => "Default Text", "type" => "textarea"), array("name" => "Input Select Small", "desc" => "Small Select Box.", "id" => "example_select", "std" => "three", "type" => "select", "class" => "mini", "options" => $test_array), array("name" => "Input Select Wide", "desc" => "A wider select box.", "id" => "example_select_wide", "std" => "two", "type" => "select", "options" => $test_array), array("name" => "Select a Category", "desc" => "Passed an array of categories with cat_ID and cat_name", "id" => "example_select_categories", "type" => "select", "options" => $options_categories), array("name" => "Select a Page", "desc" => "Passed an pages with ID and post_title", "id" => "example_select_pages", "type" => "select", "options" => $options_pages), array("name" => "Input Radio (one)", "desc" => "Radio select with default options 'one'.", "id" => "example_radio", "std" => "one", "type" => "radio", "options" => $test_array), array("name" => "Example Info", "desc" => "This is just some example information you can put in the panel.", "type" => "info"), array("name" => "Input Checkbox", "desc" => "Example checkbox, defaults to true.", "id" => "example_checkbox", "std" => "1", "type" => "checkbox"), array("name" => "Advanced Settings", "type" => "heading"), array("name" => "Check to Show a Hidden Text Input", "desc" => "Click here and see what happens.", "id" => "example_showhidden", "type" => "checkbox"), array("name" => "Hidden Text Input", "desc" => "This option is hidden unless activated by a checkbox click.", "id" => "example_text_hidden", "std" => "Hello", "class" => "hidden", "type" => "text"), array("name" => "Uploader Test", "desc" => "This creates a full size uploader that previews the image.", "id" => "example_uploader", "type" => "upload"), array("name" => "Example Image Selector", "desc" => "Images for layout.", "id" => "example_images", "std" => "2c-l-fixed", "type" => "images", "options" => array('1col-fixed' => $imagepath . '1col.png', '2c-l-fixed' => $imagepath . '2cl.png', '2c-r-fixed' => $imagepath . '2cr.png')), array("name" => "Example Background", "desc" => "Change the background CSS.", "id" => "example_background", "std" => $background_defaults, "type" => "background"), array("name" => "Multicheck", "desc" => "Multicheck description.", "id" => "example_multicheck", "std" => $multicheck_defaults, "type" => "multicheck", "options" => $multicheck_array), array("name" => "Colorpicker", "desc" => "No color selected by default.", "id" => "example_colorpicker", "std" => "", "type" => "color"), array("name" => "Typography", "desc" => "Example typography.", "id" => "example_typography", "std" => array('size' => '12px', 'face' => 'verdana', 'style' => 'bold italic', 'color' => '#123456'), "type" => "typography"));
    return $options;
}
Example #16
0
    function widget($args, $instance)
    {
        ?>
        <div class="category_widget">
            <div class="title">
                <h4><?php 
        _e('Category', 'sunnypoint');
        ?>
</h4>
            </div>
            <div class="list">
                <?php 
        $all_cats = get_categories();
        foreach ($all_cats as $cat) {
            ?>
                    <div class="category">
                        <div class="number"><span><?php 
            print $cat->count;
            ?>
</span></div>
                        <div class="name"><a href="<?php 
            print get_category_link($cat->cat_ID);
            ?>
 "><p><?php 
            print $cat->name;
            ?>
</p></a></div>
                    </div>
                <?php 
        }
        ?>
            </div>
        </div>
    <?php 
    }
function road_popular_categories_shortcode($atts)
{
    $atts = shortcode_atts(array('category' => '', 'image' => ''), $atts, 'popular_categories');
    $html = '';
    $html .= '<div class="category-wrapper">';
    $pcategory = get_term_by('slug', $atts['category'], 'product_cat', 'ARRAY_A');
    if ($pcategory) {
        $html .= '<div class="category-list">';
        $html .= '<h3><a href="' . get_term_link($pcategory['slug'], 'product_cat') . '">' . $pcategory['name'] . '</a></h3>';
        $html .= '<ul>';
        $args2 = array('taxonomy' => 'product_cat', 'child_of' => 0, 'parent' => $pcategory['term_id'], 'orderby' => 'name', 'show_count' => 0, 'pad_counts' => 0, 'hierarchical' => 0, 'title_li' => '', 'hide_empty' => 0);
        $sub_cats = get_categories($args2);
        if ($sub_cats) {
            foreach ($sub_cats as $sub_category) {
                $html .= '<li><a href="' . get_term_link($sub_category->slug, 'product_cat') . '">' . $sub_category->name . '</a></li>';
            }
        }
        $html .= '</ul>';
        $html .= '</div>';
        if ($atts['image'] != '') {
            $html .= '<div class="cat-img">';
            $html .= '<a href="' . get_term_link($pcategory['slug'], 'product_cat') . '"><img class="category-image" src="' . esc_attr($atts['image']) . '" alt="" /></a>';
            $html .= '</div>';
        }
    }
    $html .= '</div>';
    return $html;
}
function dwqa_posttype_init()
{
    global $dwqa_options;
    extract(dwqa_get_rewrite_slugs());
    /* Question Posttype Registration */
    $question_labels = array('name' => __('Question', 'dwqa'), 'singular_name' => __('Question', 'dwqa'), 'add_new' => __('Add New', 'theme'), 'add_new_item' => __('Add New Question', 'dwqa'), 'edit_item' => __('Edit Question'), 'new_item' => __('New Question', 'dwqa'), 'all_items' => __('All Questions', 'dwqa'), 'view_item' => __('View Question', 'dwqa'), 'search_items' => __('Search Question', 'dwqa'), 'not_found' => __('No questions found', 'dwqa'), 'not_found_in_trash' => __('No questions found in Trash', 'dwqa'), 'parent_item_colon' => '', 'menu_name' => __('DW Q&A', 'dwqa'));
    $question_args = array('labels' => $question_labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => $question_rewrite, 'with_front' => false), 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => '', 'supports' => array('title', 'editor', 'comments', 'author', 'page-attributes'));
    register_post_type('dwqa-question', $question_args);
    /* Question Posttype Registration */
    $answer_labels = array('name' => __('Answer', 'dwqa'), 'singular_name' => __('Answer', 'dwqa'), 'add_new' => __('Add New', 'dwqa'), 'add_new_item' => __('Add new answer', 'dwqa'), 'edit_item' => __('Edit answer', 'dwqa'), 'new_item' => __('New Answer', 'dwqa'), 'all_items' => __('All Answers', 'dwqa'), 'view_item' => __('View Answer', 'dwqa'), 'search_items' => __('Search Answer', 'dwqa'), 'not_found' => __('No Answers found', 'dwqa'), 'not_found_in_trash' => __('No Answers found in Trash', 'dwqa'), 'parent_item_colon' => '', 'menu_name' => __('Answer', 'dwqa'));
    $answer = array('labels' => $answer_labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=dwqa-question', 'query_var' => true, 'rewrite' => true, 'has_archive' => false, 'hierarchical' => true, 'menu_icon' => '', 'supports' => array('title', 'editor', 'comments', 'custom-fields', 'author', 'page-attributes'));
    register_post_type('dwqa-answer', $answer);
    // Question Taxonomies ( Tag, Category register for Question Posttype)
    // Question Categories
    $question_category_labels = array('name' => _x('Categories', 'taxonomy general name'), 'singular_name' => _x('Category', 'taxonomy singular name'), 'search_items' => __('Search Categories', 'dwqa'), 'all_items' => __('All Categories', 'dwqa'), 'parent_item' => __('Parent Category', 'dwqa'), 'parent_item_colon' => __('Parent Category:', 'dwqa'), 'edit_item' => __('Edit Category', 'dwqa'), 'update_item' => __('Update Category', 'dwqa'), 'add_new_item' => __('Add New Category', 'dwqa'), 'new_item_name' => __('New Category Name', 'dwqa'), 'menu_name' => __('Question Categories', 'dwqa'));
    register_taxonomy('dwqa-question_category', array('dwqa-question'), array('hierarchical' => true, 'labels' => $question_category_labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => $question_category_rewrite, 'with_front' => false)));
    // Question Tags
    $question_tag_labels = array('name' => _x('Tags', 'taxonomy general name'), 'singular_name' => _x('Tag', 'taxonomy singular name'), 'search_items' => __('Search Tags', 'dwqa'), 'popular_items' => __('Popular Tags', 'dwqa'), 'all_items' => __('All Tags', 'dwqa'), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __('Edit Tag', 'dwqa'), 'update_item' => __('Update Tag', 'dwqa'), 'add_new_item' => __('Add New Tag', 'dwqa'), 'new_item_name' => __('New Tag Name', 'dwqa'), 'separate_items_with_commas' => __('Separate tags with commas', 'dwqa'), 'add_or_remove_items' => __('Add or remove tags', 'dwqa'), 'choose_from_most_used' => __('Choose from the most used tags', 'dwqa'), 'menu_name' => __('Question Tags', 'dwqa'));
    register_taxonomy('dwqa-question_tag', array('dwqa-question'), array('hierarchical' => false, 'labels' => $question_tag_labels, 'show_ui' => true, 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array('slug' => $question_tag_rewrite, 'with_front' => false)));
    // Create default category for dwqa question type when dwqa plugin is actived
    $cats = get_categories(array('type' => 'dwqa-question', 'hide_empty' => 0, 'taxonomy' => 'dwqa-question_category'));
    if (empty($cats)) {
        wp_insert_term('Questions', 'dwqa-question_category');
    }
    // update term rewrite rule
    dwqa_update_term_rewrite_rules();
}
 public static function get_terms($taxonomy, $hide_empty = true, $get_childs = true, $selected = 0, $category_parent = 0)
 {
     static $collector = array();
     if (isset($collector[$taxonomy])) {
         return $collector[$taxonomy];
     }
     $args = array('orderby' => 'name', 'order' => 'ASC', 'style' => 'list', 'show_count' => 0, 'hide_empty' => $hide_empty, 'use_desc_for_title' => 1, 'child_of' => 0, 'hierarchical' => true, 'title_li' => '', 'show_option_none' => '', 'number' => '', 'echo' => 0, 'depth' => 0, 'current_category' => $selected, 'pad_counts' => 0, 'taxonomy' => $taxonomy, 'walker' => 'Walker_Category');
     //WPML compatibility
     if (class_exists('SitePress')) {
         $args['lang'] = ICL_LANGUAGE_CODE;
     }
     $cats_objects = get_categories($args);
     $cats = array();
     if (!empty($cats_objects)) {
         foreach ($cats_objects as $value) {
             if (is_object($value) and $value->category_parent == $category_parent) {
                 $cats[$value->term_id] = array();
                 $cats[$value->term_id]['term_id'] = $value->term_id;
                 $cats[$value->term_id]['slug'] = $value->slug;
                 $cats[$value->term_id]['taxonomy'] = $value->taxonomy;
                 $cats[$value->term_id]['name'] = $value->name;
                 $cats[$value->term_id]['count'] = $value->count;
                 $cats[$value->term_id]['parent'] = $value->parent;
                 if ($get_childs) {
                     $cats[$value->term_id]['childs'] = self::assemble_terms_childs($cats_objects, $value->term_id);
                 }
             }
         }
     }
     $collector[$taxonomy] = $cats;
     return $cats;
 }
Example #20
0
function remove_category_url_rewrite_rules($category_rewrite)
{
    $category_rewrite = array();
    if (class_exists('Sitepress')) {
        global $sitepress;
        remove_filter('terms_clauses', array($sitepress, 'terms_clauses'));
        $categories = get_categories(array('hide_empty' => false));
        add_filter('terms_clauses', array($sitepress, 'terms_clauses'));
    } else {
        $categories = get_categories(array('hide_empty' => false));
    }
    foreach ($categories as $category) {
        $category_nicename = $category->slug;
        if ($category->parent == $category->cat_ID) {
            $category->parent = 0;
        } elseif ($category->parent != 0) {
            $category_nicename = get_category_parents($category->parent, false, '/', true) . $category_nicename;
        }
        $category_rewrite['(' . $category_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
        $category_rewrite['(' . $category_nicename . ')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
        $category_rewrite['(' . $category_nicename . ')/?$'] = 'index.php?category_name=$matches[1]';
    }
    global $wp_rewrite;
    $old_category_base = get_option('category_base') ? get_option('category_base') : 'category';
    $old_category_base = trim($old_category_base, '/');
    $category_rewrite[$old_category_base . '/(.*)$'] = 'index.php?category_redirect=$matches[1]';
    return $category_rewrite;
}
 function get_event_cats()
 {
     if (class_exists('Tribe__Events__Main')) {
         $taxonomy = 'tribe_events_cat';
         $orderby = 'name';
         $show_count = 0;
         // 1 for yes, 0 for no
         $pad_counts = 0;
         // 1 for yes, 0 for no
         $hierarchical = 1;
         // 1 for yes, 0 for no
         $title = '';
         $empty = 0;
         $args = array('taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'hide_empty' => $empty);
         $categories_list = array();
         $all_categories = get_categories($args);
         if (is_wp_error($all_categories) || isset($all_categories['errors'])) {
             return $categories_list;
         }
         foreach ($all_categories as $category) {
             $data = array($category->slug => $category->name . " (" . $category->category_count . ")");
             $categories_list += $data;
         }
         return $categories_list;
     } else {
         return array();
     }
 }
Example #22
0
 function render($atts)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     extract(shortcode_atts(array('limit' => '6', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'header_color' => ''), $atts));
     $cat_args = array('show_count' => true, 'orderby' => 'count', 'hide_empty' => false, 'order' => 'DESC', 'number' => $limit, 'exclude' => get_cat_ID(TD_FEATURED_CAT));
     if (TD_DEPLOY_MODE == 'demo' or TD_DEPLOY_MODE == 'dev') {
         $cat_args['exclude'] = '251, 252, 253, 254, 255, 256, 257, 258, 305, 306, ' . get_cat_ID(TD_FEATURED_CAT);
     }
     $categories = get_categories($cat_args);
     $buffy = '';
     $buffy .= '<div class="td_block_wrap td_popular_categories widget widget_categories">';
     $buffy .= $this->get_block_title_raw($atts, 'Popular category');
     if (!empty($categories)) {
         $buffy .= '<ul>';
         foreach ($categories as $category) {
             if (strtolower($category->cat_name) != 'uncategorized') {
                 $buffy .= '<li><a href="' . get_category_link($category->cat_ID) . '">' . $category->name . '<span class="td-cat-no">' . $category->count . '</span></a></li>';
             }
         }
         $buffy .= '</ul>';
     }
     $buffy .= '</div> <!-- ./block -->';
     return $buffy;
 }
Example #23
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        $a = array("orderby" => "id", "order" => "asc");
        $categories = get_categories($a);
        foreach ($categories as $category) {
            echo $before_title;
            // var_dump($category);
            echo "<h2>" . $category->name . "</h2><ul>";
            global $post;
            $args = array('category' => $category->term_id, "numberposts" => -1, "orderby" => "title", "order" => "ASC");
            $myposts = get_posts($args);
            foreach ($myposts as $post) {
                setup_postdata($post);
                ?>
<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></li><?php 
            }
            echo "</ul>";
            wp_reset_query();
            echo $after_title;
        }
        echo $after_widget;
    }
/**
* This function generates the list of courses for <select> control
* using the specified string filter and/or course id's filter
*
* @param string $strfilter The course name filter
* @param array $arrayfilter Course ID's filter, NULL by default, which means not to use id filter
* @return string
*/
function gen_course_list($strfilter = '', $arrayfilter = NULL)
{
    $courselist = array();
    $catcnt = 0;
    // get the list of course categories
    $categories = get_categories();
    foreach ($categories as $cat) {
        // for each category, add the <optgroup> to the string array first
        $courselist[$catcnt] = '<optgroup label="' . htmlspecialchars($cat->name) . '">';
        // get the course list in that category
        $courses = get_courses($cat->id, 'c.sortorder ASC', 'c.fullname, c.id');
        $coursecnt = 0;
        // for each course, check the specified filter
        foreach ($courses as $course) {
            if (!empty($strfilter) && strripos($course->fullname, $strfilter) === false || $arrayfilter !== NULL && in_array($course->id, $arrayfilter) === false) {
                continue;
            }
            // if we pass the filter, add the option to the current string
            $courselist[$catcnt] .= '<option value="' . $course->id . '">' . $course->fullname . '</option>';
            $coursecnt++;
        }
        // if no courses pass the filter in that category, delete the current string
        if ($coursecnt == 0) {
            unset($courselist[$catcnt]);
        } else {
            $courselist[$catcnt] .= '</optgroup>';
            $catcnt++;
        }
    }
    // return the html code with categorized courses
    return implode(' ', $courselist);
}
 public function categories($params)
 {
     $offset = $params['offset'];
     $limit = $params['limit'];
     $results = array();
     if ($offset == 0) {
         //add fictive category all
         $blog_name = get_bloginfo('name');
         $limit = $limit - 1;
         $results[] = array('category_id' => -1, 'name' => $blog_name, 'allowed' => true);
     } else {
         //compensate offset for fictive category all
         $offset -= 1;
     }
     $category_args = array('number' => $offset + $limit + 1);
     $categories = get_categories();
     //because there is no offset in get_categories();
     $categories = array_slice($categories, $offset, $limit + 1);
     foreach ($categories as $category) {
         $remaped_category = $this->array_remap_keys($category, array('cat_ID' => 'category_id', 'name' => 'name'));
         $remaped_category['allowed'] = true;
         $results[] = $remaped_category;
     }
     return $this->add_paging_info($results, $params);
 }
Example #26
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function adustus_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->add_section('adustus_primary', array('title' => __('Adustus Basic Settings'), 'description' => __('Here is where you will be able to make simple changes to your site.'), 'priority' => 160));
    $wp_customize->add_setting('adustus_excerpt', array('type' => 'theme_mod', 'default' => '55'));
    $wp_customize->add_control('adustus_excerpt', array('label' => __('Excerpt Length'), 'section' => 'adustus_primary', 'settings' => 'adustus_excerpt', 'type' => 'text'));
    $wp_customize->add_setting('adustus_bg_color', array('type' => 'theme_mod', 'default' => '#eeeeee'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'adustus_bg_color', array('label' => __('Background Color'), 'section' => 'adustus_primary', 'settings' => 'adustus_bg_color')));
    $wp_customize->add_section('adustus_content', array('title' => __('Adustus Content Settings'), 'description' => __('Here is where you will be able to change the categories of specific homepage sections'), 'priority' => 170));
    $categories = get_categories();
    $cats = array();
    $i = 0;
    foreach ($categories as $category) {
        if ($i == 0) {
            $default = $category->slug;
            $i++;
        }
        $cats[$category->slug] = $category->name;
    }
    $wp_customize->add_setting('adustus_featured_category1', array('type' => 'theme_mod', 'default' => $default));
    $wp_customize->add_control('adustus_featured_category1', array('label' => __('Select Category'), 'type' => 'select', 'choices' => $cats, 'section' => 'adustus_content', 'settings' => 'adustus_featured_category1'));
    $wp_customize->add_setting('adustus_featured_category2', array('type' => 'theme_mod', 'default' => $default));
    $wp_customize->add_control('adustus_featured_category2', array('label' => __('Select Category'), 'type' => 'select', 'choices' => $cats, 'section' => 'adustus_content', 'settings' => 'adustus_featured_category2'));
}
/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the "id" fields, make sure to use all lowercase and no spaces.
 *  
 */
function optionsframework_options()
{
    $themename = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme();
    $themename = $themename['Name'];
    $shortname = "of";
    //Stylesheet Reader
    $alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow");
    // Test data
    $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
    // Multicheck Array
    $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
    // Multicheck Defaults
    $multicheck_defaults = array("one" => "1", "five" => "1");
    // Background Defaults
    $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
    // Pull all the categories into an array
    $options_categories = array();
    $options_categories_obj = get_categories();
    foreach ($options_categories_obj as $category) {
        $options_categories[$category->cat_ID] = $category->cat_name;
    }
    // Pull all the pages into an array
    $options_pages = array();
    $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
    $options_pages[''] = 'Select a page:';
    foreach ($options_pages_obj as $page) {
        $options_pages[$page->ID] = $page->post_title;
    }
    // If using image radio buttons, define a directory path
    $imagepath = get_stylesheet_directory_uri() . '/images/';
    $options = array(array("name" => "General Settings", "type" => "heading"), array("name" => "Custom Logo", "desc" => "Choose your own logo. Optimal Size: 215px Wide by 55px Height", "id" => "colorway_logo", "type" => "upload"), array("name" => "Custom Favicon", "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "colorway_favicon", "type" => "upload"), array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here.", "id" => "colorway_analytics", "std" => "", "type" => "textarea"), array("name" => "Body Background Image", "desc" => "Select image to change your website background", "id" => "inkthemes_bodybg", "std" => "", "type" => "upload"), array("name" => "Home Top Feature", "type" => "heading"), array("name" => "Home Top Feature Image", "desc" => "Choose Image for your Home Top Feature. Optimal Size: 900px x 350px", "id" => "colorway_slideimage1", "type" => "upload"), array("name" => "Home Top Feature Heading", "desc" => "Enter the Heading for Home Top Feature", "id" => "colorway_slideheading1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Heading Link", "desc" => "Enter the Link URL in Heading for Home Top Feature", "id" => "colorway_slidelink1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Description", "desc" => "Description for Home Top Feature", "id" => "colorway_slidedescription1", "std" => "", "type" => "textarea"), array("name" => "Home Page Settings", "type" => "heading"), array("name" => "Home Page Intro", "desc" => "Enter your heading text for home page", "id" => "inkthemes_mainheading", "std" => "", "type" => "text"), array("name" => "First Feature Image", "desc" => "Choose image for your feature column first. Optimal size 198px x 115px", "id" => "inkthemes_fimg1", "std" => "", "type" => "upload"), array("name" => "First Feature Heading", "desc" => "Enter your heading line for first column", "id" => "inkthemes_headline1", "std" => "", "type" => "text"), array("name" => "First Feature Link", "desc" => "Enter your link for feature column first", "id" => "inkthemes_link1", "std" => "", "type" => "text"), array("name" => "First Feature Content", "desc" => "Enter your feature content for column first", "id" => "inkthemes_feature1", "std" => "", "type" => "textarea"), array("name" => "Second Feature Image", "desc" => "Choose image for your feature column second. Optimal size 198px x 115px", "id" => "inkthemes_fimg2", "std" => "", "type" => "upload"), array("name" => "Second Feature Heading", "desc" => "Enter your heading line for second column", "id" => "inkthemes_headline2", "std" => "", "type" => "text"), array("name" => "Second Feature Link", "desc" => "Enter your link for feature column second", "id" => "inkthemes_link2", "std" => "", "type" => "text"), array("name" => "Second Feature Content", "desc" => "Enter your feature content for column second", "id" => "inkthemes_feature2", "std" => "", "type" => "textarea"), array("name" => "Third Feature Image", "desc" => "Choose image for your feature column thrid. Optimal size 198px x 115px", "id" => "inkthemes_fimg3", "std" => "", "type" => "upload"), array("name" => "Third Feature Heading", "desc" => "Enter your heading line for third column", "id" => "inkthemes_headline3", "std" => "", "type" => "text"), array("name" => "Third Feature Link", "desc" => "Enter your link for feature column third", "id" => "inkthemes_link3", "std" => "", "type" => "text"), array("name" => "Third Feature Content", "desc" => "Enter your feature content for third column", "id" => "inkthemes_feature3", "std" => "", "type" => "textarea"), array("name" => "Fourth Feature Image", "desc" => "Choose image for your feature column fourth. Optimal size 198px x 115px", "id" => "inkthemes_fimg4", "std" => "", "type" => "upload"), array("name" => "Fourth Feature Heading", "desc" => "Enter your heading line for fourth column", "id" => "inkthemes_headline4", "std" => "", "type" => "text"), array("name" => "Fourth Feature link", "desc" => "Enter your link for feature column fourth", "id" => "inkthemes_link4", "std" => "", "type" => "text"), array("name" => "Fourth Feature Content", "desc" => "Enter your feature content for fourth column", "id" => "inkthemes_feature4", "std" => "", "type" => "textarea"), array("name" => "Home Page Testimonial", "desc" => "Enter your text for homepage testimonial in short paragraph.", "id" => "inkthemes_testimonial", "std" => "", "type" => "textarea"), $options[] = array("name" => "Styling Options", "type" => "heading"), array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "inkthemes_customcss", "std" => "", "type" => "textarea"), array("name" => "Footer Settings", "type" => "heading"), array("name" => "Facebook URL", "desc" => "Enter your Facebook URL if you have one", "id" => "colorway_facebook", "std" => "", "type" => "text"), array("name" => "Twitter URL", "desc" => "Enter your Twitter URL if you have one", "id" => "colorway_twitter", "std" => "", "type" => "text"), array("name" => "RSS Feed URL", "desc" => "Enter your RSS Feed URL if you have one", "id" => "colorway_rss", "std" => "", "type" => "text"), array("name" => "Linked In URL", "desc" => "Enter your Linkedin URL if you have one", "id" => "colorway_linkedin", "std" => "", "type" => "text"), array("name" => "Stumble Upon URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_stumble", "std" => "", "type" => "text"), array("name" => "Digg URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_digg", "std" => "", "type" => "text"));
    update_option('of_themename', $themename);
    return $options;
}
function homeType($classes)
{
    // Add the class when needed
    $HomebgType = get_option('_tdCore-home-bgType');
    $iC = '';
    $end = '';
    foreach (get_the_category() as $category) {
        $postcat = $category->cat_ID;
        $catname = $category->cat_name;
        $catslug = $category->category_nicename;
        if (is_category($catslug)) {
            $end = $postcat;
        }
    }
    $args = array('orderby' => 'name', 'order' => 'ASC');
    $categories = get_categories($args);
    foreach ($categories as $cat) {
        $iC++;
        if ($cat->name != '') {
            if ($end == $cat->cat_ID) {
                $catname = $cat->name;
                $count = get_option('portfolioType' . $iC);
                $count = strtolower($count);
                $classes[] = 'body-' . $count;
            }
        }
    }
    if (is_front_page()) {
        $classes[] = 'body-' . $HomebgType;
    }
    return $classes;
}
 /**
  * List multiple brands shortcode
  *
  * @access public
  * @param array $atts
  * @return string
  */
 public static function brands($atts)
 {
     global $woocommerce_loop;
     if (empty($atts)) {
         return '';
     }
     extract(shortcode_atts(array('orderby' => 'title', 'columns' => '6', 'order' => 'asc', 'per_page' => '6', 'carousel' => 'true'), $atts));
     $brands = get_categories(array('hide_empty' => 0, 'taxonomy' => 'product_brand', 'orderby' => $orderby, 'order' => $order, 'number' => $per_page));
     $output = '';
     $columns = intval($columns);
     $columns = 12 / $columns;
     foreach ($brands as $brand) {
         $thumbnail_id = get_woocommerce_term_meta($brand->term_id, 'thumbnail_id');
         $image_src = wp_get_attachment_image_src($thumbnail_id, 'full');
         $brand_link = get_term_link($brand, 'product_brand');
         $brand_item = '<div class="brand-item">';
         $brand_item .= "\t" . '<a href="' . $brand_link . '"><img alt="' . $brand->cat_name . '" src="' . $image_src[0] . '" width="144" height="36" /></a>';
         $brand_item .= '</div>';
         if ($carousel === 'false') {
             $output .= '<div class="col-xs-12 col-sm-' . $columns . '">' . $brand_item . '</div>';
         } else {
             $output .= $brand_item;
         }
     }
     return $output;
 }
Example #30
-1
    function kmw__faq_sort_categories($taxtype)
    {
        $args = array('parent' => 0, 'orderby' => 'name', 'ord' => 'ASC', 'style' => 'list', 'hide_empty' => 0, 'title_li' => '', 'number' => null, 'taxonomy' => $taxtype);
        $get_tax_name = get_taxonomy($taxtype);
        $cats = get_categories($args);
        ob_start();
        ?>
			<div class="dropdown-sorter">
				<span class="button dropdown-button">
					<?php 
        echo $get_tax_name->label;
        ?>
					<ul>
					<?php 
        foreach ($cats as $category) {
            ?>
						<li><a href="<?php 
            echo get_term_link($category);
            ?>
"><?php 
            echo $category->name;
            ?>
</a></li>
					<?php 
        }
        ?>
					</ul>
				</span>
			</div>		
		<?php 
        $return = ob_get_clean();
        return $return;
    }