• mailpop

    (@mailpop)


    Hi everibody,

    I would like to php code in a page, i try a simple:
    <?php echo "toto"; ?>

    But nothing display, i have add a template page but nothnig too …

    I don’t understand, for information my site his hosted on openshift.

    An edit page i clic on visuel near text, when i return in text mode the code was modified :
    <!--?php echo "toto"; ?-->

    Does anyone have an idea ?

    Thank’s.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Michael

    (@alchymyth)

    you will need a plugin to run php in the content of a page;
    for example https://ww.wp.xz.cn/plugins/php-everywhere/

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    but allowing PHP to be randomly dropped into a page is A Bad Idea ™

    What is it you’re trying to accomplish?

    Thread Starter mailpop

    (@mailpop)

    i have a shortcode with parameter and i would like to get the parameter in url, like this:

    http://mysite/page/?matchid=3

    Page:
    [Shortcode matchid=3]

    Thread Starter mailpop

    (@mailpop)

    Thank’s for your responses.

    With php-anywhere i have the same problem.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    OK, shortcodes are the *right way* to drop PHP into a page.

    Have you read this? https://codex.ww.wp.xz.cn/Shortcode_API

    Thread Starter mailpop

    (@mailpop)

    thank’s for your responses.

    I make a shortcode and it’s works fine.

    But shortcode in shortcode don’t work: [shortcode1 param1=[shortcode2]]
    i test other possibilities:
    [shortcode1 param1=[shortcode2][/shortocde2]]
    [shortcode1 param1='[shortcode2][/Shortcode2]’]

    Nothing good, i insert do_short in my plugin and that’s work.

    many thank’s

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    if it’s not working, please show your code

    Thread Starter mailpop

    (@mailpop)

    It’s ok you can close the thread.

    My solution was to use do_shortcode in my shortocode:

    add_shortcode('matchid', 'get_matchid');
    
    function get_matchid() {
       IF (isset($_GET['matchid'])) {
         $mid = $_GET['matchid'];
         $retour = "[fp-predictionform match=$mid]";
       } ELSE {
         $retour = "[fp-predictionform]";
       }
       return do_shortcode($retour);
    }
Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Problem with php in page’ is closed to new replies.