Custom sidebar php to show a single category
-
Hi, I have taken over a website made by another person. I need to change the homepage sidebar to show only one category but the custom php that this person made, I am afraid to change it. Can anyone look at this and modify it to show only category 4?
Thank you for your help!
Diana<h2>Recent News</h2> <ul id="post-listing"> <?php /** * Beginning of Custom WP Query */ $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC', 'showposts' => 3, ); $wp_query = new WP_Query($args); // Display returned posts while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <li> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php $the_excerpt = substr(get_the_excerpt(), 0, 110); ?> <?php echo '<p>' . $the_excerpt . ' […] </p>'; ?> <?php /* <p>Posted in <?php the_category( ', ' ); ?> by <?php the_author_posts_link(); ?></p> */ ?> <p><em><?php the_time('F jS, Y'); ?></em></p> </li> <?php endwhile; ?> </ul><!-- #post-listing -->
- The topic ‘Custom sidebar php to show a single category’ is closed to new replies.