WordPress.org

Forums

Site down: I'm getting a Parse error: syntax error, unexpected ' (8 posts)

  1. Bird is the Worm
    Member
    Posted 2 years ago #

    The exact error message is this:

    Parse error: syntax error, unexpected '<' in /home/bobbo123/notesfromtheholler.com/wp-content/themes/mistylook/functions.php on line 295

    Unfortunately, I can't print the code because I am unable to do anything on my site without getting that error message.

    I've seen other threads with a similar problem, and they all seem to indicate that the site was hacked. While I can't summarily dismiss that possibility, it's important to mention that I was in my functions.php file trying to add custom taxonomies just before this problem began. Just before that, I added a couple plugins, though these were plugins that I use successfully on another site, so I'm thinking it's nothing malicious that came from them.

    I've got a call into the person who hosts my site, and I'm hoping he'll have some suggestions on what to do. I'm also hoping someone here might provide some guidance.

    I'm a self-hosted site, using the MistyLook theme.

    Thanks in advance.

    EDIT: Just saw in another thread a suggestion to use an FTP site to send my site a new functions.php file. I already have Filezilla on my site and am relatively familiar with it via another site I participate on. Is this the direction I need to take?

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

  3. Bird is the Worm
    Member
    Posted 2 years ago #

    Hi, Seacoast Web Design.

    I'm sorry, but I don't understand what your link is supposed to be telling me.

    I appreciate your time, though.

    Cheers.

  4. Yes, use FTP to upload a new functions.php file. See Filezilla and FTP Clients « WordPress Codex. You don't - at this point - have the issue that Seacoast points to.

  5. Bird is the Worm
    Member
    Posted 2 years ago #

    Okay, so what I wound up doing was copying a new version of my functions.php file onto my site via Filezilla.

    I now get a new error message. I'll post that error message, plus the code that it relates to, plus some more info that I've picked up.

    Error Message:

    Fatal error: Call to undefined function mistylook_get_author_posts_link() in /home/dssjazz/notesfromtheholler.com/wp-content/themes/mistylook/index.php on line 8

    The Code from my Index.php file:

    <?php get_header();?>
    <div id="content">
    <div id="content-main">
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    				<div class="posttitle">
    			<h2><a>" rel="bookmark" title="<?php printf(__('Permanent Link to %s','mistylook'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
    				<p class="postmetadata"><?php the_time(get_option("date_format")); ?> <?php printf(__('by %s','mistylook'), mistylook_get_author_posts_link()); ?> <?php edit_post_link(__('Edit','mistylook'), ' | ', ' '); ?> </p>
    				</div>
    
    				<div class="entry">
    					<?php the_content(__('Continue Reading »','mistylook')); ?>
    					<?php wp_link_pages(); ?>
    				</div>
    
    				<p class="post-info"><?php printf(__('Posted in %s','mistylook'), get_the_category_list(', ')); ?> | <?php the_tags( __('Tagged','mistylook').' ', ', ', ' | ' ); ?><?php comments_popup_link(__('Leave a Comment »','mistylook'), __('1 Comment »','mistylook'), __('% Comments »','mistylook')); ?></p>
    				<?php comments_template(); ?>
    			</div>
    		<?php endwhile; else : ?>
    			<h2 class="center"><?php _e('Not Found','mistylook'); ?></h2>
    			<p class="center"><?php _e('Sorry, but you are looking for something that isn’t here.','mistylook'); ?></p>
    		<?php endif; ?>
    		<p align="center" class="posts-nav-link">
    			<?php posts_nav_link(' - ',__('« Newer Posts','mistylook'),__('Older Posts »','mistylook')) ?>
    		</p>
    </div><!-- end id:content-main -->
    <?php get_sidebar();?>
    <?php get_footer();?>


    More Information:

    Whereas before I FTP'd the new function.php file, I was completely unable to move around my site, now I have full access to my admin panel, etc. The only place I can't do anything is the "front of the house."

    Also, I de-activated all my widgets, to see if that did anything.

    Interestingly, a preview of my site under a different theme, like "Contempt," actually showed my posts as they should. However, a preview of my site under current theme "Mistylook" gave me just the above error message.

    All of my content (ie, Posts) exist on my site, which I can view through the admin panel. I just can't see them on the Main Site Page.

    Questions:

    1. Is there something in that above code that I need to edit, some sort of simple syntax that would fix it?
    2. Would there be any use in temporarily switching my theme to "Contempt," then deleting current theme "Mistylook" off my admin panel, then re-installing it and switching back to it from "Contempt"?
    3. Is there code in a different php file that I need to tweak, perhaps, which is causing the above error message to occur?

    Thanks for your help. I do appreciate it.

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still - use the pastebin. As it stands, your code may now have been permanently dmaged/corrupted by the forum's parser.]

  6. Bird is the Worm
    Member
    Posted 2 years ago #

    Oh, hi, Songdogtech!

    We cross-posted. Before coming back on board, I did exactly that... replace the functions.php file with a fresh one. I then received the error message as per my post above.

    I think I'm pretty close to the solution. I'm especially curious to see if my option #2 under Questions might be a good solution.

    Cheers.

  7. Bird is the Worm
    Member
    Posted 2 years ago #

    Sorry about that, mod. I should've known better on that one, for sure.

    Here's the code, and using the code function, just in case it got messed up above...

    <?php get_header();?>
    <div id="content">
    <div id="content-main">
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    				<div class="posttitle">
    			<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s','mistylook'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
    				<p class="postmetadata"><?php the_time(get_option("date_format")); ?> <?php printf(__('by %s','mistylook'), mistylook_get_author_posts_link()); ?> <?php edit_post_link(__('Edit','mistylook'), ' | ', ' '); ?> </p>
    				</div>
    
    				<div class="entry">
    					<?php the_content(__('Continue Reading &raquo;','mistylook')); ?>
    					<?php wp_link_pages(); ?>
    				</div>
    
    				<p class="post-info"><?php printf(__('Posted in %s','mistylook'), get_the_category_list(', ')); ?> | <?php the_tags( __('Tagged','mistylook').' ', ', ', ' | ' ); ?><?php comments_popup_link(__('Leave a Comment »','mistylook'), __('1 Comment »','mistylook'), __('% Comments »','mistylook')); ?></p>
    				<?php comments_template(); ?>
    			</div>
    		<?php endwhile; else : ?>
    			<h2 class="center"><?php _e('Not Found','mistylook'); ?></h2>
    			<p class="center"><?php _e('Sorry, but you are looking for something that isn’t here.','mistylook'); ?></p>
    		<?php endif; ?>
    		<p align="center" class="posts-nav-link">
    			<?php posts_nav_link(' - ',__('« Newer Posts','mistylook'),__('Older Posts »','mistylook')) ?>
    		</p>
    </div><!-- end id:content-main -->
    <?php get_sidebar();?>
    <?php get_footer();?>
  8. Bird is the Worm
    Member
    Posted 2 years ago #

    Well, I fixed my site, though I'm still not sure exactly where the problem was in the code... either my first problem that caused it all to go to hell or the second one that arose from my initial fix.

    But in summary, for anyone else who has this problem in the future:

    1. I messed up my functions.php file by adding bad code, which resulted in a parse error that prevented me from doing anything on my site.
    2. I got a fresh copy of the functions.php file from the Theme creators (a simple download).
    3. I ftp'd that file onto my site, and overwrote the existing messed up one. I used Filezilla, which is very simple to download and utilize. In order to ftp the new file with Filezilla, you will require you to have the Host Address and a Password, which your host provider can give you.
    4. Overwriting my bad functions.php file with a fresh one only solved half my problems, but since it did allow me to access my admin panel again, I could look for a new solution. The FTP overwrite might solve all problems for other people; results, I'm sure, will vary.
    5. Once I determined there was some additional conflict caused by my new functions.php file and the existing other Theme files, I switched my site to an entirely new Theme (which would have all fresh files).
    6. After I switched Themes, I deleted the old bad Theme from my site. I then had the option to re-download a fresh one and switch back to it.
    7. Problem solved. I have a functioning site again.

    I hope that helps others who replicate my error.

    Cheers.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.