Support » Plugin: Current Year and Copyright Shortcodes » Easy to change Shortcode names

  • I was going to write my own Shortcode to do this .. and now I don’t have to, thanks to you!

    For anyone interested, it’s very simple to alter the Shortcode names to something a bit less simplistic. All that’s needed is to edit a single file “jonradio-current-year-and-copyright-shortcodes.php” and change THREE lines as follows:

    BEFORE:  add_shortcode( 'y', 'jr_cy_y' );
    AFTER:   add_shortcode( 'jrsc_curryear', 'jr_cy_y' );
    BEFORE:  add_shortcode( 'c', 'jr_cy_c' );
    AFTER:   add_shortcode( 'jrsc_copyright', 'jr_cy_c' );
    BEFORE:  add_shortcode( 'cy', 'jr_cy_cy' );
    AFTER:   add_shortcode( 'jrsc_both', 'jr_cy_cy' );

    Once you’ve completed this change, you can use the new Shortcode names:

    jrsc_curryear   - current year
    jrsc_copyright  - copyright symbol
    jrsc_both       - copyright symbol + space + current year

    Hope this helps!

Viewing 1 replies (of 1 total)
  • Circling back on this topic, for those interested:

    (1) In the Child Theme, I edited the footer template file as follows. I’ve also requested of the theme developer to incorporate shortcode support for this template and they gratefully agreed to comply:

    Edited file: template-footer-bottom-bar.php
    Instead of: echo $copyrights;
    Changed to: echo do_shortcode( $copyrights );

    (2) Wrote a custom shortcode “custom_copyright_shortcode”, using plugin “Code Snippets“:

    function custom_copyright() {
       $date = getdate();
       return '© ' . $date['year'];
    add_shortcode(‘custom_copyright_shortcode’, ‘custom_copyright’);

    (3) Lastly, in the theme, under Branding > Copyright Text, I entered:

    [custom_copyright_shortcode] Company name, Inc.

    End result: Theme’s bottom bar now shows:

    © 2016 Company name, Inc.

    and it will automatically change each year, in sync with server date/time!

Viewing 1 replies (of 1 total)
  • The topic ‘Easy to change Shortcode names’ is closed to new replies.