Support » Plugin: Allow PHP in Posts and Pages » PHP and HTML

  • depaict

    (@depaict)


    Dear Team,
    I would like to add a conditional statement in PHP in my wordpress page in order to show the following HTML on 2014:

    <div class=”ngg-albumoverview”>
    <!– List of galleries –>
    <div class=”ngg-album”>
    <div class=”ngg-albumtitle”>2014</div>
    <div class=”ngg-albumcontent”>
    <div class=”ngg-thumbnail”><img class=”Thumb” alt=”selected” src=”***” /></div>
    <div class=”ngg-description”>***</div>
    </div>
    </div>

    I downloaded the plugin then I did the following code but it didn’t work:
    [php]
    $year = 2014;
    $today = date(“Ymd”);
    $today_year = date (“Y”, mktime(0,0,0,substr($startw,4,2),substr($startw,6,2),substr($startw,0,4)));
    if ($today_year == $year) {
    [/php]
    <div class=”ngg-albumoverview”>
    <!– List of galleries –>
    <div class=”ngg-album”>
    <div class=”ngg-albumtitle”>2014</div>
    <div class=”ngg-albumcontent”>
    <div class=”ngg-thumbnail”><img class=”Thumb” alt=”selected” src=”***” /></div>
    <div class=”ngg-description”>***</div>
    </div>
    </div>
    [php]
    }
    [/php]

    I got:
    Parse error: syntax error, unexpected $end in /membri/depaict/micki/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()’d code on line 6
    and
    Parse error: syntax error, unexpected ‘}’ in /membri/depaict/micki/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()’d code on line 2

    Thanks in advance
    Regards,
    Stefania

    http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/

Viewing 1 replies (of 1 total)
  • I’ve the same problem.

    What is causing this error is this lines “[php]}[/php]”
    As I read all the PHP code must be inside 1x [php][/php] if you understand my point?

    You can’t use one php code in different “[php][/php]”

Viewing 1 replies (of 1 total)
  • The topic ‘PHP and HTML’ is closed to new replies.