• Resolved stoffb

    (@stoffb)


    Hi,
    Is it possible to to modify the page <title> and page <h1> depending on the result from the filter.
    I have 3 taxonomies: job_types, job_categories and job_location
    I would like depending on the search to display something like:
    <h1>”job_types selected” “job_categories selected” jobs in “job_location selected”</h1>

    Hope it makes sense and that it is feasible.
    Many thanks

Viewing 1 replies (of 1 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    Hi @stoffb

    Sure it is! But you don’t really need to do anything with BTF in particular to do so but rather work with your theme template.

    There is one BTF api function which can be useful tho and that is is_btf_filtered() which essentially returns true/false if the current page is filtered by BTF.

    So your code would look something like:

    
    <?php
    
    if( is_btf_filtered() ) {
        global $wp_query;
        $title = '';
        if ( ! empty( $wp_query->query['taxonomy1'] ) ) {
            $title .= $wp_query->query['taxonomy1'];
        }
        if ( ! empty( $wp_query->query['taxonomy2'] ) ) {
            if ( $title != '' ) {
                $title .= ' in ';
            }
            $title .= $wp_query->query['taxonomy2'];
        }
    
        echo $title;
    
    }
    

    I just wrote the above without any testing but it should be solid enough to get you started! 🙂
    Best of luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Page and’ is closed to new replies.