• Resolved aecorn

    (@aecorn)


    The shortcode for the list is resolving always at the top of the content, this happens because the “favourites-template” is echoing, instead of returning.
    I hacked this by moving the template-content into the main php file, but this is not elegant. Maybe the author can fix this bug by returning the template somehow, instead of using echo.

    Function simple_print_favourites( $atts ){
    	$GLOBALS['simple_favourites_running'] = true;
    	extract( shortcode_atts( array(
            'user_id' => false
        ), $atts ) );
    	$favourites = simple_favourites::get_favourites($user_id);
    	$fav_output = "";
    	if(!empty($favourites)) :
    		$fav_list = do_shortcode('[products ids="' . implode(',', $favourites) . '" columns="4"]');
    		$fav_output = "<div id='simple_favourites_display'><h2>Your Favourites</h2>" . $fav_list . "</div>";
    	endif;
    	unset($GLOBALS['simple_favourites_running']);
    	return $fav_output;
    }
Viewing 1 replies (of 1 total)
  • Plugin Author Jon Boss

    (@jonboss)

    @aecorn,

    Thanks once again for pointing this out for me. That shortcode definitely should have been returning rather than echoing – that has been updated in v 1.4 as well. Thanks a lot for your insights.

Viewing 1 replies (of 1 total)

The topic ‘Shortcode resolving at top of content’ is closed to new replies.