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.

Using SMOF as a backend admin and trying to include a shortcode in the text field for inclusion in the footer.

I am generaing the shortcode as

// Add Shortcode
function copyright_shortcode() {
    // Code
    return '<?php echo date("Y") ?>';
}
add_shortcode( 'copyright', 'copyright_shortcode' );

and calling the data from the SMOF options panel as so

<?php global $data; echo do_shortcode($data['footer_text']); ?>

The footer is generating the text from the field however, it is putting the shortcode data in <!-- -->.

share|improve this question
    
Can you explain this part: return '<?php echo date("Y") ?>';? Do you want the shortcode to output some PHP code? What's the output of echo $data['footer_text'];? –  birgire Dec 10 '13 at 10:18
    
I want the shortcode to show the latest date. It outputs this <!--?php echo date("Y") ?--> –  Ben Thompson Dec 10 '13 at 10:27
    
First of all, you should change it to return date("Y"); –  Krzysiek Dróżdż Dec 10 '13 at 10:34

1 Answer 1

Your shortcode function is all wrong, should be:

function copyright_shortcode() {
    return date("Y");
}
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.