• Resolved ___ELVIS___

    (@_elvis_)


    Hello,

    how can I have an automatic year in the footer? Unfortunately this does not work:

    <?php echo date("Y"); ?>

    • This topic was modified 7 years, 6 months ago by ___ELVIS___.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Theme Author Ben Sibley

    (@bensibley)

    That should work. Is there any error being output?

    Thread Starter ___ELVIS___

    (@_elvis_)

    No, there is no output, nothing.

    AddWeb Solution

    (@addweb-solution-pvt-ltd)

    Hello elvis,

    Try below code into your current active child theme’s functions.php file.


    add_action( 'ct_chosen_footer_text', 'custom_footer_text' );
    function custom_footer_text() {
    return date('Y');
    }

    Hope this will helps you.

    Thanks!

    Theme Author Ben Sibley

    (@bensibley)

    If the above code doesn’t help, could you share the code in your footer.php here?

    Thread Starter ___ELVIS___

    (@_elvis_)

    The code doesn′t help.

    Here fhe footer.php :

    <?php do_action( 'main_bottom' ); ?>
    </section> <!-- .main -->
    
    <?php do_action( 'after_main' ); ?>
    
    <footer id="site-footer" class="site-footer" role="contentinfo">
    	<?php do_action( 'footer_top' ); ?>
    	<div class="design-credit">
            <span>
                <?php
                $footer_text = sprintf( __( '<a href="%1$s">%2$s WordPress Theme</a> by Compete Themes.', 'chosen' ), 'https://www.competethemes.com/chosen/', wp_get_theme( get_template() ) );
                $footer_text = apply_filters( 'ct_chosen_footer_text', $footer_text );
                echo wp_kses_post( $footer_text );
                ?>
            </span>
    	</div>
    </footer>
    </div>
    </div><!-- .overflow-container -->
    
    <?php do_action( 'body_bottom' ); ?>
    
    <?php wp_footer(); ?>
    
    </body>
    </html>
    Theme Author Ben Sibley

    (@bensibley)

    Thanks!

    I’m not sure where you’d like the date included, but adding it like this will work:

    <?php do_action( 'main_bottom' ); ?>
    </section> <!-- .main -->
    
    <?php do_action( 'after_main' ); ?>
    
    <footer id="site-footer" class="site-footer" role="contentinfo">
    	<?php do_action( 'footer_top' ); ?>
    	<div class="design-credit">
            <span>
                <?php 
                echo date("Y");
                $footer_text = sprintf( __( '<a href="%1$s">%2$s WordPress Theme</a> by Compete Themes.', 'chosen' ), 'https://www.competethemes.com/chosen/', wp_get_theme( get_template() ) );
                $footer_text = apply_filters( 'ct_chosen_footer_text', $footer_text );
                echo wp_kses_post( $footer_text );
                ?>
            </span>
    	</div>
    </footer>
    </div>
    </div><!-- .overflow-container -->
    
    <?php do_action( 'body_bottom' ); ?>
    
    <?php wp_footer(); ?>
    
    </body>
    </html>
    • This reply was modified 7 years, 6 months ago by Ben Sibley. Reason: spelling
    Thread Starter ___ELVIS___

    (@_elvis_)

    perfekt, this work fine. thanks

    • This reply was modified 7 years, 6 months ago by ___ELVIS___.
    • This reply was modified 7 years, 6 months ago by ___ELVIS___.
    • This reply was modified 7 years, 6 months ago by ___ELVIS___.
    Theme Author Ben Sibley

    (@bensibley)

    Sure thing! Glad that’s working now.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Automatic year in the footer’ is closed to new replies.