Forums

using wp strings in page i.e. $user_identity (2 posts)

  1. Pato1
    Member
    Posted 4 months ago #

    Firs off, the site is hosted on Hostgator and I am using the Exec-PHP plugin to allow me to add <?php ?> within posts/pages which works like a charm.

    I have been trying to add a string variable used in the header to my page. The following is a very simplified version.

    <?php
    if( $user_identity ) echo 'Welcome back';
    else echo 'Welcome guest, please enjoy your stay';
    ?>

    I am only receiving the else function because wp is stripping out the string variables. Which I found out by doing this...

    <?php echo $user_identity;?>

    there is no result but the same string can be found right next to 'howdy'.

    My question, how can I extend the use for the wp string variables beyond the header?

  2. alchymyth
    The Sweeper
    Posted 4 months ago #

    you might need to set the variables to 'global'

    http://php.net/manual/en/language.variables.scope.php

Reply

You must log in to post.

About this Topic