• Resolved jesa29

    (@jesa29)


    Hi!
    I’m trying to add some blocks via shortcodes.

    First, I’ve added to category description (all is OK):

    
    add_filter( 'term_description', 'filter_function_name_386', 10, 4 );
    function filter_function_name_386( $value, $term_id, $taxonomy, $context ){
    	// filter...
    
    	return $value .= do_shortcode( '[the_ad id="1681"]' ); 
    }
    

    After that I tried to do the same for tags, but it fails:

    
    add_filter( 'post_tag_description', 'filter_function_name_385', 10, 4 );
    function filter_function_name_385( $value){
    	// filter...
    
            //shortcode returns an empty string here
    	$aaa = do_shortcode( '[the_ad id="1681"]');
    
    	return $value. $aaa . 'ttt';
    }
    

    So do_shortcode returns an empty string here, how can I fix it? Thanks

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

    (@webzunft)

    Hi jesa29,

    thanks for reaching out.

    Please verify that the second filter is working without Advanced Ads involved. E.g., you could give $aaa some static value and see if that works. I believe it could be an issue with the function in general and not the shortcode per se.

    If returning a static string on the correct place works when please remove any conditions you might have set for the particular ad.

    Thanks,
    Thomas

    Thread Starter jesa29

    (@jesa29)

    Removing all stuff like Clearfix and type Adsense Ad helped, thnx

    Plugin Author Thomas Maier

    (@webzunft)

    Thanks for your feedback. I am happy to read that it works now.

    Best regards,
    Thomas

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode error’ is closed to new replies.