WordPress.org

Ready to get started?Download WordPress

Forums

Add separate blog page (16 posts)

  1. elbalazo
    Member
    Posted 4 years ago #

    Hi, can anyone point me to a good tutorial on creating a blog page in a WP site where the other pages are static?
    I'm working on this: http://journeywithdrjill.com/
    As you can see, I was able to get far enough to make the pages all static, but now I want to make a blog page for the site, and I am totally lost.
    Thanks.

  2. Len
    Member
    Posted 4 years ago #

    Hi elbalazo,

    I'm assuming this theme you built includes a standard theme file like index.php?

  3. elbalazo
    Member
    Posted 4 years ago #

    yes it does.
    I tried duplicating it and renaming it blog.php, but it is a template I made myself and it is stripped of code for posts. I have been trying to modify the Default theme into a template that can be used as the blog for my current theme.

  4. Len
    Member
    Posted 4 years ago #

    Okay, now keeping in mind what the Codex says about creating Page Templates, you can create a new Page Template and call it blog.php

    At the very top you will need to insert this ...

    <?php
    /*
    Template Name: Blog
    */
    ?>

    Now, in the Add Page screen, write a new page, call it whatever you want (Blog) and select blog.php from the drop down menu. This will assign your newly created blog.php template file to the newly created Blog page.

    For this to work, you must have the code for generating posts present in blog.php (The Loop)

  5. elbalazo
    Member
    Posted 4 years ago #

    So I need to incorporate the Loop code into the blog.php file to make it work? I don't need to worry about assigning the posts to the blog page?

  6. elbalazo
    Member
    Posted 4 years ago #

    Also, what about creating a .php file for comments?

  7. Len
    Member
    Posted 4 years ago #

    Once blog.php contains the necessary code (The Loop) for displaying posts it will do just that.

    Most themes have an index.php file which automatically acts as a site's home page. Therefore it will output that site's posts. However, if you are using blog.php, with a Static Page, whenever someone clicks on the page called Blog (which uses the blog.php file) THAT page will output the posts. Have a look at Template File Hierarchy.

    If you wish to display comments then yes you will need a comments.php file for that AND call that file in blog.php if that is where you want them displayed.

  8. elbalazo
    Member
    Posted 4 years ago #

    Well I'm stumped. Here is what I have so far:
    http://journeywithdrjill.com/?page_id=90

    It displays the author, time, category etc., but no title and no post body. Also, the little header that says "blog" should be the page title.

    Any thoughts?

  9. Len
    Member
    Posted 4 years ago #

    All I see is "Woops... Sorry, no posts we're found."

  10. elbalazo
    Member
    Posted 4 years ago #

  11. shadowgerm
    Member
    Posted 4 years ago #

    not to threadcrap, but do you think WP 3.0 will make all this easier?

    I feel its a very important option

  12. Len
    Member
    Posted 4 years ago #

    @elbalazo

    I see progress. More specifically ...

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec volutpat, nunc sollicitudin rutrum tempor, urna libero pretium quam, sed viverra libero metus ac urna. Vestibulum ultricies mi vel mi fringilla tristique. Aenean lobortis consequat elit non (moreā€¦)

    Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

  13. Len
    Member
    Posted 4 years ago #

    @shadowgerm

    That would be nice but the way it is now is not terribly difficult. (using Page Templates) :)

  14. elbalazo
    Member
    Posted 4 years ago #

    So as I was saying, I am able to get the time/date/author stamp and category link to appear on the previous page, but none of the post title or any content.
    Also, it there anything special that is supposed to go into the header that would allow the post to be shown? I built this template very simply from scratch.

    If I were to publish the page temporarily and show you what I am talking about, would that help?

  15. Len
    Member
    Posted 4 years ago #

    If I were to publish the page temporarily and show you what I am talking about, would that help?

    Sure, I'll be floating around for awhile.

  16. elbalazo
    Member
    Posted 4 years ago #

    Thanks.
    Take a look at this:
    http://journeywithdrjill.com/blog-2/

Topic Closed

This topic has been closed to new replies.

About this Topic