Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Its worth a second look, but it sounds like you do not have the child theme enabled. –  Douglas.Sesar Apr 8 at 22:24
1  
where the graduates_functions.php is saved? –  G. M. Apr 9 at 1:14
    
... and what is in graduates_functions.php? Is that part of your theme or the parent? –  s_ha_dum Apr 9 at 1:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.