< ?php the_time('F jS, Y') ?>
Here’s what I would like to do:
On the left hand side of my home page to have a list of my 5 latest posts that would have the category of Blog and in the centre to have a list of my 3 latest posts with the category of Portfolio. Both sections would be styled differently and would take visitors to two separate sections of the site – Blog and Porfolio – which would look very different from one another.
I have had a look around the web for this but most of the searches that show for multi loops seem to deal with having a featured post displaying different from the posts below.
Is what I am wanting to do possible? I am fairly new to WordPress and my knowledge of PHP is very, very limited.
Thanks for any help.
Maybe my understanding of the loop is not very clear. I tried doing that but my page didn’t show anything apart from some error message. Probably didn’t specify category properly.
An extra issue is that I am not wanting to use index.php as my home page, so I need to have a Blog index page and another index page for Portfolio.
With my limited knowledge I may be biting off more than I can chew.
< ?php the_time('F jS, Y') ?>
Thanks for the help so far. I have made some progress on a (very badly designed) http://www.bazzasblog.co.uk.
As you can see the home page displays two loops – one for Blog and the other for Portfolio. I have managed to edit the code on the index.php so it only shows up the bolg category posts. I did this by entering <?php query_posts("category_name=blog"); ?>.
What I know need to do is create another index.php page with <?php query_posts("category_name=portfolio"); ?> inserted. Obviously this isn’t going to be that simple as I can’t create another page.
What do I do? Can I create index2.php? If so, how do I point the Portfolio entries to that page? And how do I get these entries to show up on my Portfolio ‘page’?
Thanks again for your help. And Chris thanks for all your tutorials and screencasts – they have taught me so much.
You should try to give the file name a little more importance, something like "static-home.php" or "home-page.php", something like that. "index2.php" could be confusing later on, especially with index.php kicking around.
That is the proper way to do it, unless you are going to reuse that template page though, I’d suggest naming it something like portfolio.php to better keep track of things as you go. Index2.php is not very descriptive. Also, when you declare the template name, you should name it something cohesive live "Portfolio" or "portfolio-template"
As far as the query_posts code though, I ran in to a situation where when the Page was not the index page, it would not respect the read more links, but just show the entire post. (You may experience this) I never bothered to fix it… Just a heads up as far as that goes.
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".