• mickeline

    (@mickeline)


    Website : https://www.lescarnetsdemickeline.com
    Problem : error message
    Wordpress version : WordPress 4.9.4 avec le thème Customizr Pro.

    Hi eveyrone ??
    I follow the step on this tuto to add a four widget area on my footer :
    https://presscustomizr.com/snippet/adding-fourth-footer-widget-area/

    But …. at the end, i have this error message when i edit my function.php file :
    ( i edit the file on my wordress dashboard in apearence, edit )

    Cannot redeclare my_footer_widgets() (previously declared in wp-content/themes/customizr-pro/functions.php:49)

    I dont understand what’s wrong? Can you help me with that?

    here the text i copy/paste:

    // Adds a widget area. It gets registered automatically as part of the arra
    add_filter( 'tc_footer_widgets', 'my_footer_widgets');
    function my_footer_widgets( $default_widgets_area ) {
        $default_widgets_area['footer_four'] = array(
              'name'                 => __( 'Footer Widget Area Four' , 'customizr' ),
              'description'          => __( 'Just use it as you want !' , 'customizr' )
        );
        return $default_widgets_area;
    }
    // Style all the footer widgets so they take up the right space
    add_filter( 'footer_one_widget_class', 'my_footer_widget_class');
    add_filter( 'footer_two_widget_class', 'my_footer_widget_class');
    add_filter( 'footer_three_widget_class', 'my_footer_widget_class');
    add_filter( 'footer_four_widget_class', 'my_footer_widget_class');
    function my_footer_widget_class() {
        return 'span3';
    }
    // Adds a widget area. It gets registered automatically as part of the arra
    add_filter( 'tc_footer_widgets', 'my_footer_widgets');
    function my_footer_widgets( $default_widgets_area ) {
        $default_widgets_area['footer_four'] = array(
              'name'                 => __( 'Footer Widget Area Four' , 'customizr' ),
              'description'          => __( 'Just use it as you want !' , 'customizr' )
        );
        return $default_widgets_area;
    }
     
    // Adds a class to style footer widgets
    add_filter( 'footer_four_widget_class', 'my_footer_widget_class');
    function my_footer_widget_class() {
        return 'span12';
    }

    Thanks a lot

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi there,
    in PHP you cannot use the same name for two functions, that’s why you get that error.
    From the snippet page you linked you copied the first two snippets, and that’s fine, but you also copied the Use case 1, which should be used alternatively to the first two snippets, or, once understood the principle, amended and used in addition.
    Note: as that page states, that snippet will work only for the classical style.

    Best.

    Thread Starter mickeline

    (@mickeline)

    Oh wel, thanks a lot ??

    But no …. why this snippet just work for the cassical style?
    Where can i find the snippet for the modern style? ??

    great thansk ??

    Thread Starter mickeline

    (@mickeline)

    I put this code in my function.php

      	do_action( '__before_footer' ); ?>
      		<!-- FOOTER -->
      		<footer id="footer" class="<?php echo czr_fn__f('tc_footer_classes', '') ?>">
      		 	<?php do_action( '__footer' ); // hook of footer widget and colophon?>
    			<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("footer_quatre") ) : ?>
    <?php endif;?>
      		</footer>
        </div><!-- //#tc-page-wrapper -->
    		<?php
        do_action( '__after_page_wrap' );
    		wp_footer(); //do not remove, used by the theme and many plugins
    	  do_action( '__after_footer' ); ?>
    	</body>
    	<?php do_action( '__after_body' ); ?>
    </html>

    And this one in my footer.php :

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("footer_quatre") ) : ?>
    <?php endif;?>

    i add it inside these :

      	do_action( '__before_footer' ); ?>
      		<!-- FOOTER -->
      		<footer id="footer" class="<?php echo czr_fn__f('tc_footer_classes', '') ?>">
      		 	<?php do_action( '__footer' ); // hook of footer widget and colophon?>
    			<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("footer_quatre") ) : ?>
    <?php endif;?>
      		</footer>
        </div><!-- //#tc-page-wrapper -->
    		<?php
        do_action( '__after_page_wrap' );
    		wp_footer(); //do not remove, used by the theme and many plugins
    	  do_action( '__after_footer' ); ?>
    	</body>
    	<?php do_action( '__after_body' ); ?>
    </html>

    So, i can see the widget in my widget page but is not appear on my website ??

    • This reply was modified 7 years ago by mickeline.
    Thread Starter mickeline

    (@mickeline)

    Okay, i found one of my problem, i haven’t activate the child theme, i tought i do, but no ??

    Juste one another question : where is the footer.php in the children costomizr theme? really i don’t find it ??

    • This reply was modified 7 years ago by mickeline.
    Thread Starter mickeline

    (@mickeline)

    Hi everyone ??

    I always have this problem, impossible to add a four widget area in my footer…

    i copy paste this code in my function.php file in my children theme, but nothing appear…

    // Adds a widget area. It gets registered automatically as part of the arra
    add_filter( 'tc_footer_widgets', 'my_footer_widgets');
    function my_footer_widgets( $default_widgets_area ) {
        $default_widgets_area['footer_four'] = array(
              'name'                 => __( 'Footer Widget Area Four' , 'customizr' ),
              'description'          => __( 'Just use it as you want !' , 'customizr' )
        );
        return $default_widgets_area;
    }
    
    // Adds a class to style footer widgets
    add_filter( 'footer_four_widget_class', 'my_footer_widget_class');
    function my_footer_widget_class() {
        return 'span12';
    }

    Any help? ideas? ??

    Thread Starter mickeline

    (@mickeline)

    So, maybe with a picture it’s better to understand what i try to do…

    https://www.zupimages.net/viewer.php?id=18/12/avse.jpg

    For what it’s worth Rocco, I have been hoping we’d get these areas to put text in as a regular theme option so we can have text above and below our Featured pages.

    I hope this helps:

    Note :This snippet works only with the Classical style option

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add a four widget area not working’ is closed to new replies.