Support » Plugin: Beautiful taxonomy filters » Redirect to a different archive-cpt.php for results

  • Resolved vinchoz



    Already a GIANT THANK’S for this plugin: perfect!

    I would like to know if it’s possible to redirect results in a different archive-cpt.php?

    I have a CPT “traductions” with a custom taxonomy “language”

    I manage in my archive-traductions.php to display language like this:

    – Trad 01
    – Trad 02
    – Trad 03
    – Trad 04

    With the filter on top

    I used this method:

    // now run a query for each animal family
    foreach( $terms as $term ) {
        // Define the query
        $args = array(
            'post_type' => 'animal',
            'animal_cat' => $term->slug
        $query = new WP_Query( $args );
        // output the term name in a heading tag                
        echo'<h2>' . $term->name . '</h2>';
        // output the post titles in a list
        echo '<ul>';
            // Start the Loop
            while ( $query->have_posts() ) : $query->the_post(); ?>
            <li class="animal-listing" id="post-<?php the_ID(); ?>">
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            <?php endwhile;
        echo '</ul>';
        // use reset postdata to restore orginal query
    } ?>


    Now: when a apply filter: nothing happen (because of the specific wp-query i guess)
    I would like to change this template to display the result WITHOUT the language seprator… in a different template (?)

    Has somebody an idea?
    Or a direction to explore?

    Thank’s for help



    • This topic was modified 4 years, 4 months ago by vinchoz.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jonathandejong


    Hi Vince,

    Thank you 🙂 If you find the plugin useful please leave a review so others can find it too.

    I think your best solution would be to change it so that your current view, with posts displayed based on terms, is in a page template. Since you’re already showing everything with your own queries there’s no real need for you to use the cpt archive template for this.

    That way your archive-traductions.php will be free to be used properly by BTF!
    So you can use the standard loop in the archive along with the BTF filter module.

    1. Duplicate your archive-traductions.php and rename it tpl-traductions.php
    2. Add a Template name to the top of the file
    3. Create a new page. Assign it the template.
    4. Restore the archive-traductions.php to be a “regular archive”. Basically what’s important is that you keep the loop.
    5. done!

    Thread Starter vinchoz


    … i did review your plugin …

    I did exactly what you explained but i couldn’t find where to place the filter in the page template:
    If i place it in the “foreach”: in appears for each language: normal!!
    But if i place it before: nothing append.

    Before i used an archive template… now for a page template: do i need to recreate a new loop for the filter?

    Thank’s again for taking time to answer…


    Thread Starter vinchoz


    … and i think i found the solution:

    <?php do_action( 'show_beautiful_filters', 'cpt' ); ?>

    i did forget the CPT param…

    Thank’s again

    • This reply was modified 4 years, 4 months ago by vinchoz.
    Plugin Author Jonathandejong


    Hi @vinchoz,

    Ah my bad! Didn’t check beforehand.
    Yeah, as you found out, if you do not place it in the cpt archive template you need to specify the second parameter of the post type slug.

    Glad everything worked out great for you!
    Best of luck with your project!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirect to a different archive-cpt.php for results’ is closed to new replies.