- This topic is empty.
October 25, 2011 at 4:04 am #34901
I am merging my website with wordpress for the first time and I ran into a problem with the loop. For starters I don’t know much when it comes to php. So When I first looked at the loop I didn’t understand it at all. Thankfully I have Digging into WordPress and that helped me a little. I think I understand the basics of the loop but now I need to customize it to my site. Enough late night rambling, this is what I need.
I need the first three posts to appear and be shortened for easy viewing. At the bottom of my post I will provide the link to my site with a hard-html’d example of what I want.
I haven’t touched the original loop for the index.php file used by Cris’s default BLANK theme.
Which is this:
Posted in |
Here is the link to my site:
I haven’t finished the complete design of my site yet but the general idea for the loop I need should be there. Thanks so much for your help. :D
Josh PrattOctober 25, 2011 at 11:10 am #89613TheDocMember
Someone may disagree with me on this… but… the index.php file shouldn’t really be used for your home page. It should be used as the generic fallback for any situation that might not have a proper template.
I prefer using either home.php or frontpage.php for the home page. The difference between them is home.php will be used automatically (just like page.php or single.php) whereas the frontpage.php template is required if you specify a PAGE to be your home page (Settings > Reading).
Now, as for limiting your output to only three posts, you’ll need to use a function called ‘query_posts’. It’s uses can become extremely advanced once you get to know it, but yours will be quite simple!
October 25, 2011 at 11:11 am #89614TheDocMember
And if you only want the excerpt, just replace the_content with the_excerpt.October 26, 2011 at 10:11 am #89677
Thanks so much. I’m also going to look in to not using the index.html file as my home page.October 27, 2011 at 1:31 am #89731
I have 3 more problems now that I can’t seem to figure out. First I need to put a h2 of News above the first post but not on the second two. If I put it with them it adds it to all 3. Next I have my div’s with left and right margins. But with the three posts I can have only left or right. There might be a better way to fix the over all code or is there a way to customize the three posts so the third one will have a left margin and the first and second will have right margins.
Finally, and I am guessing this one will be the simplest thing to fix, I would like to have a read more link after each post.
The link to the page should be the same, and here is the snip-it of my code. I still haven’t switched it over but I am planning on taking this off my index.php page. The part of code that is put as a note is the old static code for the comments.
Welcome to SDA Missions; I am currently databasing all the mission opportunities I can find. With the help of God we can reach the whole world.
Our goal is to give opportunities to people wanting to serve. We also want to give each missions an equal opportunity to be shown. We are working to find all the current missions running and place them in an accessible list. We want to match what is needed to someone who has that skillet. Our goal is to uncover the people giving away their time and effort and make it easier for them to get help support and prayer.
Help from Home
Read Pray Share
We know that for some people it isn't possible to leave home. We are busy people and we live in a demanding world. That doesn't mean you can't help out others in need. One of the best ways you can support all these missions and missionaries is by prayer. Read more and find out how you can reach out from home.
Thanks again for the help. :DOctober 27, 2011 at 5:31 pm #89791October 29, 2011 at 1:58 am #89879
Thanks dhechler for responding. I tried that and unfortunately it doesn’t work. The h2 “news” is specific to the blogroll id. The h3 and h5 are also drawing styles from the blogroll id as well. I could make a new div with a new id and just match it to the blogroll’s styles but that seems messy to me.
I am hoping there is another way to do it. I will keep on testing different ways but any ideas are welcome and very helpfull. :D
- The forum ‘Back End’ is closed to new topics and replies.