WordPress.org

Forums

Customizr
[resolved] Posts on front-page as well as on posts page (7 posts)

  1. eyeland
    Member
    Posted 1 year ago #

    Starting a new thread asthis one is old and didn't solve my problem.
    I am fiddling with http://mcasien.com/ and I would like excerpts of the latest posts to show up on the front page below the featured pages - similar to what you see at http://demo.themesandco.com/
    I do however want to retain my post-page as well, so that visitors can reach a page listing the posts from the menu item "rejse-blog".
    I want this because I fear that some visitors will fail to realize that there is more content below the featured pages :)

  2. acub
    Member
    Posted 1 year ago #

    1. Set your front page to display latest posts.
    2. Save this as blog.php and put it in your child theme folder:

    <?php
    
    /*
    Template Name: Blog
    */
    
    add_action('__before_loop', 'tc_blog_template_query');
    add_action('__after_loop', 'wp_reset_query', 9999, 0);
    get_template_part('custom-page');
    
    function tc_blog_template_query() {
    	$paged = (get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1));
    	query_posts('is_posts_page=true&paged='.$paged);
    	}

    3. Edit your blog page (the static one, other than homepage) and select "Blog" as template from Page Attributes Box.

    Note: this solution loads custom-page.php (generic boilerplate for custom page templates) and applies some actions to it on the fly. It assumes it has not been modified. I specifically wanted to load the template dynamically to ensure that you don't lose any updates or additions to this template in future versions of the theme.

  3. eyeland
    Member
    Posted 1 year ago #

    Nice one, thanks a bunch, gonna try that one out tonight when I get home :)

  4. acub
    Member
    Posted 1 year ago #

    You're welcome. Don't forget to mark as resolved if it works.

  5. eyeland
    Member
    Posted 1 year ago #

    It kind of works with a few quirks and I have an odd issue.
    http://www.mcasien.com
    I was using:

    /* Remove Page Icon/Title
    .page .entry-title.format-icon {
    display:    none;
    }

    but using it with the blog.php brings back the post-icon on the front-page and obviously hides the post title on the posts-page (not on the front-page)
    Issue:
    I now get the full blog post instead of the summary with feature circle. This Issue seems to be independent of the blog.php customization. (not sure if it was there before, but it remains after reverting the design)
    Shall I deal with with this issue in a separate thread? :)

  6. acub
    Member
    Posted 1 year ago #

    You need to remove .page from that CSS so it also works for posts. Now it only hides the icons for pages.

    If you want to list excerpts in the post list, you need to select this option from theme options, under Pages and Posts Layout.

  7. eyeland
    Member
    Posted 1 year ago #

    @Acub
    Once again, thanks for having the patience to help me with these issues that sometimes are so simple that I feel sooo foolish. I just hope that some other nuub can benefit from reading it as well :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic