Support » Fixing WordPress » Unexpected T_String – Problem with if/else

  • littlethoughts



    It’s my first time using PHP – so please forgive simple syntax mistakes. I’ve been trying for some hours to get this right, but don’t seem to find a way.

    What I want: A specific permalink to a specific page. Therefore I use the “the_ID()” function to give the html unique IDs. I store them in the “$postid” variable. For the link I now want to use an if/else statement, checking the ID of the post and giving it a certain permalink if the ID is true. Here’s the code:

    9 <div id=”polaroid-<?php $postid = the_ID(); ?>”>
    10 <div class=”polaroidimage”><a href=”<?php
    11 if($postid == 668) {
    12 echo “get_permalink(127)”;
    elseif($postid == 665) {
    echo “get_permalink(75)”;
    else($postid == 661) {
    echo “get_permalink(9)”;
    ?>” title=”<?php the_title_attribute(); ?>” rel=”bookmark”>
    <?php if ( (function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail()) ) {
    echo get_the_post_thumbnail($post->ID);
    } else {
    echo main_image();
    } ?>

    The error that I get: “Parse error: syntax error, unexpected T_STRING in /var/www/web1295/html/wp-content/themes/polaroids/index.php on line 12” I’ve wrote the lines until line 12.

    If you would be so kind and help me out? Maybe have a better idea to solve the problem? I’ve been trying to google it out, but didn’t succeed.
    Thanks and love!

Viewing 1 replies (of 1 total)
  • Moderator keesiemeijer


    Try changing this:

    else($postid == 661) {

    to this:

    elseif($postid == 661) {

Viewing 1 replies (of 1 total)
  • The topic ‘Unexpected T_String – Problem with if/else’ is closed to new replies.