WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom CORE template file? (8 posts)

  1. jvadnais
    Member
    Posted 8 years ago #

    Okay, I understand how to edit core template files (index.php, category.php, etc.) by calling custom template files (i.e.: newsidebar.php).

    My question is: Am I able to build an entirely new CORE template file? I want index.php to only show the TWO most recent entries, and then I want the user to click to blog.php to get the "full blog" experience. However, when I try to create blog.php and access it, I get a "no input file specified" error.

    Is this impossible to accomplish? Could someone point me in the right direction?

    Thanks very much

  2. moshu
    Member
    Posted 8 years ago #

    First, learn about the standard Templates.
    There is a list of template files that are recognized by WP and WP "knows" when to use them. E.g. it will know to use the single.php for what you call the "full blog" experience, but unless you write a new function... it will not know what to do with your blog.php file.
    You can always combine the basic template files with your own files that can be included with normal php includes.
    HTH

  3. jvadnais
    Member
    Posted 8 years ago #

    I'm still slightly confused on this. Maybe it would help if I explain what I'm trying to accomplish:

    When someone visits index.php, they will see a general page that displays the two most recent posts from the blog. It will have all sorts of other information which I code by hand into the index.php file.

    But then if they want to see more of the blog, I'd like them to be taken to another page (blog.php) that displays the entire blog experience (that's what I meant by "full blog," not "full blog post.")

    However, this blog.php page isn't a category page, nor an author page, etc. So I need to create a new core template. This is really simple in Movable Type (where I came from), but I can't figure out how to get it to work in WP.

    I can create the file (blog.php) with The Loop and all the template pages included, but I don't know where to put the file, and when I browse to it (inside the theme folder), I get an error.

    Maybe there's another way to accomplish what I'd like to do?

  4. moshu
    Member
    Posted 8 years ago #

    I have a friend who was rapidly kicked out by his second wife because he used to compare her all the time to his first wife... ;)
    [Sapienti sat]

    It is not easy in WP to accomplish what you want - maybe by using one of those "homepage" Plugins that allow to use a Page as a homepage and then go to the "blog". I don't use any of those, so not sure.

  5. jvadnais
    Member
    Posted 8 years ago #

    Trust me -- I love WP. I hope I can get it to work for me, but I would think this is a fairly common need for designers who want to preview their blog on the homepage with a few recent posts, while keeping the whole blog on another page.

    I guess I'll keep looking around. Thanks for your help!

    J

  6. spencerp
    Member
    Posted 8 years ago #

    You should listen to moshu about grabbing a plugin for this.. =) There is one or a couple now, one is called Home Page Control, which is being or has been implemented into the SVN version 2.1alpha1 for WordPress... Right on Ryan Boren's blog is a post about this feature:

    "A feature that just landed today allows any Page to be used as the front page in place of the usual blog page. You can display your About page as the front page and move the latest blog posts to a Blog or Journal page. Any of your Pages can be used as the front page or the blog page."

    Place to grab the plugin is here:
    http://www.ilfilosofo.com/blog/home-page-control/

    I already have the 2.1alpha1 up and tried it, and it works, PLUS, there could be ways to do what you're looking for besides just that plugin.. (Meaning, you could create a "page" and use certain codes within that page, using runPHP or something of that nature..) Correct me if I'm wrong moshu.. =D

    spencerp

  7. jvadnais
    Member
    Posted 8 years ago #

    Thanks so much for the feedback!

    I think I found a really good way to do this. I basically created a new template page called blog.php and included at the beginning:

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

    I then went and created a Page called "Blog" and used "Full Blog" as the template. I made the Page's slug "blog". So now when someone visits http://mysite.com/blog, they'll get the full blog.

    The Full Blog template page is basically an archive template, but it shows ALL posts – not just those from a specific archive period.

    Sweet.

    Thanks again for your help.

    Jordan

  8. spencerp
    Member
    Posted 8 years ago #

    Hehe, moshu's the man today lol! =) Glad to hear ya got something going...and please feel free to post back again if ya have more questions. =D

    spencerp

    I think with either lack of sleep or too much sleep, I'm just batting (0's) today lol!!

Topic Closed

This topic has been closed to new replies.

About this Topic