Community Forums › Forums › General Discussion › Does anyone know how to do multiple home page loops?
This topic contains 3 replies, has 2 voices, and was last updated by wpspeak 3 months, 4 weeks ago.
-
AuthorPosts
-
January 23, 2013 at 3:38 am #14016
hey all
Does anyone have a code snippet for multiple home page loops?
I need to have one post from a featured category
and then the rest of the page have posts from another category (without duplicating posts from featured if it is in both categories)
as well as a post thumbnail before the post title
has anyone seen anything like this around or close or something i could work with
would super highly appreciate it (client project)
January 25, 2013 at 7:39 pm #14925The way I’ll do it:
1. Create a widget area before the blog loop. Use the featured post widget where you can choose “Featured” category. If you need more control of the position of the image (like image before post title), install the Genesis Featured Post amplified plugin. The native Featured Post Widget can only align the image to none, left and right only if I’m not mistaken.
2. Use blog page template and exclude the “Featured” category. It should be similar to this http://www.briangardner.com/blog-page-single-category/ BUT you need to put the negative sign in front on the category ID.
3. To swap the position of post thumbnail of post title, there’s two method:
METHOD 1: You need to unhook the original one, and hook them back. Here’s a sample code:
// Move image above post title
remove_action( 'genesis_post_content', 'genesis_do_post_image' );
add_action( 'genesis_before_post_title', 'genesis_do_post_image' );METHOD 2: Using the same method as Streamline theme. Here’s the code:
/** Add post image above post title */
add_action( 'genesis_before_post', 'streamline_post_image' );
function streamline_post_image() {if ( is_page() ) return;
if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) {
printf( '', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
}}
What you need to achieve is actually have almost the same structure with Streamline theme.
Hope this helps
January 25, 2013 at 11:51 pm #14959Thankyou so much for your detailed reply, that is an excellent idea!
Genius
January 26, 2013 at 12:22 am #14962No problem. I’m pretty sure other folks will have different ways of doing this. But the one I mentioned above might be the simplest one (at least for me)
-
AuthorPosts
You must be logged in to reply to this topic.