WordPress.org

Ready to get started?Download WordPress

Forums

How to filter per custom taxonomy on individual pages for SEO (1 post)

  1. Archie22is
    Member
    Posted 1 year ago #

    I have the following scenario. A custom post type that is used to input stores and select a state from a custom taxonomy list. This part is done, tested and tried.

    I then want to filter the stores per state (using the taxonomy slug, i.e: http://www.example.co.za/northern-state

    I have achieved this part by creating template files and creating pages and linking to them. It works but the results are not filtered on the individual pages. The code I have is as follows (Whole Loop):

    <?php //$loop = new WP_Query( array(
        $args = array(
        'post_type' => 'company_listing',
        'state' => 'northern-state'
        );
        $loop = new WP_Query($args);
    ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

    Have I gone in this the right way or not? If it is, how do I get my code to work? If I go on the individual pages, the filter does not work. All the shops are displayed as they are.

Topic Closed

This topic has been closed to new replies.

About this Topic