WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
[resolved] footer php file - messed whole site up (8 posts)

  1. skylinez17
    Member
    Posted 5 months ago #

    This is the error I get:

    Parse error: syntax error, unexpected T_FUNCTION, expecting ';' or '{' in /data/23/3/16/63/3016878/user/3349733/htdocs/wordpress/wp-content/themes/customizr/parts/class-footer-footer_main.php on line 158

    Here is the code:

    <?php
    /**
    * Footer actions
    *
    *
    * @package      Customizr
    * @subpackage   classes
    * @since        3.0
    * @author       Nicolas GUILLAUME <nicolas@themesandco.com>
    * @copyright    Copyright (c) 2013, Nicolas GUILLAUME
    * @link         http://themesandco.com/customizr
    * @license      http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    */
    
    class TC_footer_main {
    
        //Access any method or var of the class with classname::$instance -> var or method():
        static $instance;
    
        function __construct () {
    
            self::$instance =& $this;
            //html > footer actions
            add_action ( '__after_main_wrapper'		, 'get_footer');
    
            //footer actions
            add_action ( '__footer'					, array( $this , 'tc_widgets_footer' ), 10 );
            add_action ( '__footer'					, array( $this , 'tc_colophon_display' ), 20 );
            add_action ( '__colophon'				, array( $this , 'tc_colophon_left_block' ), 10 );
            add_action ( '__colophon'				, array( $this , 'tc_colophon_center_block' ), 20 );
            add_action ( '__colophon'				, array( $this , 'tc_colophon_right_block' ), 30 );
        }
    
        /**
    	 * Displays the footer widgets areas
    	 *
    	 *
    	 * @package Customizr
    	 * @since Customizr 3.0.10
    	 */
        function tc_widgets_footer() {
    
        	//checks if there's at least one active widget area in footer.php.php
        	$status 					= false;
        	$footer_widgets 			= apply_filters( 'tc_footer_widgets', TC_init::$instance -> footer_widgets );
        	foreach ( $footer_widgets as $key => $area ) {
        		$status = is_active_sidebar( $key ) ? true : $status;
        	}
    		if ( !$status )
    			return;
    
    		//hack to render white color icons if skin is grey
    		$skin_class 	= ( 'grey.css' == tc__f('__get_option' , 'tc_skin') ) ? 'white-icons' : '';
    
    		ob_start();
    		?>
    			<div class="container footer-widgets <?php echo $skin_class ?>">
    				<div class="row widget-area" role="complementary">
    
    					<?php foreach ( $footer_widgets as $key => $area )  : ?>
    
    						<?php if ( is_active_sidebar( $key ) ) : ?>
    
    							<div id="<?php echo $key; ?>" class="<?php echo apply_filters( $key . '_widget_class', 'span4' ) ?>">
    								<?php dynamic_sidebar( $key ); ?>
    							</div>
    
    						<?php endif; ?>
    
    					<?php endforeach; ?>
    				</div><!-- .row.widget-area -->
    			</div><!--.footer-widgets -->
    		<?php
    		$html = ob_get_contents();
            if ($html) ob_end_clean();
            echo apply_filters( 'tc_widgets_footer', $html );
    	}//end of function
    
        /**
    	 * Displays the colophon (block below the widgets areas).
    	 *
    	 *
    	 * @package Customizr
    	 * @since Customizr 3.0.10
    	 */
        function tc_colophon_display() {
    
        	?>
        	<?php ob_start() ?>
    		 <div class="colophon">
    		 	<div class="container">
    		 		<div class="<?php echo apply_filters( 'tc_colophon_class', 'row-fluid' ) ?>">
    				    <?php
    					    //colophon blocks actions priorities
    					    //renders blocks
    					    do_action( '__colophon' );
    				    ?>
          			</div><!-- .row-fluid -->
          		</div><!-- .container -->
          	</div><!-- .colophon -->
        	<?php
        	$html = ob_get_contents();
            if ($html) ob_end_clean();
            echo apply_filters( 'tc_colophon_display', $html );
        }
    
        /**
    	 * Displays the social networks block in the footer
    	 *
    	 *
    	 * @package Customizr
    	 * @since Customizr 3.0.10
    	 */
        function tc_colophon_left_block() {
    
          	echo apply_filters(
          		'tc_colophon_left_block',
          		sprintf('<div class="%1$s">%2$s</div>',
          			apply_filters( 'tc_colophon_left_block_class', 'span4 social-block pull-left' ),
          			0 != tc__f( '__get_option', 'tc_social_in_footer') ? tc__f( '__get_socials' ) : ''
          		)
          	);
        }
    
        /**
    	 * Footer Credits call back functions
    	 * Can be filtered using the $site_credits, $tc_credits parameters
    	 *
    	 *
    	 * @package Customizr
    	 * @since Customizr 3.0.6
    	 */
        function tc_colophon_center_block() {
    
        	echo apply_filters(
        		'tc_credits_display',
        		sprintf('<div class="%1$s">%2$s</div>',
    	    		apply_filters( 'tc_colophon_center_block_class', 'span4 credits' ),
    	    		sprintf( '<p> &middot; &copy; %1$s <a href="%2$s" title="%3$s" rel="bookmark">%3$s</a> &middot; Designed by %4$s &middot;</p>',
    					    esc_attr( date( 'Y' ) ),
    					    esc_url( home_url() ),
    					    esc_attr(get_bloginfo()),
    					    '<a href="'.TC_WEBSITE.'">Themes & Co</a>'
    				)
        		)
        	);
        }
    
        /**
    	 * Displays the back to top block
    	 *
    	 *
    	 * @package Customizr
    	 * @since Customizr 3.0.10
    	 */
    	function tc_colophon_right_block() {
        	echo apply_filters(
        		'tc_colophon_right_block',
        		sprintf('<div class="%1$s"><p class="pull-right"><a class="back-to-top" href="#">%2$s</a></p></div>',
        			apply_filters( 'tc_colophon_right_block_class', 'span4 backtop' ),
        			__( 'Back to top' , 'customizr' )
        		)
        	);
    	}
    
     }//end of class

    The theme I am using is Customizr, and the file is - class-footer-footer_main.php

    I attempted to remove "Designed by Themes & Co", and royally messed up.

    Help?

  2. ElectricFeet
    Member
    Posted 5 months ago #

    A lesson in why not to modify theme files.

    Take a backup (I use Backup WordPress and like it). Deactivate the theme (activate another). Delete it. Then reinstall it. Everything should be back to normal.

    Then use this snippet to alter the footer credits.

  3. Adrian Houle
    Member
    Posted 5 months ago #

    Was only able to approximatly guess were line 158 is by copying it into my editor and looking around that number.

    I noticed that the last line }//end of class may be the problem. Unless //end of class is some kind of function I dont know about, they ment to use an html comment/*` and used a C++ comment instead. Pretty sure double slash is not a valid comment but I could be wrong.

  4. skylinez17
    Member
    Posted 5 months ago #

    ElectricFeet - I know now that I should of first made a child theme - but PHP is something I plan on learning in the future - and messing something up only brings about the opportunity to learn more. I try to view everything as an opportunity. I'm just starting out on my journey of web development.

    I came across that snippet while researching before editing, and thought I understood enough to go in and do it myself (I was def very wrong!)

    However, I cannot go anywhere else on my WordPress dashboard without receiving that error message. The only solution I see so far is to remove wordpress from the server and reinstall it, then import my database/xml files back into it.

    I would rather just find where the mistake is. According to my counting, this is where line 158 starts

    echo apply_filters(
        		'tc_credits_display',
        		sprintf('<div class="%1$s">%2$s</div>',
  5. Adrian Houle
    Member
    Posted 5 months ago #

    I don't see anything wrong with it. What did you actulay changed?

    No need to reinstall wordpress. Worse case you need to deleate the theme and reinstall it. Is it just the footer.php you messed with? Just download the theme onto your computer, open up the files, find footter.php, copy the code and replace it with the fotter.php code on you hosting.

  6. Adrian Houle
    Member
    Posted 5 months ago #

    But, a point to note. Anything you do to the parent theme will be overwritten when the theme updates, so even if you find it good practice, you will loose record of your practice.

    I studied php at codeacademy.com and then made a page that allowed you to login for my first project. (used the mySQL database too)

  7. ElectricFeet
    Member
    Posted 5 months ago #

    You don't need to reinstall. Simply use ftp to rename the customizr theme folder to customizr-old or something. WP will revert to one of the twentysomethings, depending on your WP version. You can then log back in a take it from there.

  8. skylinez17
    Member
    Posted 5 months ago #

    Thank you!

    Adrian - I reviewed that code snippet and changed the HTML to what I wanted it to say, the footer did not change so I removed what I thought was the section related to that specific information. That messed things up badly - so I downloaded the customizr theme to my computer and copied the class-footer-footer_main.php file. I then erased what was in the live file, and replaced it with the code from the customizr download. I thought that would fix it but it didn't do anything but tell me there was an error on a different line :(

    CodeAcademy is what's up! I am studying there to!

    ElectricFeet - using FTP worked :) thank you!

    Thanks to both of you for your time in helping me along in my journey!

Reply

You must log in to post.

About this Theme

About this Topic

Tags