Page Navigation Outside the Loop

I use previous_post_link() and next_post_link() (Codex previous_post_link()/next_post_link()) outside of the Loop, with no problems. Note that the Codex entries indicate that these functions must be used within the Loop, but IMX that isn’t true. The functions call the $post global, and pass it to get_previous_post() and get_next_post(), respectively. By the way, posts_nav_link() is the incorrect … Read more

Display posts differently depending on which author wrote it

When you’re in the loop, you can use get_the_author() to get the author’s ‘Public’ name. Alternatively, you can use get_the_author_meta( ‘ID’ ) in the loop to get the author ID. So, modifying your psuedo-code: if ( 2 == get_the_author_meta( ‘ID’ ) ) { echo ‘<h2>John’s Perspective</h2>’ }

How do i create a loop that list and divide posts into months?

you could do this in any loop by checking the current post’s published month, and printing it when it changes: <?php // set current month to that of first post, and print it. $current_month = get_the_time(‘F’); echo $current_month; while (have_posts()) : the_post(); // check each subsequent post to see if the month is the same … Read more

How to show full post on home page

You can alter query_posts – see http://codex.wordpress.org/The_Loop – but maybe the best thing to do is use a page template with a new query. WP will default to home.php instead of index.php if one exists, so you can leave index.php alone for other page to use. See http://codex.wordpress.org/Class_Reference/WP_Query Sample query; remove the permalink and/or title, … Read more

Insert a Custom Post type into my Loop

To alter your default or main loop you can add query_posts before the loop runs. http://codex.wordpress.org/Function_Reference/query_posts http://codex.wordpress.org/Class_Reference/WP_Query ( parameters) For example in your above code, to include all posts including custom posts types you would write; <?php query_posts( ‘post_type=any’); ?> <?php while (have_posts()) : the_post(); ?> //rest of your code from above If you want … Read more