New Topic

Make Front Page the most recent post

Home › Forum › Customization › Make Front Page the most recent post

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1038
    StartupWP
    Keymaster

    This will require a custom page template. Please note that this is a special request and we’re not aware of any theme that has such capability by default, so you know, it’s not somehow a limitation of StartupPro, no theme has such capability out-of-the-box.

    1. If you don’t already have a child theme setup, set one up:

    https://startupwp.com/topic/child-theming/

    2. Add a new custom page template to your child theme named home-post.php with the contents:

    <?php /* Template Name: Home Post */ ?>
    <?php get_header(); ?>
    <div id="content">
    <?php query_posts( 'posts_per_page=1' ); ?>
    <?php while ( have_posts() ) : the_post() ?>
    <?php get_template_part('entry'); ?>
    <?php comments_template(); ?>
    <?php endwhile; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    3. In your WP admin, create a new page named “Home Post” and assign it the custom template.

    4. Under Settings > Reading set “Home Post” as the static frontpage.

    This is untested, but should work.

    #1039
    inmyimage
    Participant

    Thanks, I agree that there does not appear to be a theme that has this functionality today but after looking at probably a couple hundred descriptions and finalizing on a dozen to beta test, I decided to go with StartupWP because it did most of what I wanted easily, and you have a great response to questions and issues on this support forum and are willing to help with some extra code and/or advice to try to get a customer’s customizations implemented.

    That being said I figured I’d have the best shot at this implementation going with StartupWP Pro.

    Now, I did implement the child theme (which was a lot easier than I expected) and created the php file with a copy and past of the code you provided and while it does display the latest post, it doesn’t show the comments section.

    I tried it with the static page set as both a “Front page” and a “Posts page”, but with no difference. I also tried with comments on and off on the page itself, in addition to setting the Reading Option for “Blog pages show at most” at the default of 10 and 1.

    Any additional thoughts are appreciated, if we can get this to work, it would be a nice differentiating feature to advertise.

    Bill


    #1041
    StartupWP
    Keymaster

    Thank you for choosing StartupWP. :)

    Hopefully, it’s as simple as updating the template to:

    <?php /* Template Name: Home Post */ ?>
    <?php get_header(); ?>
    <div id="content">
    <?php query_posts( 'posts_per_page=1' ); ?>
    <?php while ( have_posts() ) : the_post() ?>
    <?php get_template_part('entry'); ?>
    <?php comments_template('', true); ?>
    <?php endwhile; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    #1043
    inmyimage
    Participant

    Bummer, no improvement.

    Just to be sure, I created another template and page with a fresh php file just to make sure I wasn’t seeing any sort of caching issue on the server or my browser.

    Bill


    #1044
    StartupWP
    Keymaster

    Alright, let us do some more testing an get back to you.

    Thanks

    #1048
    inmyimage
    Participant

    Another option is if you know how to form a link that would pull the latest post directly.
    This would allow me to set my domain forwarding URL to the “home” URL that pulls the latest post, and then I can add a menu item that does the same thing.
    Seem like a good alternative while we try to figure this out, assuming we can?
    Thanks for all your efforts will definitely be leaving a 5 star review of the theme, just hoping I can highlight a new feature for you in the comments ;)
    Bill


    #1049
    inmyimage
    Participant

    Hey, we are closer than I thought!!!

    After trying to finalize the “beta” layout so that I can start getting actively posting while continuing this effort on a new deployment of WordPress, I discovered that the template file that you gave me is working!!!

    It is just that the comment link is simply at the end of the tag cloud and blends in completely to it.

    See Screen Shot: https://dl.dropboxusercontent.com/u/18993675/StartupWP%20Pro%20Support/Home%20Post%20Comment%20Link.JPG

    You can see the behavior directly at

    So, it would seem that what we really need to focus on is:

    1) Separate the comment link from the end of the cloud and make it standout.

    2) Show existing comments

    3) I’ll start a new thread on this in general later, but in case it needs to be different for this template, hide the post specific tag cloud, as well as the “Posted in” category list, completely.

    Thanks again for all the effort,

    Bill


    #1050
    inmyimage
    Participant

    Don’t know why the link to the page did not appear, but you can see the current behavior first hand at:


    #1051
    inmyimage
    Participant

    Okay, apparently the link button either isn’t working or something is filtering out the link: http://www.inmyimage.com


    #1052
    inmyimage
    Participant

    Forgot to leave the screen shot of the comment link before having an approved comment: https://dl.dropboxusercontent.com/u/18993675/StartupWP%20Pro%20Support/Home%20Post%20Comment%20Link%202.JPG

    Note that I deleted the test comment that I left and that page assigned to the home-post.php template has commenting turned off at the page level.

    Thanks again,

    Bill


    #1056
    StartupWP
    Keymaster

    Let’s go back to:

    <?php /* Template Name: Home Post */ ?>
    <?php get_header(); ?>
    <div id="content">
    <?php query_posts( 'posts_per_page=1' ); ?>
    <?php while ( have_posts() ) : the_post() ?>
    <?php get_template_part('entry'); ?>
    <?php comments_template(); ?>
    <?php endwhile; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Now for that page under Pages in your WP admin, when editing, go top-right and click on “Screen Options” to make sure that the “Discussion” box is checked and then, that “Allow Comments” is checked below. If that’s a no go, we’ve unfortunately run out of ideas.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.