Пример #1
0
function is_commodity()
{
    global $commodity_cat_name_group, $cat;
    if ($commodity_cat_name_group) {
        foreach ($commodity_cat_name_group as $commodity_cat_name) {
            if ($commodity_cat_name) {
                $commodity_cat_ID = get_cat_ID($commodity_cat_name);
                if ($commodity_cat_ID == get_category_root_id($cat) || $commodity_cat_ID == $cat) {
                    return true;
                }
            }
        }
    }
}
Пример #2
0
    $category = get_the_category();
    $category_ID = $cat;
    if (is_single()) {
        $category_ID = $category[0]->cat_ID;
    }
    $cats = get_category(get_category_root_id($category_ID));
    if ($category_ID != get_category_root_id($category_ID) || get_category_children($category_ID)) {
        ?>
  
	<aside class="cat">
		<?php 
        echo '<h3>' . $cats->name . '</h3>';
        ?>
        <ul>
	    	<?php 
        wp_list_categories("child_of=" . get_category_root_id($category_ID) . "&depth=0&hide_empty=0&title_li=&use_desc_for_title=&orderby=id&show_count=0");
        ?>
        </ul>
    </aside>
        <?php 
    }
    ?>
    <?php 
}
?>
    <?php 
if (is_page()) {
    ?>
    <?php 
    if ($post->post_parent) {
        echo '<aside class="pages">';
Пример #3
0
    function widget($args, $instance)
    {
        // 输出显示在页面上
        extract($args);
        $id = $instance['id'];
        $before_content = $instance['before_content'];
        $after_content = $instance['after_content'];
        ?>
       
  <?php 
        if (is_category()) {
            ?>
 <?php 
            $cat2 = get_query_var('cat');
            $cat = get_category_root_id($cat2);
            $category = get_category($cat);
            ?>
          <?php 
            if (get_category_children($cat) != "") {
                ?>
      
<div class="widget_left widget_nav_menu">

<div class="widge_hd">
   <span>
  
       <b><?php 
                echo $category->name;
                ?>
</b>
   </span>
  
   </div>

    <ul> <?php 
                if (get_category_children($cat) != "") {
                    wp_list_categories("child_of=" . $cat . "&depth=0&hide_empty=0&title_li=");
                }
                ?>
</ul>
</div>

<?php 
            }
        }
        ?>


 <?php 
        if (is_single()) {
            ?>
 <?php 
            $cat2 = get_query_var('cat');
            $cat = get_category_root_id(the_category_ID(false));
            $category = get_category($cat);
            ?>
          <?php 
            if (get_category_children($cat) != "") {
                ?>
      
<div class="widget_left widget_nav_menu">

<div class="widge_hd">
   <span>
  
       <b><?php 
                echo $category->name;
                ?>
</b><p><?php 
                echo $category->slug;
                ?>
</p>
   </span>
  
   </div>

    <ul> <?php 
                if (get_category_children($cat) != "") {
                    wp_list_categories("child_of=" . $cat . "&depth=0&hide_empty=0&title_li=");
                }
                ?>
</ul>
</div>

<?php 
            }
        }
        ?>
  <?php 
        if (is_page()) {
            ?>
  
    <?php 
            global $wpdb;
            global $post;
            $post_data = get_post($post->ID, ARRAY_A);
            $slug = $post_data['post_name'];
            $name = $slug;
            //page别名
            $parent_id = get_post($post->post_parent, ARRAY_A);
            $parent_slug = $parent_id['post_name'];
            $parent_title = get_the_title($post->post_parent);
            $parent_link = get_page_link($post->post_parent);
            $childrensd = wp_list_pages("title_li=&child_of=" . $post->ID . "&echo=0&depth=1");
            if ($childrensd != "" || $post->post_parent) {
                ?>
       <div class="widget_left widget_nav_menu">

<div class="widge_hd">
 <span>
       <b><?php 
                if ($post->post_parent) {
                    echo $parent_title;
                } else {
                    echo get_the_title();
                }
                ?>
</b><p><?php 
                if ($post->post_parent) {
                    echo $parent_slug;
                } else {
                    echo $slug;
                }
                ?>
</p>
  </span>
   </div>

   
          <?php 
                if ($post->post_parent) {
                    ?>
          <ul class="nav_left">  <?php 
                    $children = wp_list_pages("title_li=&child_of=" . $post->post_parent . "&echo=0&depth=1");
                    if ($children) {
                        echo $children;
                    }
                    ?>
</ul>
        <?php 
                } else {
                    ?>
         <ul class="nav_left"> <?php 
                    $children = wp_list_pages("title_li=&child_of=" . $post->ID . "&echo=0&depth=1");
                    if ($children) {
                        echo $children;
                    }
                    ?>
</ul>
           <?php 
                }
                ?>
 
        
        
</div>
       
        <?php 
            }
        }
    }
Пример #4
0
    ?>
                        
<h3> <?php 
    echo $category->name . ' <a>' . $category->slug . ' </a>';
    ?>
</h3>
  
</div>

<?php 
} elseif (is_category()) {
    ?>

<div class="page_top_in">
   <?php 
    $cat = get_category_root_id(the_category_ID(false));
    $cat2 = get_query_var('cat');
    $category2 = get_category($cat2);
    $category = get_category($cat);
    ?>
    
<h3>    <?php 
    if (get_category_children($cat) != "") {
        echo $category->name . ' <a>' . $category->slug . ' </a>';
    } else {
        echo $category2->name . ' <a>' . $category2->slug . ' </a>';
    }
    ?>
 </a></h3>
    
</div>
 
		</div><div class="clear"></div><div class="pagenavi graybox">
<div class="navigation"><?php 
pagenavi();
?>
</div></div>
          <div style="clear:both"></div></div></div></td>
	<td valign="top" class="list-table-right">
		<a id="show_cate_list_btn" class="btn_list_button" style="color:#FFF;" href="javascript:void(0);">展开全部图片分类</a>
        <ul class="btn_list">
        <li style="border-top:none"><a href="<?php 
echo get_category_link(get_category_root_id($cat));
?>
">全部</a></li>
         <?php 
wp_list_categories("child_of=" . get_category_root_id($cat) . "&depth=0&hide_empty=0&sort_order=desc&title_li=0");
?>
     </ul><div style="margin-bottom:30px;">
<?php 
if (get_option('swt_ad-liu-right') == 'Display') {
    echo stripslashes(get_option('swt_ad-liu-right-code'));
} else {
}
?>
</div><div></div><div></div></td></tr>
</tbody></table></div><div>
<?php 
if (get_option('swt_ad-liu-bottom') == 'Display') {
    echo stripslashes(get_option('swt_ad-liu-bottom-code'));
} else {
}
Пример #6
0
		<div class="sidebar">
			<?php 
if (is_category() || is_single()) {
    ?>
            <ul class="category-list">
                <?php 
    if (is_single()) {
        $cat_id = get_article_category_id();
    } else {
        $cat_id = $cat;
    }
    $args = array('child_of' => get_category_root_id($cat_id), 'hide_empty' => false);
    $categories = get_categories($args);
    foreach ($categories as $category) {
        $class = '';
        if ($cat_id == $category->term_id) {
            $class = " class='current-cat' ";
        }
        $custom_icon = get_tax_meta($category->term_id, 'simplehome_custom_icon');
        $custom_icon_html = '';
        if ($custom_icon != '') {
            $custom_icon_html = '<i class="fa ' . $custom_icon . '"></i>';
        }
        echo '<li' . $class . '><a href="' . get_category_link($category->term_id) . '">' . $custom_icon_html . '<span>' . $category->name . '</span></a></li>';
    }
    ?>
            </ul><?php 
}
?>
		<?php 
if (is_dynamic_sidebar()) {