WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Google Calendar, short code, hooks

[Resolved] Google Calendar, short code, hooks

  • I am attempting to display a Google Calendar using a hook. I have the calendar displayed properly in a sidebar widget. When I put the short code in a hook, it does not display. Do I need to find the actual html for this to work?

Viewing 2 replies - 1 through 2 (of 2 total)
  • There’s a filter called “do_shortcode” that is used to convert shortcodes into the actual code. It’s applied to the post content, but you can apply it to whatever you like.

    The easiest solution would be to create an additional function that applies the shortcode filter to the other one.

    function current_code() {
    echo 'I want to use [shortcodes]';
    }
    
    function shortcode_on_current_code() {
    do_shortcode( current_code() );
    }
    
    add_action('your_hook', 'shortcode_on_current_code');

    Thank you kindly, sir. I have figured it out, with your help, of course!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Google Calendar, short code, hooks’ is closed to new replies.