• Resolved brady ernst

    (@bjernst11)


    After upgrading to WordPress 4.1, my PHP code is blank on the page.
    I have a simple line that will auto-update my age by having PHP tied to my birthdate between the words: “As a (PHP generated age) year old”

    As a

    [insert_php]
    $birthDate = "1/30/1985";
    $birthDate = explode("/", $birthDate);
    $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
    ? ((date("Y") - $birthDate[2]) - 1)
    : (date("Y") - $birthDate[2]));
    echo $age;
    [/insert_php]

    year old

    Here is my page (2nd sentence): http://soapboxarchitect.com/about/

    https://wordpress.org/plugins/insert-php/

Viewing 1 replies (of 1 total)
  • Plugin Author WillBontrager

    (@willbontrager)

    I’m sorry you’re having issues with Insert PHP, Brady.

    This works for me (fresh 4.1 installation):

    As a [insert_php]
    $birthDate = "1/30/1985";
    $birthDate = explode("/", $birthDate);
    $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
    ? ((date("Y") - $birthDate[2]) - 1)
    : (date("Y") - $birthDate[2]));
    echo $age;
    [/insert_php] year old

    http://affinityseries.com/wp41/?p=4

    Verify you’re using the “Text” tab instead of the “Visual” tab in the editing area.

    If still no joy, try reinstalling Insert PHP.

    Will

Viewing 1 replies (of 1 total)
  • The topic ‘Not working after WordPress 4.1 upgrade’ is closed to new replies.