WordPress.org

Support

Support » Plugins and Hacks » Events Manager » [Resolved] [events_list] shortcode not working in included php sidebar

[Resolved] [events_list] shortcode not working in included php sidebar

  • Hi and apologies if this is simple user error. I’m developing a WP version of HTML site and am using the Events Manager plugin to display events lists on both the main content area of the site and also in an inner sidebar called by a php include.

    After the recent upgrade, the [events_list] shortcode does not work in the sidebar,

    see
    http://wordpress.thecoachingroom.com.au/wp/

    but does work in the main content area,
    http://wordpress.thecoachingroom.com.au/wp/nlp/

    I coped and pasted the code and they are identical.

    Any suggestions gratefully appreciated. (PS I know the site looks crazy but the colours and stuff are just help for me as the developer – I haven’t worked on the custom css too much yet – just seeing what the default twentyeleven theme generates. Working code first, pretty stuff second…)

    http://wordpress.org/extend/plugins/events-manager/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    WordPress does not parse text widgets for shortcodes by default.

    You have to add following code (your theme functions.php is a good place for that)

    add_filter(‘widget_text’, ‘do_shortcode’);

    Hope this helps

    Plugin Author Marcus

    @netweblogic

    Hi again and thanks for your responses. Thanks for the suggestions about sidebar PHP – I have used this in a widget elsewhere and it works really well.

    My bad, I used the wrong terminology. The ‘sidebar’ isn’t the wordpress sidebar, it’s another php file which is pulled in with an include. More like a div for layout, adding a column to the right of the main content area but included just after the content div on the sidebar-page template.

    <div id="primary">
    			<div id="content" role="main">
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', 'page' ); ?>
    
    					<?php comments_template( '', true ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    			</div><!-- #content -->
         <?php
    if (in_category('about')) {
    include ('ss_about.php');
    }
    
    elseif (in_category('coach-training')) {

    etc, etc,

    It was working before I recently upgraded both EM and WP, so I guess the next thing to try is reinstalling EM and see if it gets fixed up.

    Hi again,

    I have updated EM to 5.3.2.1 but the problem persists. It’s particularly frustrating because it was working to begin with 😐

    My understanding of EM is that it should be able to display using shortcode in a .php file.

    Any chance someone with more smarts than me can take a look at the grey box on the right of the content area on

    http://wordpress.thecoachingroom.com.au/wp/

    and let me know where I’m getting it wrong?

    Thanks so much

    Plugin Author Marcus

    @netweblogic

    i think what we’d need to see is in <?php get_template_part( 'content', 'page' ); ?>

    but chances are you’re not using the_content() to output your post content.

    anyways, if you wrap the output text of that grey box in a do_shortcode() then it’d parse the shortcode

    HI and thanks very much for this.

    The pages now use:

    <?php
    echo do_shortcode('[events_list_grouped mode="monthly" orderby="event_start_date" scope="future" category="118" attribute date_format="F Y"]');
    ?>

    which looks promising but I am now having problems with categories which I will post separately.

    Kind regards

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] [events_list] shortcode not working in included php sidebar’ is closed to new replies.
Skip to toolbar