• Hi, I would really appreciate any help. Please keep in consideration , I am new to wordpress and relatively new to php as well.
    So I am developing a website where I created my own custom template. I hardcoded the header, navigation and footer and the navigation is comprised on your typical set (Home, About, Media, News, Contact)
    I want the main stories posts to display on the homepage, then I want certain posts to display in each of the pages. e.g. I have dynamic boxes in each of the pages that displays 2-3 main stories posts. Obviously I want all the “stories/news” posts to display in the news page as well. So you can see that posts will have multiple categories and I might want to post them in different pages of the website.
    For example, I tried using different categories for different posts and created a php file (news.php) which i set as a template for the new page I added through wordpress called “news” and in the news.php I used the standard loop that you get in the codex.

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    as well as it includes these line where I assumed I’d insert the Post’s category name and it will be able to generate the content afterwards.

    <?php if ( in_category(‘news’) ) { ?>
    <div id=”main-stories-text”>
    <?php } else { ?>
    <div class=”post”>
    <?php } ?>

    1st issue, everything I posted showed up in the index and nothing in the news page itself.
    I read somewhere that I am supposed to add “custom field” and write the value of the category there, but to no avail.

    Can someone please lead me in the right direction and tell me where to start fixing this problem?

    Much appreciated!

    Thanks,
    Amal

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Different posts to display in different pages’ is closed to new replies.