Multiple loops is indeed what you are looking for. Did you read this?
http://codex.wordpress.org/The_Loop#Multiple_Loops
Hi
I read it but I am not sure I understand it!
Plus I think I might have some confusion over the code to tag a specific post.
If I am having to use multiple loops do I have to open the loop, do something, then close the loop. Then open the loop again, do something, then close the loop again…
Thanks
Rich
Hi
The code I am using is this:
[?php if (have_posts()) : ?]
[?php while (have_posts()) : the_post(); ?]
<!– do stuff … –>
[a href=”[?php the_permalink(); ?]” id=”post-[?php the_ID(’14’); ?>”][?php the_title(); ?][/a]
[?php the_content(); ?]
[?php endwhile; ?]
I presume I need to repeat this in each div changing the post id as I go?
Thanks
Rich
P.S. I changed the < to [ so the code stays the same.
I was thinking of doing something similar a different way. A way that’s easier for me to understand, but not necessarily shorter in code. I was thinking of pulling the content from the rss feed of the blog. In my case, I want to display the first four articles from 4 different categories. I might even do it with a custom sidebar, and use widgets to manage these story blocks. I might modify the exist rss widget to display the story body along with the title etc.
If you followed my train of thought there, does it seem like something you’d be interested in doing? If so, when I get around to coding this, I’ll post details here. (not sure when I’ll get to it though).
What I’ll likely do is:
- create a new sidebar.php page and use that as my multiple story space
- duplicate and modify the rss widget to show full stories
- create and manage the widgets for the second sidebar, and specify a category in rss feeds to the same site. and have it take only the first story.
That’s the extremely short version of what I’ll do. It should be easy to have the widget pick a specific story, instead of the first one from a category, but I’ve never tried that, so I’m not sure how it would work.
Hi
Yes I would definately be interested in doing this. In the meantime I will continue to work on the above.
Thanks
Rich
Will those post IDs be constant or change dynamically?
If constant, no need for sweating: use the get-a-post plugin:
http://guff.szub.net/2005/01/27/get-a-post/
Thanks Moshu. They will be static and that looks a very simple solution. Can I use it in multiple places on the page do you know please?
Rich
As far as I remember – yes.
I may look at that code and see if it can modified to do this for my 4 different categories. Perhaps you posting that link just saved me some work.
Wow that plugin really works. Take a look at this page:
About iMedia.
The page is actually three wp pages… About Scott, About iMedia, About the company. So it now really works like a cms. It is excellent.
The code I used is this:
Remember I have substituted < for [!
[?php
require(‘./wp-blog-header.php’);
/*
Template Name: About Page Template
Description: A template for the About Page.
*/
?]
[?php get_header(); ?]
[div id=”summary”]
[div id=”intro3″ ]
[?php get_a_post(14); ?]
[h3][?php the_title(); ?][/h3]
[?php the_content(); ?]
[/div]
[br class=”clear” /]
[/div]
[div id=”contents”]
[div id=”column1″]
[?php get_a_post(15); ?]
[h3][?php the_title(); ?][/h3]
[?php the_content(); ?]
[/div]
[div id=”column2″]
[div class=”sticky”]
[div]
[?php get_a_post(13); ?]
[h3][?php the_title(); ?][/h3]
[?php the_content(); ?]
[/div]
[/div]
[/div]
[br class=”clear” /]
[/div]
[?php get_footer(); ?]
You can download the file as a zip file from:
The Zip File.
As you can see I have saved the file as a template called “about.php” and then attached this template to each of the pages mentioned above. It really was very easy to do.
Once again a HUGE thanks to Moshula and also to Kaf who produced the plugin.
Rich