WordPress.org

Support

Support » How-To and Troubleshooting » Keep getting ‘Parse error. syntax error’. Please help!

Keep getting ‘Parse error. syntax error’. Please help!

  • scheherezadeh
    Member

    @scheherezadeh

    Hi, I’m a total beginner when it comes to things like this so thank you for bearing with me. I’m setting up a blog and I found some code on a WordPress tutorial that would remove the […] at the end of my excerpts. I found the code on this and it was as follows:

    function new_excerpt_more($more) {
    	return '[.....]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    I pasted this directly before the last ?> in the functions.php file in my Theme Editor and it gave me the following error:

    Parse error: syntax error, unexpected ‘>’ in /hermes/bosweb/web144/b1443/ipg.sashasadjadycom/blog/wp-content/themes/natural-essence/functions.php on line 39

    So I went back, deleted what I’d pasted and then updated the file. However from then I keep getting the same error when trying to access my WordPress account or when I visit my site. I can’t bring up any of the pages, I keep getting that message! What’s going on? And is there anyway to fix it if I can’t get past the error page?

    I’d really really appreciate any help!

Viewing 1 replies (of 1 total)
  • Hi scheherezadeh,

    Sounds like you followed the correct approach. These sorts of bugs happen all the time – some small bit of code has probably just been misplaced somehow.

    Do you think you could paste all the code from your functions.php file here? Then I can help spot the bug.

    By the way, the code you are using will not remove the […] at the end of your excerpts – Rather, it will add more dots! The code to remove it completely would be:

    function new_excerpt_more($more) {
    	return '';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    Best wishes,
    Andy

Viewing 1 replies (of 1 total)
  • The topic ‘Keep getting ‘Parse error. syntax error’. Please help!’ is closed to new replies.