Forum Replies Created
-
AuthorPosts
-
marcello.vicidomini
MemberBecause in the front page I have to display other elements too that are not from the category (an image slider), and then I have a different page showing the archive for the category.
So I thought to have the following structure:
* home.php: with a sidebar to include the slider as a widget, and a custom loop to show the last 6 posts from “Blog” category
* A link in the menu pointing to the “Blog” category archive page.marcello.vicidomini
MemberOk, that was clear 😀
Should I use WP_Query instead?
marcello.vicidomini
MemberHello Brad,
I think I solved it, here's the code:if ( function_exists( 'genesis_grid_loop' ) ) { //* Here's the line I added. I used the slug instead of the id, but if works with cat_ID too query_posts('category_name=blog'); genesis_grid_loop( array( 'features' => 0, 'feature_image_size' => 0, 'feature_image_class' => 'alignleft post-image', 'feature_content_limit' => 200, 'grid_image_size' => 'homepage-featured-image', 'grid_image_class' => 'alignleft post-image', 'grid_content_limit' => 0, ) ); } else { genesis_standard_loop(); }
March 19, 2014 at 6:00 am in reply to: How to override number of posts per page settings with the loop? #95640marcello.vicidomini
MemberHello Anitac, thanks for yor answer.
I downloaded the sample child theme and I'm customizing it.
As for the url, I'm sorry I didn't post one, but it's still in development and unfortunately I have to keep it password protected. I'll make sure I'll share the url with you for feedback as soon as it goes live 😀Anyway, I think I found a solution. Here's the code I wrote:
if ( function_exists( 'genesis_grid_loop' ) ) { //* Here's the line I added query_posts('posts_per_page=6;'); genesis_grid_loop( array( 'features' => 0, 'feature_image_size' => 0, 'feature_image_class' => 'alignleft post-image', 'feature_content_limit' => 200, 'grid_image_size' => 'homepage-featured-image', 'grid_image_class' => 'alignleft post-image', 'grid_content_limit' => 0, ) ); } else { genesis_standard_loop(); }
It seems to have done the trick! 😀
marcello.vicidomini
MemberHello braddalton,
thanks a lot for your answer!
Don't you think that pre_get_posts would be impractical? It looks like each time you add a new category you have to edit the code. Or maybe I'm not getting something? Isn't there a way to include one category rather then excluding all the other ones?Thanks again for your help 😀
-
AuthorPosts