I've created a custom template ('newshome') to display news posts on a page of a site 'myurl/news'. The 'newshome' template is just category.php with:
<?php query_posts("posts_per_page=5") ?>
at the start to display recent news stories. Before the page displays these news blog posts though, I'd like to be able to have a static introductory paragraph at the top of the page which would be edited from the dashboard for the news page. I thought that just placing
<?php the_content(); ?>
in the appropriate place would do the trick, but it doesn't. I figured this from looking at page.php and this is the only php code that seems to drag in the user created content.
In the theme I'm using this is immediately followed by:
<?php get_template_part( 'loop', 'category' ); ?>
so, from reading around in the codex a bit, I figure that this is part of my issue? i.e the call to the_content function needs to be inside the loop but the loop is contained in another file (loop.php)?
If that's correct, how might I crowbar the_content into place? Any thoughts greatly appreciated!
If your wanting to use the content you set in the page itself then using the_content() after the query_posts() function won't work as it has declared a new loop which overwrites the old one, to overcome this simply put the_content() before the query_posts() function which will allow it to return the page content while the original loop is still active.
This topic is now archived. It is frozen and cannot be changed in any way.