Viewing 6 replies - 1 through 6 (of 6 total)
  • That seems odd – are they certainly the same sidebar? (you can have one sidebar for one page, and different for another).

    The query for the events is done here in the source. You could try var_dump($query) to see what the $query array actually holds….

    If that looks ok, then the next step is to check the SQL query. If this is the culprit, it could be another plug-in that is altering the query.

    Thread Starter Serafín Danessa

    (@sdanessa)

    The sidebar is the same.

    I’ve tried deactivating all plugins, without success, but changing the theme the widget works fine, so the thing is the theme.

    Also, inspecting a little deeper, at the end of function eo_get_events, i’ve add this dumps:
    if($query_array){
    var_dump($query_array);
    $events=get_posts($query_array);
    var_dump($events);
    return $events;
    }

    The first ($query_array) is the same for both pages, but the second one($events) is different, so get_posts is acting different for those pages…

    Any ideas?

    Thanks!

    Seems like the theme is filtering the query on the category pages in such a way that means no posts are returned… (maybe it filters the query to restrict by category on those pages).

    If the template being used is the plug-in provided one then the theme might being doing it in their sidebar template or in functions.php. Which theme is it?

    Thread Starter Serafín Danessa

    (@sdanessa)

    This is the function that fucked up everything. I’ve commented by the moment, and it’s working OK, but yo know how to fix it in the proper way?
    Thanks!!

    add_filter('pre_get_posts', 'query_post_type');
    function query_post_type($query) {
      if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
        $post_type = get_query_var('post_type');
    	if($post_type)
    	    $post_type = $post_type;
    	else
    	    $post_type = array('post','slider','clients','portfolio','nav_menu_item');
        $query->set('post_type',$post_type);
    	return $query;
        }
    }
    Stephen Harris

    (@stephenh1988)

    Well its an odd function. I would say the theme author is doing something very wrong. This will filter (almost) every query on category or tag pages. And it seems it is likely to change the post type to ‘post’ in the query for all queries on that page. Hence you’re not getting any ‘event’ results.

    I wouldn’t be surprised if this messed up other post type widgets you might have and depending on how $query->query_vars['suppress_filters'] is set it could even effect the navigation menu.

    In short – the proper way to fix this is probably to comment it out.

    Thread Starter Serafín Danessa

    (@sdanessa)

    Yes, the theme in general sucks.

    Thanks for the help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Event Organiser] List event widget isn't showing events on category sidebar’ is closed to new replies.