• Resolved siup

    (@siup)


    Hello
    I did a php shortcode but it allways go in the beggining of the page
    exemple
    add_shortcode( 'php_shortcode', function () {
    $myVar= wp_title('');
    echo "$myVar";
    });

    when I put the shortcode in the middle of a page, the tille goes at the beginning? Solution?
    Best regards

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi @siup,

    The problem here is that you are using echo to output the shortcode contents instead of using return.

    Here’s an updated example:

    add_shortcode( 'php_shortcode', function () {
    	$myVar = wp_title( '' );
    	return $myVar;
    } );
Viewing 1 replies (of 1 total)
  • The topic ‘possible to have php shorcode in the flux of a page?’ is closed to new replies.