- This topic is empty.
-
AuthorPosts
-
June 1, 2011 at 2:57 pm #32955JoeBassMember
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?
June 1, 2011 at 3:25 pm #74608LuminatedMemberI 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.
June 4, 2011 at 11:28 pm #74176JoeBassMemberThat worked perfect! Thank you Luminated! Where did you learn how to do this?
June 5, 2011 at 1:04 pm #74153LuminatedMemberAwesome, 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.
June 5, 2011 at 3:03 pm #74143JoeBassMemberThanks 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?
June 5, 2011 at 7:18 pm #74138LuminatedMemberCan you post your entire page template?
June 6, 2011 at 12:12 am #74131JoeBassMemberI 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?
June 8, 2011 at 1:05 pm #73823LuminatedMemberWell, 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”
June 8, 2011 at 7:53 pm #73731JoeBassMemberYeah, 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.
June 10, 2011 at 1:09 pm #73476JoeBassMemberI 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.
June 10, 2011 at 1:27 pm #73477TheDocMemberIf 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.
June 14, 2011 at 2:13 pm #79768JoeBassMemberWorked 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?
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.