Community Forums › Forums › Archived Forums › Design Tips and Tricks › Help Please
Tagged: Parse Error, php
- This topic has 5 replies, 2 voices, and was last updated 10 years, 12 months ago by
Brad Dalton.
-
AuthorPosts
-
October 13, 2015 at 4:07 pm #168076
conroybp
MemberSee, this is why I shouldn't try 'things'
I tried to paste the code to modify the "Read More" link into my functinos php file and totally bunched my site (which SHOULD be at http://www.brianconroy.com, but now isn't!
I'm getting this message:
Parse error: syntax error, unexpected $end in /home/content/06/6907906/html/brianconroy/wp-content/themes/sixteen-nine-pro/functions.php on line 173
This was the code I pasted in:
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.//* Modify the WordPress read more link
add_filter( 'the_content_more_link', 'sp_read_more_link' );
function sp_read_more_link() {
return '[Continue Reading]';
}I didn't post the php tag
Any thoughts?
Thanks
Brian
http://www.brianconroy.comOctober 13, 2015 at 4:20 pm #168077Brad Dalton
ParticipantHello Brian
Link to the source of the code please or embed it correctly.
As it stands, the code is broken and it will break the site of anyone who copies and pastes it into their theme.
October 13, 2015 at 4:35 pm #168078conroybp
MemberHi Brad
Thanks for stepping in. I'm afraid, I'm not entirely sure what you're asking me:
The code I pasted in, I took from here - http://my.studiopress.com/snippets/post-excerpts/
It was this code:
When I pasted it in, the site crashed, so I deleted it and updated the file, but that did nothing to fix the problem.
The current functions php is now:
Does that make things sufficiently clear, or am I still not quite explaining myself correctly?
Thanks in advance
October 13, 2015 at 5:47 pm #168079Brad Dalton
ParticipantHi
Please copy the code from the view raw link at the bottom of the gist and paste it at the end of your child themes functions file using a code editor. DO NOT use the WordPress theme editor for pasting PHP code.
Why you got this error http://ccm.net/faq/3377-parse-error-syntax-error-unexpected-end
October 14, 2015 at 2:48 am #168095conroybp
MemberBrad
Thanks so much for your help, when I went into the functions php otherwise than through the WordPress Theme Editor, the offending code was still there, once I deleted it, the site came back up straight away.
Could I possibly abuse your generosity then and ask for some guidance on what could I should insert if I want to add 'read more' to the "Display Post Excerpts" on the "Content Archive" setting.
On my home page, it shows the 5 latest posts with the featured image and excerpt, and I'd like to add a clickable read more link at the end of the excerpt by default. I've seen posts talking about using the more tag rather than doing it this way, and I'll try that, but if I wanted to do it this way, what would the appropriate code be?
Thanks again for your help, much obliged
Brian
October 14, 2015 at 3:33 am #168097Brad Dalton
Participant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.