0

I'm using the latest Wordpress release with the default theme.

I have a function similar to this which is included and called from within a page (using exec-PHP).

<?php function myFunc($value) {
        while () // some condition {
             echo $value;
        }
 ?>
 <?php myFunc('val'); ?>

the output of the echo function is appearing at the bottom of the page instead of appearing within the correct page content section.

How can I fix this?

1

Create a shortcode and return the content instead of echoing it out so in your functions.php file add:

function myFunc($atts,$content = null) {
    while (ture) {
       return $content;
    }
    return '';
}

add_shortcode('myfunc','myFunc');

and in your page's content instead of using exec-PHP just call your new shortcode:

[myfunc]val[/myfunc]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.