Forums

[resolved] home.php link to my blog (8 posts)

  1. watercarving
    Member
    Posted 4 years ago #

    I started using home.php because I wanted to have a static front page. I want to link to my blog from my front page and cannot figure out how to do so. Have I broken this functionality?

  2. Kafkaesqui
    Moderator
    Posted 4 years ago #

    All your archive and category links and whatnot should still work. But these days we usually recommend creating a Page (Write > Write Page) to use as your 'home' page, then assign it under Options > Reading, Front Page. Note you can set a 'Posts page' as well through this (which would behave as a normal blog front page does displaying recent posts).

  3. watercarving
    Member
    Posted 4 years ago #

    Ok. I know how to do that but I couldn't seem to customize the php like I wanted to. In my home.php I run:

    <p style="margin: 5px; float: right"><table align="right"><tr valign="top"><td><h2>Latest Articles</h2>

      <?php get_archives('postbypost', 5); ?>
    </td></tr></table></p>

    to show my latest post titles. When I paste this code into a 'page' it doesn't work. I assume this is a security feature.

    Is there a way to put php into a 'page' post without it being a security issue? If not, how can I replicate the functionality I have listed above?

    Thanks!

  4. moshu
    Member
    Posted 4 years ago #

  5. watercarving
    Member
    Posted 4 years ago #

    We're almost there. I have the homepage working from a new page template. I was able to integrate the code I wanted and I have the 'blog' assigned to a different page and that works as well.

    My only problem left is a formatting issue. If you go to http://www.johncall.com you'll see my 'Latest Articles' integrated with the home page text. However instead of being in a nice little area of it's own the text is intruding a little bit. This didn't happen before. Any ideas?

    Thanks for all the help so far!

  6. watercarving
    Member
    Posted 4 years ago #

    I just figured it out. The function <?php get_archives('postbypost', 5); ?> puts each line in a
    <li> and I didn't have the surrounding
    <ul> tags. Figured they were included.

    Thanks!

  7. moshu
    Member
    Posted 4 years ago #

    Don't post code without highlighting it and hitting the "code" quicktag!

  8. watercarving
    Member
    Posted 4 years ago #

    Will do on the "code" quicktag.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.