• Resolved ufopsi

    (@ufopsi)


    Hi, is there a way to embed the filters via shortcode? I am using Visual Composer, therefore not the standard Blog page. A shortcode’d do just fine.

    Thanks.
    M

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    Hi,

    No unfortunately there is no shortcode. I was planning on adding it but I’m not sure when there will be time. Also, with Gutenberg coming soon shortcodes will become more and more deprecated 🙂

    But you could create your own shortcode for it..
    Just add this to your functions.php

    
    function btf_shortcode( ) {
    ob_start();
    do_action( 'show_beautiful_filters' );
    return ob_get_clean();
    }
    add_shortcode( 'custom_btf', 'btf_shortcode' );
    

    and use [custom_btf] in VC

    Thread Starter ufopsi

    (@ufopsi)

    Hi, thanks for the tip. Sadly, it does not work for me. Nothing shows up.

    Plugin Author Jonathandejong

    (@jonathandejong)

    Ah, if you’re not using it on a post type archive you’d also have to specify the post type slug as a second parameter:
    do_action( 'show_beautiful_filters', 'mycptslug' );

    Thread Starter ufopsi

    (@ufopsi)

    Thank you! If I’m using on a page? I have tried with ‘page’ and ‘vendite’ (specific page) without success.

    Best regards.
    M

    • This reply was modified 8 years, 5 months ago by ufopsi.
    Plugin Author Jonathandejong

    (@jonathandejong)

    You specify the custom post type slug. Not the post type of where you want the filter to appear.

    So if you want to filter a post type called “movies” on a page you place this on that page:
    do_action( 'show_beautiful_filters', 'movies' );

    if you want it to appear specifically on a page you should put a conditional inside the page.php in your theme.

    Like:

    if ( is_page( 'vendite' ) {
    here it goes.
    }
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Embed via Visual Composer/shortcode’ is closed to new replies.