• Hello:

    I have set a $url in a setup.php file that lives in my /childtheme directory. When I use the code below, it doesn’t use the $url set from my setup.php, but from the existing page. If I hardcode my original script for the button on a template level, it works fine, but I would prefer to use this method, since I would have more flexibility in adding the button to specific regions. Is there a way to include my setup.php on the plugin, so it’s pulling from the setup.php vs. echoing the current URL? Is there another suggested method?

    <div class=”button”>Ready to get started? Click Here.

    Thanks!

    https://www.ads-software.com/plugins/insert-php/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter quincyadam

    (@quincyadam)

    Forgot to put code between backticks. Here it is:

    <div class="button"><a href="[insert_php]echo $url;[/insert_php]">Ready to get started? Click Here.</a></div>

    Plugin Author WillBontrager

    (@willbontrager)

    Hi Quincy,

    As you have it now, the value of $url is null. So you end up with <a href="">Ready to get started? Click Here.</a>

    See https://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#inandofitself

    Something like this might work for you:

    <div class="button">
    [insert_php]
    include($_SERVER['DOCUMENT_ROOT'].'/childtheme/setup.php');
    echo "<a href='$url'>Ready to get started? Click Here.</a>";
    [/insert_php]
    </div>

    Will

    In my case I want to include a file it doesn’t work

    [insert_php]include(TEMPLATEPATH . "/inc-pages/main.php");[/insert_php]

    Plugin Author WillBontrager

    (@willbontrager)

    Shaz3e, start a new thread.

    And describe what it doesn’t do that you think it should or what it does that you think it shouldn’t. “It doesn’t work” tells me nothing I can work with.

    I will not support new issues on old threads.

    Will

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Require Once / Include’ is closed to new replies.