• Hey hey !
    I’m wondering how I can place a post on my blog that shows on my homescreen automatically AND is shown as chronologically on the subject it fits in.

    Sincerely yours,
    Daniel Bemelen

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You will need to create a new template. When doing so, it’s a good idea to create a child theme so your changes are safe from theme updates. Copy your theme’s page.php to the child theme folder and rename it front-page.php. Switch your site’s active theme to the child. Nothing will appear differently on your site so far.

    Code can be added to front-page.php to display anything you want. How would code know what post to display? Will it always be the same post? If so, determine its ID. Let’s say it is 123 for this example. Add code to the template similar to this:

    <?php
    $post = get_post( 123 );
    echo "<h2>{$post->post_title}</h2>";
    echo $post->post_content;
    ?>

    If the post to show is determined by some other criteria, use WP_Query class to fetch the post fitting the criteria. Examples of making the query and displaying the results can be found in the Codex.

Viewing 1 replies (of 1 total)
  • The topic ‘Sort posts by their subject’ is closed to new replies.