Forums

how to customize the posts page to display both content and posts? (6 posts)

  1. mikedark
    Member
    Posted 2 years ago #

    I have a question about the 'front page displays' setting in the main Reading settings.

    I have set my homepage to a static page rather than to display the latest posts. So I've created another page called 'blog' and then I've set that as the posts page.

    however, when I created that page I had written a bunch of text as a description of my blog at the top of the page, but what I find is that when I set that page to display the latest posts, it doesn't display that text, only the posts.

    what I want to do is to have some introductory text at the top of the main blog page, such as "hello, and welcome to my blog. this is a blog about various things .. blah blah blah". then below the introduction is where I want the excerpts from the latest posts to be displayed.

    So is there a way to set a page where you can display normal content AND the latest posts?

  2. mikedark
    Member
    Posted 2 years ago #

    I've done some digging. I think this has something to do with page templates and that i need to build a custom page template and apply it to the page that I have set as my posts page.

    can anyone tell me if i'm on the right track here?

  3. RedElement
    Member
    Posted 2 years ago #

    I've also done some looking around and think you're correct for you particular case. It wouldn't help me and you may decide to do something similar so I'm also going to post my solution.

    I needed the page text to show in the header and didn't want to call a seperate header for the blog page so I used the following code:

    <?php if(is_blog()) : ?>
              //what I want to say on my blog
    <?php else :
          if (have_posts()) :
    	while (have_posts()) : the_post();
    	    the_content();
    	endwhile;
           endif;
    endif; ?>

    It checks to see if the user is on the blog page and shows the hard-coded text I wanted on my blog. If the user is on any other page I just display the loop to show the text I set in the admin section.

    I hope this helps.

  4. RedElement
    Member
    Posted 2 years ago #

    whoops, typed a little fast. Here is the corrected code.

    <?php if(is_home()) : ?>
              //what I want to say on my blog
    <?php else :
          if (have_posts()) :
    	while (have_posts()) : the_post();
    	    the_content();
    	endwhile;
           endif;
    endif; ?>
  5. digitalartempire
    Member
    Posted 2 years ago #

    you can type php thats way code advancement dude like th f***ing film

  6. henkholland
    Member
    Posted 2 years ago #

    You can also make a start post describing your blog and make it STICKY

Topic Closed

This topic has been closed to new replies.

About this Topic