• dianabyron

    (@diannetrussell)


    On Twenty Twelve theme. Got a child theme. Trying to change something in functions.php, and have been on forums getting help, but none of the code people have given works – I always get a parse error about “unexpected T_string” on line whatever, even when my helpers have checked their code and say it’s right. I’ve been trawling through the code schools and wordpress codex and the forums just trying to find out SIMPLY what is a T_string?

    I can’t find and correct an unexpected T_string if I don’t even know what it is.
    Can someone please explain what it is, very simply?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator t-p

    (@t-p)

    Try:
    – switching to the default theme by renaming your current theme’s folder inside wp-content/themes and adding “-old” to the end of the folder name using FTP or whatever file management application your host provides.
    resetting the plugins folder by FTP or phpMyAdmin.

    Thread Starter dianabyron

    (@diannetrussell)

    I don’t understand why you are saying that.
    I deleted the faulty functions.php file out of my child theme and the site is fine, but I just can’t code the thing that I want to do.
    What I want to do is get my homepage post excerpts to be longer than the current setting before they go to […] Read More.
    This is the code I was given for the child functions.php, but it keeps giving parse errors – UNEXPECTED T_STRING ON LINE 13:

    1.	<?php
    	2.	function twentytwelvechild_custom_excerpt_length( $length ) {
    	3.		return 100;
    	4.	}
    	5.	add_filter( 'excerpt_length', 'twentytwelvechild_custom_excerpt_length', 100 );
    	6.
    	7.	function twentytwelvechild_new_excerpt_more($more) {
    	8.	       global $post;
    	9.		return ' <a href="'. get_permalink($post->ID) . '">Read the rest...</a>';
    	10.	}
    	11.	add_filter('excerpt_more', 'twentytwelvechild_new_excerpt_more');
    	12.
    	13.	?>

    And why would I want to reset the plugins folder?

    wprock

    (@wprock)

    looks like code is ok

    Thread Starter dianabyron

    (@diannetrussell)

    Is the code OK as is, I mean, this is the entire functions.php content in the child theme. Does it need anything else in order to work in conjunction with the parent theme?

    wprock

    (@wprock)

    Try this one

    <?php
    function twentytwelvechild_custom_excerpt_length( $length ) {
      return 100;
    }
    add_filter( 'excerpt_length', 'twentytwelvechild_custom_excerpt_length');
    
    function twentytwelvechild_new_excerpt_more($more) {
     global $post;
     return ' <a href="'. get_permalink($post->ID) . '">Read the rest...</a>';
    }
    
    add_filter('excerpt_more', 'twentytwelvechild_new_excerpt_more');
    ?>
    Thread Starter dianabyron

    (@diannetrussell)

    Tried it.
    Parse error: syntax error, unexpected T_STRING in /home/diann/public_html/wp-content/themes/twentytwelve-child/functions.php on line 13

    No-one can see anything wrong, but it just doesn’t work. I’m back to just the parent functions.php for now. But I really do want to make the post excerpts longer!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘what is a T_string?’ is closed to new replies.