• Hi,

    I was just trying to change the post excerpt length on the homepage (I don’t want an excerpt, I want the whole article). I found a part of the code

    <?php
    function new_excerpt_length($length) {
    	return 20;
    }

    and changed it to 500 to see if the word count would increase. Now I get this problem:

    Parse error: syntax error, unexpected T_STRING in /home/deadandw/public_html/wp-content/themes/aparatus/functions.php on line 244

    Here is my functions code:

    Pastebin? https://wordpress.pastebin.com/YuEnW2VV

    How do I fix this? I tried putting the 20 value back in and refreshing but nothing worked. Also, if this gets fixed, how do I remove the post excerpt ?

    My link is https://www.Joefitzpatrick.co.uk

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • the pastebin gives you line numbers – and this is line 244:

    <td width="80%"><?php if(get_option($value['id'])){ $checked = "checked="checked""; }else{ $checked = "";} ?>

    i assume that this is not how it should look like:

    $checked = "checked="checked""; ???

    Thread Starter gorepit

    (@gorepit)

    Hi

    I’m not sure lol I haven’t touched that line at all :/

    What should it be changed to? just “checked” ?

    not sure, as i haven’t designed it – but you could try something like:

    <td width="80%"><?php if(get_option($value['id'])){ $checked = "checked"; }else{ $checked = "";} ?>

    your edit with the ‘excerpt_length’ is a few lines after the ‘error’ line – so that cannot be causing it.

    Thread Starter gorepit

    (@gorepit)

    I get this now:

    Parse error: syntax error, unexpected ‘”‘ in /home/deadandw/public_html/wp-content/themes/aparatus/functions.php on line 352

    lol ??

    can you re-paste your functons.php ?

    Thread Starter gorepit

    (@gorepit)

    https://wordpress.pastebin.com/K5gYbL6T

    ??

    Just out of interest, could I not just download the theme again and overwrite the functions.php file?

    of course you can replace the functions.php with a fresh download –

    btw:
    the error message comes from the uncontrolled usage of double quotes in strings; and if this is in the original theme, and not caused by your edits, then you may get the same error messages again.

    Thread Starter gorepit

    (@gorepit)

    I just put the new function script in, and it’s worked ??

    How do I change the amount of words which are shown in the posts on the main page? I think it’s something to do with post excerpt, but I want to show the full article or at least 200 words of an article.

    Thanks ??

    changing the number in ‘new_excerpt_length’ should work;
    and there is no reason to assume that this should cause an error in functions.php.

    if you want the full article on the main page, you could try and exchange ‘the_excerpt();’ with ‘the_content();’ in the template file that generates the main page.

    what editor are you using?

    in the unlikely event, that the error comes back, it could be possible that your editor is changing some of the code, i.e. the quotation marks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Syntax Error – Unexpected T_String’ is closed to new replies.