Forums

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

Home Forums Back End Loop Help, beyond basic.

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #32955
    JoeBass
    Member

    I am making a site for a buddy, tcstarlight.com, nothing fancy yet. So far the posts are in 2 columns in order going from left to right. Now he wants the newest post to show up above the 2 column posts area and take up the same width as the 2 column posts area. I know how to do the css and html but to grab just the newest post, would a loop just be placed in?

    #74608
    Luminated
    Member

    I would do this by running a Loop that would be limited to showpost of 1 and sorted by Date, Descending. Or:








    The reset_query is to ensure it won’t intefere with the other running loop on the same page.

    #74176
    JoeBass
    Member

    That worked perfect! Thank you Luminated! Where did you learn how to do this?

    #74153
    Luminated
    Member

    Awesome, glad it worked!

    Um, mostly by searching online for what I want and referencing the WordPress Codex, such as:

    http://codex.wordpress.org/Function_Reference/query_posts

    But if you really want to understand WordPress’ core engine, you should really get a solid understanding of The Loop:

    http://codex.wordpress.org/The_Loop

    I think that will open a great many doors for you in finding out how to get WordPress to display the information/posts in the way you want.

    #74143
    JoeBass
    Member

    Thanks for the info. I recently received the Digging into WordPress book and is a nice tool to have. Any chance you could help with how to get this just to perform this action on the first page only?

    #74138
    Luminated
    Member

    Can you post your entire page template?

    #74131
    JoeBass
    Member

    I must be placing all of this in the wrong location. A tutorial from nettuts had this all placed in the index.php, is that right? Definitely know i need some work with WP but didnt think i was that bad. For future purposes, what is the best way to past a chunk of code? U r dealing with a total noob here and I greatly appreciate your patience and help.










    I am not sure what you are searching for?







    #73823
    Luminated
    Member

    Well, the index.php is just one template you can use. You can also create seperate loops and templates for other pages to display data differently. Have you investigated Templates at all?

    http://codex.wordpress.org/Theme_Development

    Scroll down to “Custom Page Templates”

    #73731
    JoeBass
    Member

    Yeah, actually just found info on that the other day. Very interesting and will be a better solution than what i have been doing, putting code in the page box within the admin area.

    #73476
    JoeBass
    Member

    I cannot find out how you link a template to a page. It must be easy. I have my template, for example, page for contact but when I delete the contents form the page and drop it into the template, nothing shows up.

    #73477
    TheDoc
    Member

    If it’s a custom template (eg. contact.php), you’ll need to add this to the top of the template:

    Then, on your Contact page in the backend you’ll be able to select your new template from a dropdown on the right sidebar.

    #79768
    JoeBass
    Member

    Worked perfect! Thank you for your help TheDoc! Maybe you can help me with something. the code towards the top that was plugged in to retrieve only the first post needs to only perform this loop on the first page. How would this loop be excluded from all the other pages?

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