WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Displaying articles on a web page matching a 1 category (3 posts)

  1. Damien15
    Member
    Posted 1 year ago #

    Hi I am running a website and we added a blog for news, events as well as for a few article that we write.

    On our website we have a event page, past events, news and past news. I have created match categories on my blog.

    On the web page I using this code to display matching articles

    <?php query_posts($query_string . '&cat=-1,-2,-3,-4,-5'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    However if an article is listed in more than one category the above code does not work if I want to display articles in category 6 but they also listed in category 2 for example.

    Is there anyway around this please?

  2. Damien15
    Member
    Posted 1 year ago #

    thanks

  3. Damien15
    Member
    Posted 1 year ago #

    worked it out just removed the -number and pub the number of the catagory

Topic Closed

This topic has been closed to new replies.

About this Topic