• I have setup my blog under the root: https://www.mydomain.co.uk/media-centre/

    I have the following channels I would like to create posts for:

    • News
    • Research
    • Press
    • Article of the Month
    • Newsletters
    • Events

    I have setup 6 categories using these headings and also 6 coresponding static pages. I have then tried to limit certain categories to certain pages using the following code in page.php:

    <?php
    		if (is_page('news')) {
    			query_posts('cat=3');
    		} elseif (is_page('research')) {
    			query_posts('cat=4');
    		} elseif (is_page('press')) {
    			query_posts('cat=5');
    		} elseif (is_page('article-of-the-month')) {
    			query_posts('cat=6');
    		} elseif (is_page('newsletters')) {
    			query_posts('cat=7');
    		} elseif (is_page('events')) {
    			query_posts('cat=8');
    		}
    ?>

    Firstly, is this a good method of setting up my structure? Or should I just do away with static pages and use categories on their own?

    The reason I used static pages was so that I could easily add some text above each category post loop. e.g. In the news static page I added the text

    “In this section we let you know what’s new – press stories based on our findings, competition winners, major new projects we’re launching…”

    in the back-end. Unfortunaltely when I navigate to the news page, this text is not displayed and all I see are posts which are in the news category. I think I am close, but just can’t quite seem to get what I am after.

    Cheers

Viewing 1 replies (of 1 total)
  • You need to put code to display the current page ahead of the code you posted above. The template should have something like this in it before the category queries:

    <?php
    if (have_posts()): the_post();
       echo '<div>';
       the_content();
       echo '</div>';
    endif;
    ?>

    Also, you will probably want to include pagination in your queries unless you intend to show all posts on one screen.

Viewing 1 replies (of 1 total)
  • The topic ‘Unsure of what category structure to use’ is closed to new replies.