• Problem is that the_ratigs() jumps outside <div id=”wpratings”>

    function wpratings( $atts, $content = null ) {
        return '<div id="wpratings"><b>Rating: </b>' . the_ratings() . '</div>';
    }
    add_shortcode("wpratings", "wpratings");

    Shortcode output example:

    5.00 <<< this is output of the_ratings()
    Here is the post content
    Rating: <<< this is place of <div id="wpratings">

Viewing 3 replies - 1 through 3 (of 3 total)
  • very likely caused by the function the_ratings() which probably echos the output;

    where does that function come from?
    if it is from a plugin, which plugin?
    does the plugin provide a way (with an alternative function of with parameters) to return the output?

    Thread Starter molinam

    (@molinam)

    I solved problem with that, now I have problem that, this function pulls excerpt(start of the post entry….:S

    function wpratings( $atts, $content = null ) {
        return '<div id="wpratings"><b>Rating: </b>' . do_shortcode('[ratings]') . '</div>';
    }
    add_shortcode("wpratings", "wpratings");
    Thread Starter molinam

    (@molinam)

    function wpratings( $atts, $content = null ) {
        return '<div id="wpratings"><b>Rating: </b>' . do_shortcode('[raw][ratings][/raw]') . '</div>';
    }
    add_shortcode("wpratings", "wpratings");

    :p

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode return jumps outside div in wordpress’ is closed to new replies.