This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Custom Footer Dates

  • Creator
    Topic
  • #3393
    jphipps
    Participant

    Would like to have the copyright notice be updated automatically. For instance (c) 2005 – 2013 where 2013 is calculated. Have previously used the following in the functions.php file (woo themes):

    add_shortcode( ‘jphipps_year’, ‘jphipps_shortcode_display_year’ );
    function jphipps_shortcode_display_year () { return date( ‘Y’ ); } // End jphipps_shortcode_display_year()

    Then I can call it in the footer customization – Copyright © 2011 – [jphipps_year] – etc.

    Not clear as to how to duplicate this on the Alyeska Theme.

    Any help? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #3425
    Jason Bobich
    Keymaster

    Hello,

    This is not possible through the options of the theme, and this will be a customization you’d need to make to the theme.

    add_shortcode( ‘jphipps_year’, ‘jphipps_shortcode_display_year’ );
    function jphipps_shortcode_display_year () { return date( ‘Y’ ); } // End jphipps_shortcode_display_year()

    The copyright text option does not accept shortcodes, so this obviously won’t work.

    Instead, from your Child theme’s functions.php, you could just hook in your own custom function that displays the copyright info however you want.

    http://pastie.org/5974906

    /**
     * Custom footer content displaying the 
     * current year dynamically. 
     */
    function my_footer_sub_content_default() {
    	?>
    	<div id="footer_sub_content">
    		<div class="container">
    			<div class="content">
    				<div class="copyright">
    					<span class="text">&copy;&lt;?php echo date('Y'); ?&gt; Your Copyright text.</span>
    					<span class="menu">&lt;?php wp_nav_menu( array( 'menu_id' => 'footer-menu', 'container' => '', 'fallback_cb' => '', 'theme_location' => 'footer', 'depth' => 1 ) ); ?&gt;</span>
    				</div><!-- .copyright (end) -->
    				<div class="clear"></div>
    			</div><!-- .content (end) -->
    		</div><!-- .container (end) -->
    	</div><!-- .footer_sub_content (end) -->
    	&lt;?php
    }
    remove_action( 'themeblvd_footer_sub_content', 'alyeska_footer_sub_content_default' );
    add_action( 'themeblvd_footer_sub_content', 'my_footer_sub_content_default' );

    http://dev.themeblvd.com/tutorial/actions/

    http://dev.themeblvd.com/tutorial/primary-framework-action-hooks/

    #3663
    jphipps
    Participant

    When I setup the function file as above in the child theme, the theme does not load.

    the complete functions.php is:

    <?php
    /*———————————————————————————–*/
    /* Run Theme Blvd Framework
    /*
    /* Below is the file needed to load the parent theme and theme framework.
    /* It’s included with require_once().
    /*
    /* If you’re creating a child theme, this line needs to be at the top of your
    /* child theme’s functions.php. By doing this you’re overriding the file being
    /* included here.
    /*———————————————————————————–*/

    require_once ( get_template_directory() . ‘/framework/themeblvd.php’ );

    <?php

    /**
    * Custom footer content displaying the
    * current year dynamically.
    */
    function my_footer_sub_content_default() {
    ?>

    ©<?php echo date(‘Y’); ?> Your Copyright text.
    <?php wp_nav_menu( array( ‘menu_id’ => ‘footer-menu’, ‘container’ => ”, ‘fallback_cb’ => ”, ‘theme_location’ => ‘footer’, ‘depth’ => 1 ) ); ?>




    <?php
    }
    remove_action( ‘themeblvd_footer_sub_content’, ‘alyeska_footer_sub_content_default’ );
    add_action( ‘themeblvd_footer_sub_content’, ‘my_footer_sub_content_default’ );

    THanks.

    #3672
    Jason Bobich
    Keymaster

    Remove the opening PHP tag &lt;?php you’ve placed just after:

    require_once ( get_template_directory() . '/framework/themeblvd.php' );

    … I realize your’e copying from the pastie I linked to above. When people post a snippet, it’s customary to write the opening PHP tag so it’s clear what language we’re dealing with. But in your case, if you’re incorporating your own PHP modifications you need to be aware of where you’re stopping and starting PHP in your file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.