Question

I'm using the "Pages with category and tag" plugin because my website uses individual long pages as posts. I would like to make a gallery of the past posts (sort of like an archive section), but my theme can filter posts only by categories. I would prefer not to use categories but rather tags, since they are better suited for our content. How can I merge the categories and tags so that my theme can filter these pages using both?

Was it helpful?

Solution

If you can setup url query parameters and when user navigates to tagfillterPage page with wp_query it should work. https://examples.com/tagfillterPage/?filltertag=tagname

 $querytag = $_GET['filltertag'];
 $args = array(
 'tag' => $querytag
 );
 // Custom query.
 $query = new WP_Query( $args );

 // Check that we have query results.
 if ( $query->have_posts() ) {

 // Start looping over the query results.
 while ( $query->have_posts() ) {

    $query->the_post();

    // Contents of the queried post results go here.}

 }

 // Restore original post data.
 wp_reset_postdata();
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top