Support » Plugin: annasta Woocommerce Product Filters » Problems with “Secondary Title” plugin

  • Resolved frvncesko

    (@frvncesko)


    Hi, the annasta plugin is great and almost everything works perfectly. The only thing that doesn’t work, is when i want to show products with a different price range or category, after i change price or category, the secondary title disappears until i refresh the web page again. How can i fix this and prevent the secondary title to disappear? Thanks in advance. Link of the plugin used: https://wordpress.org/plugins/secondary-title/

    • This topic was modified 1 month, 3 weeks ago by frvncesko.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author annastaa

    (@annastaa)

    Hello Frvncesko,

    We have looked into the Secondary Title conflict with our filters reported by you, and it certainly does not work in AJAX mode: line 213 of Secondary Title’s v2.0.8 hooks.php file (secondary_title_auto_show function) blocks out any is_admin() call, which (due to the nature of WordPress AJAX calls) simultaneously blocks out any AJAX call as well. If you wish, you can contact the Secondary Title developers to see if they are interested in introducing AJAX support.

    As for now, there are only 2 things that you can do to get your secondary titles working:

    1. Set your filters preset to URL filters Filtering style
    2. If you badly need the AJAX mode, and have a child theme activated on your site, you can try introducing a temporary fix by adding something like this to functions.php:

    if( is_ajax() ) {
    	if( function_exists( 'get_secondary_title' ) ) {
    		add_filter( 'the_title', function( $title ) {
    			
    			global $post;
    			$secondary_title = get_secondary_title();
    
    			if ( ! $secondary_title || get_option( "secondary_title_auto_show" ) === "off" || $title !== wptexturize( $post->post_title ) ) {
    				return $title;
    			}
    		
    			/** Apply title format */
    			$format = str_replace(
    				'"',
    				"'",
    				stripslashes( get_option( "secondary_title_title_format" ) )
    			);
    		
    			$title = str_replace(
    				"%title%",
    				$title,
    				$format
    			);
    		
    			$title = str_replace(
    				"%secondary_title%",
    				html_entity_decode( $secondary_title ),
    				$title
    			);
    		
    			return $title;
    		} );
    	}
    }

    The above code has been drafted based on the contents of the secondary_title_auto_show function, and though may work indefinitely, comes with all sorts of disclaimers!

    Thread Starter frvncesko

    (@frvncesko)

    Hello devs, I’ve added the following code to the functions.php file of my child theme, and worked perfectly as i wanted! I am extremely grateful to you all for the fast and effective support regarding my case. I am more than happy to change my review from 3 stars to 5 stars as promised. You can close this topic, thanks again. Cheers!

    • This reply was modified 1 month, 3 weeks ago by frvncesko.
    Plugin Author annastaa

    (@annastaa)

    Hello Frvncesko,

    Thank you so much for the feedback, it’s great to hear that the proposed fix has resolved the Secondary Title issue!

    I will mark this thread as resolved, but before I do, please let me also thank you for supporting the further plugin development with your 5-star review!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.