• I’m trying to add a “permalink” element to the post footer line (I’m using a theme that doesn’t have one); I succeeded in making it work, but when I go “Back” from a permalink page to the main blog home page, I get this error message instead:

    Parse error: syntax error, unexpected T_STRING in /public_html/wp-content/themes/FallingLeaves/index.php on line 16

    But when I “refresh” the error page, the regular home page reappears.
    How can I fix this?

    The code I inserted into the “index.php” file is this

    [a href=”[?php the_permalink() ?]” ]Link[/a]

    (with “<” and “>” instead of “[” and “]” which I just used here so the text wouldn’t be rendered as code).

    I’m a total newbie when it comes to all this html and php stuff, so my link-code may very well contain errors. I just want to have the word “Link” that when clicked on would link to a permalink of the post. My code as described above does that, but for some reason causes a problem when I try to go “Back” to the home page.

    The blog home page with the faulty code is here:
    https://www.dibsblog.com/

    (Try clicking on “Link” in a post footer, then go “Back” to get the error message.)

    How can I re-do the code so that I don’t get the error message? It’s probably some very minor alteration, but I can’t figure it out.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • your missing a semicolon after the closing parenthesis in the permalink tag.

    <a href="<?php the_permalink(); ?>">Link</a>

    Thread Starter dibs

    (@dibs)

    miklb: “your missing a semicolon after the closing parenthesis in the permalink tag”

    Yes, that seems to have done the trick! I tried adding the semicolon, and I can’t reproduce the error anymore.

    Thank you miklb; I knew that the error was something minor — but I never imagined it would be a single missing character!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘unexpected T_STRING in /wp-content/themes/[theme]/index.php on line XX: Why?’ is closed to new replies.