<ul class="topnav">
<?php
$orderby = 'name';
$taxonomy = 'category'; //slug name
$args = array(
'orderby' => $orderby,
'taxonomy' => $taxonomy,
'category__in' => array($category->term_id),
'hide_empty'=> 0,
);
?>
<?php
$m=1;
$postid=$_REQUEST['pid'];
$queried_post = get_post($postid);
$title = $queried_post->post_title;
$content= $queried_post->post_content;
$image_path = wp_get_attachment_url(get_post_thumbnail_id($postid));
$categories = get_categories($args);
foreach ($categories as $category)
{
?>
<li><a href="javascript:void(0)"><?php echo $category->cat_name; ?></a>
<ul class="proCat">
<?php
$m=1;
$loop = new WP_Query( array('post_type' => 'post',
'category_name'=>$category->slug ) );
while ( $loop->have_posts() ) : $loop->the_post();
$postid = get_the_ID();
?>
<li <?php if ( $post->ID == $wp_query->post->ID ) { echo ' class="current"'; } else {} ?>><a href="<?php the_permalink();?>" class="">
<?php the_title();?>
</a></li>
<?php $m=$m+1; endwhile;?>
</ul>
<?php $m=$m+1; } ?>
</li>
</ul>
Ref: http://www.ishaengineering.com/oil-squeezing-press/ - Sidebar
<?php
$orderby = 'name';
$taxonomy = 'category'; //slug name
$args = array(
'orderby' => $orderby,
'taxonomy' => $taxonomy,
'category__in' => array($category->term_id),
'hide_empty'=> 0,
);
?>
<?php
$m=1;
$postid=$_REQUEST['pid'];
$queried_post = get_post($postid);
$title = $queried_post->post_title;
$content= $queried_post->post_content;
$image_path = wp_get_attachment_url(get_post_thumbnail_id($postid));
$categories = get_categories($args);
foreach ($categories as $category)
{
?>
<li><a href="javascript:void(0)"><?php echo $category->cat_name; ?></a>
<ul class="proCat">
<?php
$m=1;
$loop = new WP_Query( array('post_type' => 'post',
'category_name'=>$category->slug ) );
while ( $loop->have_posts() ) : $loop->the_post();
$postid = get_the_ID();
?>
<li <?php if ( $post->ID == $wp_query->post->ID ) { echo ' class="current"'; } else {} ?>><a href="<?php the_permalink();?>" class="">
<?php the_title();?>
</a></li>
<?php $m=$m+1; endwhile;?>
</ul>
<?php $m=$m+1; } ?>
</li>
</ul>
Ref: http://www.ishaengineering.com/oil-squeezing-press/ - Sidebar
No comments:
Post a Comment