Post Excerpt Official Code Giving Fatal Php error

Community Forums Forums Design Tips and Tricks Post Excerpt Official Code Giving Fatal Php error

This topic is: not resolved

This topic contains 9 replies, has 4 voices, and was last updated by  Susan 1 year, 6 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #29647

    mohsin
    Participant
    Post count: 8

    Hi,

    I wanted to change the “[Read More...]” text ….

    From this page:

    http://my.studiopress.com/snippets/post-excerpts/

    I used this filter…


    ** Modify the Genesis content limit read more link */
    add_filter( 'get_the_content_more_link', 'custom_read_more_link' );
    function custom_read_more_link() {
    return '... [Continue Reading]';
    }

    But this filter gives PHP error…
    What could be the issue?
    I could solve this by remove read more and adding my own read more text…
    but i thought i should post here as this is official code which may need some fix to make it work with latest GENESIS ?
    or i am missing something?

    Thanks for your support and time in advance. :)

    Mohsin

    #29651

    braddalton
    Participant
    Post count: 10263

    You have modified the code incorrectly.

    Can you link to your site please.


    #29663

    mohsin
    Participant
    Post count: 8

    Hi Brad,

    Thanks for your reply. Sorry site is not live yet.

    I have not modified the code. I am using the code as it is from this page:

    http://my.studiopress.com/snippets/post-excerpts/

    Still giving me error!

    Parse error: syntax error, unexpected T_STRING

    #29667

    braddalton
    Participant
    Post count: 10263

    What theme are you using and where did you paste the code?

    Are you referring to this code?
    [php]
    /** Modify the WordPress read more link */
    add_filter( ‘the_content_more_link’, ‘custom_read_more_link’ );
    function custom_read_more_link() {
    return ‘<a class="more-link" href="’ . get_permalink() . ‘">[Continue Reading]</a>’;
    }
    [/php]


    #30708

    mohsin
    Participant
    Post count: 8

    Hi Brad,

    Thanks for your response. Sorry for the delayed response. I am Using Minimum theme and i putting this code in functions file.

    No, not that code, but the code behind that block, means second block…

    /** Modify the Genesis content limit read more link */
    add_filter( 'get_the_content_more_link', 'custom_read_more_link' );
    function custom_read_more_link() {
    return '... [Continue Reading]';
    }

    #30828

    braddalton
    Participant
    Post count: 10263
    #33651

    WoodlandCoyote
    Participant
    Post count: 171

    I just submitted a help ticket for this same problem.

    I pasted the code from the Code Snippets page into my child functions file. My dashboard turned white, as did my website. No error codes, but clearly there’s an error.

    All I did was remove the brackets on this: [Continue reading]

    I wanted to resurrect this thread and will post back when support responds to my ticket with a solution. I can’t access my website at all. I’m guessing the fix will involve accessing the child functions file via FTP, but I’ve only ever used Cpanel and have no clue how to do that.

    I mentioned in the ticket that there needs to be instructions on how to use this code.

    #33678

    Susan
    Moderator
    Post count: 9292

    CeeKing – it’s not recommended that you “resurrect” a thread – you are less likely to have someone catch it as an update, as it doesn’t show as a new thread.

    To access your site via FTP, use these instructions by Nick The Geek . If you are only familiar with doing it by Cpanel, you can still fix the error by uploading a fresh PHP file, and replacing the one currently in your theme folder.

     


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    #33756

    WoodlandCoyote
    Participant
    Post count: 171

    Thanks, Susan. Other forums really jump on people when new threads are started for topics that have been recently addressed. But I’m glad to know that I can just start a new one here. I wasn’t posting here for help, but just wanted to follow up and offer a solution once I learned how to fix this problem.

    Support sent me that same link you gave me. It was very straight forward. I downloaded FileZilla for free, logged in to my Synthesis account and obtained my FTP username, password, and domain, and was up and running quickly. It was easy finding the child file, so I deleted the code in functions.php that caused the problem, uploaded it, and the problem was fixed.

    But I feel that the Code Snippet page needs to provide some instructions. Like the OP, I simply pasted the code into the file, and suddenly my entire dashboard and website shut down. The changes I made weren’t the cause of the problem, so it may be a matter of where I pasted the code. PHP is very finicky.

    Hopefully this will help someone who searches for some help and finds this thread. I came here for help, but found an incomplete thread.

    #33768

    Susan
    Moderator
    Post count: 9292

    Thanks, CeeKing for posting back. The reason we ask people to start another thread is because it’s a community forum, there may be a number of people looking for threads to help people, and we search for “Threads with No Reply”, so if someone adds a new question or update to an existing thread, it might be missed.

    In many cases with valid code snippets, the issue with how people copy and paste the code  - ‘ (quotation marks) for example, have a nasty habit of turning from straight to “curly” without anyone noticing, and that can be a BIG issue.

     

     


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.