Create shortcode in Child Theme?

Question

I have created a child theme, and I am trying to add a shortcode to its functions.php file, by doing this:

// functions.php of child theme

<?php 

include(WP_CONTENT_DIR . '/graduates_functions.php');

?>

// graduates_functions.php

<?php

// [bartag foo="foo-value"]
function sayhi_func( $atts ) {

    extract( shortcode_atts( array(
        'graduate_type' => 'seo',
        'bar' => 'something else',
    ), $atts ) );
    echo 'test';
}

add_shortcode( 'sayhi', 'sayhi_func' );

?>

But when doing [sayhi] from a page I don’t see the echo, I see [sayhi]. It works if I add the same in the functions.php of the theme itself, not the child.

Any thoughts?

0
, Hommer Smith 4 years 2020-05-20T18:10:29-05:00 0 Answers 83 views 0

Leave an answer

Browse
Browse