Before you ask please READ THIS

Enable Shortcodes Not Working?

edited November 2018 in Rife Posts: 87
Hi

Ive added this to my functions for a shortcode but its not working..does your theme support this code? Thanks Tested on other WP themes no issue
  /* shortcode for the current year */
function year_shortcode() {
	$year = date('Y');
	return $year;
}
add_shortcode('year', 'year_shortcode');
Im just seeing the shortcode instead othe current year

localdev so no live site
Post edited by Air on

Comments

  • AirAir
    Posts: 9,797
    Hey :-)
    MyMetta said: does your theme support this code?
    This has nothing to do with theme, so if code is good it will work.


    MyMetta said: Ive added this to my functions for a shortcode but its not working..does your theme support this code?
    I have tested your code and it works fine for me.

    1. Do you use a child theme and is it the active theme?
    2. Can you post a screenshot of where you have added this code?
    3. Where do you try to use shortcode? Not every place parses shortcodes.

    With kind regards.
  • Hi - Late reply!

    This code is in functions - im using your child theme

    * Add here your functions below, and overwrite native theme functions
    */
    /* shortcode for the current year */
    function year_shortcode() {
    $year = date('Y');
    return $year;
    }
    add_shortcode('year', 'year_shortcode');

    I am trying to use the year shortcode in the bottom footer bar via customize footer

    Made with Metta · © [year] Powered by xxx

    All I can see is the [year] echoed back

    Thanks
  • AirAir
    Posts: 9,797
    I am afraid that this part of the theme doesn't support shortcodes.

    Try this :
    Go to rife\advance\utilities\footer.php line ~195 and change
    $ft = $apollo13framework_a13->get_option( 'footer_text' );
    to
    $ft = do_shortcode($apollo13framework_a13->get_option( 'footer_text' ) );

    Should do the trick.

    With kind regards.
  • hi thanks that works
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!