[Resolved] Problem with wp_footer tag

Home Forums Support [Resolved] Problem with wp_footer tag

Home Forums Support Problem with wp_footer tag

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #118777
    Juergen B.

    Hello Tom,

    after setting up responsive lightbox and slickrflickr carefully and activating the footer.php in my child theme, I get this error on some (not all) pages:

    Parse error: syntax error, unexpected ‘<‘ in /www/htdocs/w0121d8c/theshell/wp-content/themes/GeneratePress_Senioren/footer.php on line 129

    It occurs on http://www.wirsindhaan.de/termine/ right down at the end, almost unseen (dark grey typo on background image).
    I don’t know what’s wrong. On line 129 it says: <?php wp_footer(); ?>

    I’ll put here the complete footer.php:

    <?php
    /**
     * modified footer, if needed.
     * @package Generate
     */
    ?>
    
    	</div><!-- #content -->
    </div><!-- #page -->
    <?php do_action('generate_before_footer'); ?>
    <div <?php generate_footer_class(); ?>>
    	<?php 
    	do_action('generate_before_footer_content');
    	global $post;
    	$generate_settings = wp_parse_args( 
    		get_option( 'generate_settings', array() ), 
    		generate_get_defaults() 
    	);
    	$stored_meta = '';
    	if ( isset( $post ) ) :
    		$stored_meta = get_post_meta( $post->ID, '_generate-footer-widget-meta', true );
    	endif;
    	
    	// Don't run the function unless we're on a page it applies to
    	if ( ! is_singular() ) :
    		$stored_meta = '';
    	endif;
    	
    	if ( '' !== $stored_meta && false !== $stored_meta ) :
    		$generate_settings['footer_widget_setting'] = $stored_meta;
    	endif;
    	
    	if ( !empty( $generate_settings['footer_widget_setting'] ) && 0 !== $generate_settings['footer_widget_setting'] ) : 
    		$widget_width = '';
    		if ( $generate_settings['footer_widget_setting'] == 1 ) $widget_width = '100';
    		if ( $generate_settings['footer_widget_setting'] == 2 ) $widget_width = '50';
    		if ( $generate_settings['footer_widget_setting'] == 3 ) $widget_width = '33';
    		if ( $generate_settings['footer_widget_setting'] == 4 ) $widget_width = '25';
    		if ( $generate_settings['footer_widget_setting'] == 5 ) $widget_width = '20';
    		?>
    		<div id="footer-widgets" class="site footer-widgets">
    			<div class="inside-footer-widgets grid-container grid-parent">
    				<?php if ( $generate_settings['footer_widget_setting'] >= 1 ) : ?>
    					<div class="footer-widget-1 grid-parent grid-<?php echo $widget_width; ?>">
    						<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-1')): ?>
    							<aside class="widget inner-padding widget_text">
    								<h4 class="widget-title"><?php _e('Footer Widget 1','generate');?></h4>			
    								<div class="textwidget">
    									<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 1.','generate');?></p>
    									<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    								</div>
    							</aside>
    						<?php endif; ?>
    					</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 2 ) : ?>
    				<div class="footer-widget-2 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-2')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 2','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 2.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 3 ) : ?>
    				<div class="footer-widget-3 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-3')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 3','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 3.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 4 ) : ?>
    				<div class="footer-widget-4 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-4')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 4','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 4.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 5 ) : ?>
    				<div class="footer-widget-5 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-5')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 5','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 5.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif; ?>
    			</div>
    		</div>
    	<?php
    	endif;
    	do_action('generate_after_footer_widgets');
    	?>
    	<footer class="site-info" itemtype="http://schema.org/WPFooter" itemscope="itemscope" role="contentinfo">
    		<div class="inside-site-info grid-container grid-parent">
    			<?php do_action( 'generate_credits' ); ?>
    		</div>
    	</footer><!-- .site-info -->
    	<?php do_action( 'generate_after_footer_content' ); ?>
    </div><!-- .site-footer -->
    
    <?php
       //Always have wp_footer() just before the closing </body> tag!
       //Many plugins use this hook to reference JavaScript files.
    <?php wp_footer(); ?>
    
    </body>
    </html>
    
    #118809
    Tom
    Lead Developer
    Lead Developer

    I believe this is the issue:

    <?php
       //Always have wp_footer() just before the closing </body> tag!
       //Many plugins use this hook to reference JavaScript files.
    <?php wp_footer(); ?>

    You opened PHP, then opened it again.

    It should be:

    <?php
       //Always have wp_footer() just before the closing </body> tag!
       //Many plugins use this hook to reference JavaScript files.
       wp_footer(); 
    ?>
    #118815
    Juergen B.

    Well, yes, I tried this already, but then the Lightbox doesn’t work:
    http://www.wirsindhaan.de/ein-franzoesischer-nachmittag-2/

    Maybe footer.php in the child them does not correspond with the footer.php in the main theme? But I can’ recognize the difference/bug/whatever…

    #118816
    Tom
    Lead Developer
    Lead Developer

    footer.php in the child theme will completely overwrite footer.php in the parent theme. The parent theme file will no longer be read whatsoever.

    Are you adding the lightbox script directly into the footer.php file?

    You shouldn’t have to edit any core files to get a lightbox script to work.

    #118817
    Juergen B.

    No, I think not. I just installed the responsive lightbox plugin.

    #118819
    Tom
    Lead Developer
    Lead Developer

    In that case, you shouldn’t have to touch the footer.php file unless that plugin is completely broken.

    Is it not working with the standard core footer.php file?

    #118822
    Juergen B.

    Is it not working with the standard core footer.php file?

    Nope, is it not. [sigh!] It even doesn’t work with footer_php from the test install.
    Maybe I should reinstall the responsive plugin. That will last a while.

    #118823
    Tom
    Lead Developer
    Lead Developer

    Was it updated recently? Has good reviews?

    #118841
    Juergen B.

    http://de.wordpress.org/plugins/responsive-lightbox/
    That doesn’t sound too bad, does it?

    #118909
    Tom
    Lead Developer
    Lead Developer

    Nope, looks good to me – it definitely shouldn’t require any kind of code modification.

    Were you having any specific problems with it?

    #119786
    Juergen B.

    Problem is still „on“. I have tested several footer script combinations. The result is:
    The responsive lightbox plugin seems to need the modified footerscript with this ending:

    <?php
       //Always have wp_footer() just before the closing </body> tag!
       //Many plugins use this hook to reference JavaScript files.
    <?php wp_footer(); ?>
    </body>
    

    But then on the webpage occurs:
    Parse error: syntax error, unexpected ‘<‘ in /www/htdocs/w0121d8c/theshell/wp-content/themes/GeneratePress_Senioren/footer.php on line 129

    If I delete one <?php – or the hole modified footer.php script from the child theme – lightbox doesn’t work. It sounds silly, but it is defintily so.

    So how do get rid of this parse error thing?

    #119787
    Tom
    Lead Developer
    Lead Developer
    #119804
    Juergen B.

    Hi Tom,

    believe me, I tried this

    This will fix the parse error: http://generatepress.com/forums/topic/problem-with-wp_footer-tag/#post-118809

    several times (at the end of the footer.php in the child theme): It simply doesn’t do the trick. It just shuts off the lightbox function.
    *sigh*

    #119826
    Juergen B.

    What I just noticed:
    The normal footer script works fine on my testinstallation, but doesn’t work in teh real installation with the modified script.
    Does it make sense, if I would send you both scripts by email so that you could check what is wrong? If that isn’t too much…
    %-(

    #119890
    Tom
    Lead Developer
    Lead Developer

    Hmm, it just doesn’t make much sense to me – the custom footer.php file you’re adding is almost identical to the core one.

    The core footer.php file includes the wp_footer() function (it’s required to). The plugin should work right away on activation without having to do any modifications to any files.

    You can definitely send me the scripts – it would be best if you added them to a site like this and sent me the links: http://pastebin.com/

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.