• I am using
    echo do_shortcode('[yasr_overall_rating size="medium"]');
    to show ratings in a single page, everything works fine.

    I also need to view the ratings in a googlemap popup (Pronamic plugin).
    I am able to output in the popup everything I need from the post except for the ratings.

    This is the code to customize the popup in my functions.php:

    function prefix_pgmm_item($itemContent) {
    	$itemContent = '';
    	$itemContent .= '	<a href="'. get_permalink() .'">';
    	$itemContent .= '		'. get_the_title();
    	$itemContent .= '	</a>';
    	$itemContent .= wpautop(get_post_meta(get_the_ID(), '_pronamic_google_maps_address', true));
    	global $post;
    	$MYvar = do_shortcode( '[yasr_overall_rating]' );
    	$itemContent .= $MYvar;
    
    	return $itemContent;
    }
    add_filter('pronamic_google_maps_mashup_item', 'prefix_pgmm_item');

    $MYvar doesn’t show anything.
    Any idea?

    https://www.ads-software.com/plugins/yet-another-stars-rating/

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter Troglos

    (@troglos)

    Just wrote you an email, thanks.

    I am having this exact same issue actually.
    I need to be able to add it into my custom loop but echo do_shortcode is not working with any of the shortcodes. So I was trying to call the function direct, and did an echo shortcode_overall_rating_callback($atts) with still nothing showing.

    If you have a fix for this, or a way to insert direct with a function as opposed to a shortcode I will gladly pay for the pro version for multi sites!

    So far this plugin is awesome and has saved me a lot of time, but I need to get this one part to work.

    Plugin Contributor dudo

    (@dudo)

    Shortcode was built to work on single post or page, so if what you’ve already tried is not working, there is nothing I can suggest you, sorry!

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Shortcode in functions.php’ is closed to new replies.