-
Visit my blog
read all about bochgoch
- What is systems thinking?
- When is a system a system
- Complexity
- Beliefs
- Information Gathering
- Methodology Method Tool
- Sustainable Development
- Reflection
- Success
Wordpress
Display links to posts in selected category(ies) in the sidebar.
To provide a link to the posts in a certain category or set of categories in the sidebars (or anywhere else) on your blog. See it in action on mybarnconversion.com in the left side column at the top.
Through this method you can draw attention to selected posts that you assign to a specific category.
<?php
$today = current_time('mysql', 1);
if ( $essentialposts = $wpdb->get_results("SELECT ID, post_title
FROM $wpdb->posts t1, $wpdb->post2cat t2
WHERE t1.ID=t2.post_id
AND t1.post_status = 'publish'
AND t2.category_id IN ('5','6')
ORDER BY post_title DESC
LIMIT 10")):
?>
<h1><?php _e("Essential Reading"); ?></h1>
<ul>
<?php
foreach ($essentialposts as $post) {
if ($post->post_title == '')
$post->post_title = sprintf(__('Post #%s'), $post->ID);
echo "<li><a href='".get_permalink($post->ID)."'>";
the_title();
echo '</a></li>';
}
?>
</ul>
<?php endif; ?>
This example places upto 10 links to posts in categories 5 and 6 in an unordered list with the heading Essential Reading.
Amend the code to selected the categories you require, the heading etc., then place it in your Sidebar, right.php or similar.