• Hi,
    I have two alphabetical catalogues in my site. I want one of them to be show as tabbed version, but second to be in default layout. How to achive that? I putted code:
    add_filter( 'a-z-listing-tabify', '__return_true' );
    into funcions.php but it has effect on boths.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter manx89

    (@manx89)

    Update: code above works ony when I use shortcode.
    When I use do_shortcode in page template or php snipset it is not working

    Plugin Author Dani Llewellyn

    (@diddledani)

    The filter will try to detect the usage of the short code in the loaded page. When you call do_shortcode directly you are bypassing that detection. For those instances, you can, instead of calling add_filter( 'a-z-listing-tabify', '__return_true' ); replace it with:

    add_action( 'init', 'a_z_listing_force_enqueue_tabs' );
    

    To target one specific listing to be tabbed is more difficult. You need to call the add_action or add_filter appropriately depending upon the page being created. One way to do this is to ensure you’re using a unique template in your theme for each of the pages and before the call to wp_head(); run the add_action or add_filter in the template that is applied to the specific page you want to be tabbed.

    Another method is to use the global $wp_query object to determine the page being loaded and run the add_action or add_filter when you’re sure you’re loading the relevant page to be tabbed. You would want to perform this in an action that occurs before the template is loaded, for example pre_get_posts.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to use tabs version and default wersion’ is closed to new replies.