How to include in a php widget
-
Hi,
i try to include the subtitles in a “see other posts” widget. This is the code of the widget:
<?php if (is_single()) { $post_ID = $wp_query->posts[0]->ID; $all_cats_of_post = get_the_category($post_ID); $first_cat_ID = $all_cats_of_post[0]->cat_ID; $first_cat_name = $all_cats_of_post[0]->cat_name; ?> <div id="category-posts-<?php echo $first_cat_ID; ?>" class="widget widget_recent_entries"> <h2>Weitere Beitr?ge aus <?php echo $first_cat_name; ?></h2> <div> <ul> <?php global $post; $cat_posts = get_posts('numberposts=20&category='.$first_cat_ID); foreach($cat_posts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> </div> </div> <?php } ?>
Could you, however, help me, what i have to write in this code to make the subtitels work?
thanks a lot in advanced!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to include in a php widget’ is closed to new replies.