WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Parse error: syntax error, unexpected ';' in category php (5 posts)

  1. dorotta
    Member
    Posted 1 year ago #

    Hi guys!

    I just wanted to find out if it's possible to remove the category names from appearing from above my posts. I messed around my category php and as a result I have this error saying: Parse error: syntax error, unexpected ';' in category.php on line 28

    The line in question is the last line from this excerpt:

    <header class="page-header">
                                           <h1 class="page-title category-title"><span class="category-title-label"><?php
    						printf( __( 'Category Archives: %s','weaver-ii'), '</span><span>' . ?></h1>

    Any suggestions how this could be fixed?
    I'm using weaver ii

  2. racer x
    Member
    Posted 1 year ago #

    You certainly cut off way too much. There is an ending ")" missing in the php section. printf outputs a formatted string and we won't know exactly what the intention of the formating was without seeing the code.

    There is also a closing span tag missing (that's not part of the php error though).

    If you have a backup of the theme, check that of course. Otherwise, re-download the theme if you can?

    Future tips (yes, from captain hindsight):

    1. You have to be very careful when editing php files. Omitting one single quote or anything "simple" can cause the whole site to error.

    2. Always make a copy of the file before editing.

  3. dorotta
    Member
    Posted 1 year ago #

    I added the missing ending ")" and ";" However, it still says Parse error: syntax error, unexpected ',' in xxxxxxx/wp-content/themes/weaver-ii/category.php on line 28
    Here's the whole code in pastebin I hope that will help to sort things out.
    Man, I never ever gonna touch php again!

  4. rachelbaker
    Member
    Posted 1 year ago #

    If you are trying to remove the text for "Category Archives: $categoryname" in the h1 tag you can remove all of this code:

    <header class="page-header">
                                            <h1 class="page-title category-title"><span class="category-title-label"><?php
                                                    printf( __( 'Category Archives: %s','weaver-ii')), '</span><span>' . ( '', false ) . '</span>' ); ?></h1>
    
                                            <?php
                                                    $category_description = category_description();
                                                    if ( ! empty( $category_description ) )
                                                            echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
                                            ?>
                                    </header>
  5. dorotta
    Member
    Posted 1 year ago #

    Dear rachelbaker, thank you so sooo much! It's working again :)

Topic Closed

This topic has been closed to new replies.

About this Topic