Blog Posts Template (not in Homepage)
-
Hi! Great theme!
I’d like to know if is it possible to load blog posts in a wordpress page (not Homepage), with this look and feel: https://wp-themes.com/baskerville/ (demo).
Thanks a lot!
-
Are you looking for a list of blog posts or the contents of a post?
A kind of masonry of posts with thumbnail, title, excerpt and link. The same as the example.
The same as what you see here: https://wp-themes.com/baskerville/
But I want to show it not in Home Page. I’d like to put these in an internal page.
Thanks!
Hi, please let me know if you find a solution to this. I’m struggling to do the same thing. Cheers
I just found a way to accomplish this with Tags or Categories. The theme shows tags or category pages in a masonry layout by default. I cant find a way to make a grid template but this should help you ie if you want to show certain posts on a page, tag them together. Then make a custom menu item that links to that page. Cheers
I’ve done this using a Child theme. I wanted to be able to put a slide show or text above the posts.
You’ll need to read up on how to create a child theme, and you’ll need to be able to add files to your website. I added a new page template – Landing Page.
My only disappointment was that I couldn’t get this to work as a home page – for some reason it doesn’t pull in older posts.
I hope this is of help to someone.
Here’s a link to a working example.
https://breakfastinamerica.me/this-is-a-landing-page/
<?php /* Template Name: Landing Page */ ?> <?php get_header(); ?> <?php // // 1.00 Completed Landing page - still doesn't work on the home page... :( // // ?> <div class="wrapper section medium-padding"> <?php $tag = get_term_by('slug', 'hold', 'post_tag'); // Set Slug of posts not to be displayed. ?> <?php $tag_id = $tag->term_id; ?> <?php $args = array( 'posts_per_page' => get_option( 'posts_per_page' ), 'paged' => max( 1, get_query_var( 'paged' ) ), 'tag__not_in' => $tag_id // Exclude this tag (use tag ID) // 'category_name' => 'favorites', // Only display this category (use slug) // 'tag' => 'mytop20' // Only display this tag (use slug) ); ?> <?php global $wp_query, $wp_the_query; ?> <?php $wp_query = new WP_Query( $args ); ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?> <?php $total_post_count = wp_count_posts(); ?> <?php $published_post_count = $total_post_count->publish; ?> <?php $total_pages = ceil( $published_post_count / $posts_per_page ); ?> <?php if ( "1" < $paged ) : ?> <div class="page-title section-inner"> <h3><?php printf( __('Page %s of %s', 'baskerville'), $paged, $wp_query->max_num_pages ); ?></h3> </div> <div class="clear"></div> <?php endif; ?> <?php // Additional code to include the current page text on the first page only ?> <?php if( !is_paged() ): //Remove this if statement and corresponding endif if you want the page content on the top of every paginated blog page. ?> <div class="pagetext"> <article <?php post_class(); ?> id="post-<?php the_ID(); ?>"> <div class="entry"> <div class="entry-content"> <?php the_content(); ?> <div class="clear"></div> </div><!-- .entry-content --> </div><!-- .entry --> </article><!-- .post --> </div><!-- #Pagetext --> <?php endif; ?> <?php // End of additional code ?> <div class="content section-inner" > <div class="posts"> <?php if ( $wp_query->have_posts()) : ?> <?php while ( $wp_query->have_posts()) : $wp_query->the_post(); ?> <div class="post-container"> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php get_template_part( 'content', get_post_format() ); ?> </div> <!-- /post --> </div> <!-- /post-container --> <?php endwhile; ?> <?php endif; ?> </div> <!-- /posts --> </div> <!-- /content --> <?php if ( $wp_query->max_num_pages > 1 ) : ?> <div class="archive-nav section-inner"> <?php echo get_next_posts_link( '« ' . __('Older posts', 'baskerville')); ?> <?php echo get_previous_posts_link( __('Newer posts', 'baskerville') . ' »'); ?> <div class="clear"></div> </div> <!-- /post-nav archive-nav --> <?php endif; ?> <div class="clear"></div> </div> <!-- /wrapper --> <?php get_footer(); ?>
Hi Gary Allman, are you using tags or categories in the template to choose what posts are displayed in the template? Cheers
No the code above shows everything (except posts tagged ‘hold’) – but there are two commented out lines there for dealing with specific tags & categories.
// 'category_name' => 'favorites', // Only display this category (use slug) // 'tag' => 'mytop20'
The above code does not display posts tagged with the tag ‘hold’. Just as a way of keeping some posts off of the page. I’d forgotten I did that ??
- The topic ‘Blog Posts Template (not in Homepage)’ is closed to new replies.