Grid of Posts
-
Can anyone please explain how to go about doing this?
https://www.transformationpowertools.com/wordpress/grid-postsI found his articles confusing, because they don’t go step by step about what to add, so I’m finding myself a bit lost. Help would be greatly appreciated.
-
1. This will put the posts into columns. Use this code to add your own loop-grid.php to your site
2. This calls loop-grid.php into action. This should go in your main template. It went into my index.php
3. This styles the grid. You put it in your css and can play around with it later.
By the time all of those steps are done… you should have some sort of grid layout set.
Also, PLEASE post your site. It’ll be easier for us to see what’s going on.
oh wow, this works like a charme. thanks a lot!!!!!! i also see where my mistake was.. its funny, once you are able to compare, you understand so much! i will post my page too, but i have nothing online yet and also have to style it first, but for now this is already fantastic! Thanks for sharing this ernestg! i really needed it exactly like this in these clear steps. perfect! once i have my css fixed i will post my page. thanks again!
Great! It’s exciting when stuff works the way you want it to. I kept on nagging alchymyth to help me style my page exactly as I had envisioned it and he kept helping, so if anything… just keep asking questions. Really glad I could help.
I’m so impressed of your patience here, so fun to se people help. I hope that someone can help me too. My problem is that when i did the three starting steps, something happens to my sidebar, its taking almost 50% of the content area. What am i doing wrong?
https://imageshack.us/photo/my-images/3/exemp.jpg/
Thanks.
could you please start a new topic?
and post a link to your site?it is virtually impossible to comment on formatting without seeing the problem in a live site.
it might be caused by a conflict of css selectors …Here is the new topic:
https://www.ads-software.com/support/topic/problem-with-grid-of-posts?replies=1Thanks all for the help here, I’ve been pulling my hair out trying to figure this out.
I’m close, but I need to get this to display posts from a custom post type —?how would I go about this?
Also, I am seeing some layout issues where the top navi isn’t working right: https://cl.ly/9zXG
and the thumbnail grid does a 3×4 grid, but then just drops the rest in a single column: https://cl.ly/9zDL —?this also seems to be related to the page navigation, as it does not appear on the bottom.
I did tweak the code to get an image-only grid as opposed to all the other post info in the same code:
<?php /** * The loop to show posts in columns * * loop-stock-illustration-grid.php * @package WordPress * @subpackage Twenty Ten * @since 3.0.0 */ ?> <?php /* Display navigation to next/previous pages when applicable */ ?> <?php if ( $wp_query->max_num_pages > 1 ) : ?> <div id="nav-above" class="navigation"> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> </div><!-- #nav-above --> <?php endif; ?> <?php /* If there are no posts to display, such as an empty archive page */ ?> <?php if ( ! have_posts() ) : ?> <div id="post-0" class="post error404 not-found"> <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1> <div class="entry-content"> <p><?php _e( 'Apologies, but no results were found for the requested Archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </div><!-- #post-0 --> <?php endif; ?> <?php /* Start the Loop */ ?> <?php $num_cols = 4; // set the number of columns here for ( $i=1 ; $i <= $num_cols; $i++ ) : echo '<div id="col-' . $i . '" class="col" >'; $counter = $num_cols + 1 - $i; ?> <?php while (have_posts()) : the_post(); if( $counter%$num_cols == 0 ) : // begin of core posts output ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <a href="<?php the_permalink(); ?>" title="Cartoon <?php echo get_post_meta( get_the_ID(), 'stock-art-name', true ); ?> clipart"><?php the_post_thumbnail('thumbnail'); ?></a> <h1 class="page-title"><a href="<?php the_permalink(); ?>" title="Cartoon <?php echo get_post_meta( get_the_ID(), 'stock-art-name', true ); ?> clipart "><?php echo get_post_meta( get_the_ID(), 'stock-art-name', true ); ?></a></h1> </div><!-- #post-<?php the_ID(); ?> --> <?php //end of posts output endif; $counter++; endwhile; rewind_posts(); echo '</div>'; //closes the column div endfor; ?> <?php /* Display navigation to next/previous pages when applicable */ ?> <?php if ( $wp_query->max_num_pages > 1 ) : ?> <div id="nav-below" class="navigation"> <?php if(function_exists('page_navi')) { page_navi(); } else { ?> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> <?php } ?> </div><!-- #nav-below --> <?php endif; wp_reset_query(); ?>
I got this to work finally, needed to change the query_posts info to use the proper Custom Post Type, and then change the “pots per page” to 18 to fit my theme (child based off of twentyten). This was done in the template, for those having the same issue (the second code link in the post above).
Tweaked the CSS to center things up.
For some reason the changes didn’t “take” at first, but I came back & reloaded the page and boom, it was just as I wanted!
Now to see what happens when the pagination kicks in ??
Hello everyone,
i recently came up with problem i have and i still havn’t figured it out.
i use the grid quiet often but now i came along the issue that a headline of a post (actually its a page) is too long and i thought if there is maybe a way to use the menu title instead of the page title to be displayed as “headline” of my posts in the grid?and the second issue i have is that now since i use almost only pages that my page template where i display the grid (home.php) is listed as result itself. is there a way to hide the page that loads the grid from displaying them self, since i use it on several pages on the actual project. Any idea???
- The topic ‘Grid of Posts’ is closed to new replies.