Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Latest Blog Post On Homepage?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30492
    chrisburton
    Participant

    I have a WordPress Homepage and a Blog Page. Somehow I would like to have the latest/most recent blog post to be on the homepage. I tried googling and inserting a few php codes but none seemed to work.

    Anyone know of a quick tutorial or solution to this?

    #67813
    Johnnyb
    Member

    You could just use query_posts within that if statement at the start of your loop, or you could use a custom loop for index.php and use it in there:

    
    
    		
    	
    #67814
    Johnnyb
    Member

    By the way I really recommend chris’s book diggin into wordpress, it explains this in there. The PDF copy is only $27 and well worth it if you’re considering using wordpress on a regular basis.

    #67824
    Johnnyb
    Member

    I always prefer the second option, someone else might be able to advise you better on a way to achieve it using the first way though. One option could be to pull the latest post using RSS, although there may be a better way.

    #67835
    Jerm993
    Member

    ahh, what you need to do is the query posts as Johnny suggested and create a separate page for your homepage and your blog, page-slug.php, slug being the title of the page, created in wp admin, then have your index be a basic loop, with links to header and footers as index.php is mainly a fallback if there isn’t any other pages for them to use, so if there isn’t a single.php, or a page.php, they fall back to index.php. check out template hierarchy here:
    http://codex.wordpress.org/Template_Hierarchy

    #67855
    Jerm993
    Member

    that works also^^

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.