• Resolved mmtomm

    (@mmtomm)


    Hi,

    I’m using add_shortcode in the functions.php and when I use it in a page it does output in the wrong order.

    Background.
    I’m using the below function in functions.php where I read a seperate php file which only contains some html. I do this, because the content of this snippet of html does change periodically and is used in different places also outside of WP and I want to change it only in one place.

    function laden_offen_snippet() {
    	$laden_offen = file_get_contents('offen.php', false);
    	echo $laden_offen;
    }
    add_shortcode('offen', 'laden_offen_snippet');

    In the WP page where I use it there is something like this:

    <h1>Title</h1>
    [offen]
    <p>some paragraph</p>

    but the problem is that the part of [offen] appears before the Title in the output.
    May do I wrong when I use echo in the function above?
    Or any other idea, how to get on the right place?
    Thanks a lot
    Tom

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add_shortcode in functions.php output in wrong order’ is closed to new replies.