How can I remove the List Widget's title?

Home Forums Calendar Products Events Calendar PRO How can I remove the List Widget's title?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #932397
    Steve
    Participant

    Hi,
    I’ve been looking through the forums, knowledge base, customization pages, etc for a few hours now trying to figure out how I can remove the “Upcoming Events” title from the List Widget (Events Calendar Pro). Actually, not just the text, I want to remove the actual section and div around it. I’m sure I’m just missing something, but nevertheless want to ask here…

    Note, I am looking to remove/edit the actual code (Not where “Upcoming Events” is defined as part of the title variable — I was able to find that — but rather where it actually appears as part of the section class/div class widget wrapper).

    Could you please point me to the correct file to do that?

    Hopefully that was clear, happy to provide further details to clarify the question if not. Thanks!

    #932576
    Barry
    Member

    Hi Steve,

    Great question!

    The wrapper around the title is something that, ordinarily, is specified by your theme – but you can control this via various WordPress hooks:

    add_filter( 'widget_display_callback', 'modify_list_widget_title', 10, 2 );
    add_filter( 'dynamic_sidebar_params', 'modify_list_widget_wrapper' );
    
    function modify_list_widget_title( $params, $widget ) {
    	$is_regular_list  = ( 'tribe-events-list-widget' === $widget->id_base );
    	$is_advanced_list = ( 'tribe-events-adv-list-widget' === $widget->id_base );
    
    	if ( ! $is_advanced_list || ! $is_regular_list ) return;
    
    	$params['title'] = '';
    	return $params;
    }
    
    function modify_list_widget_wrapper( $widget ) {
    	if ( ! isset( $widget[0]['widget_id'] ) ) return $widget;
    
    	$is_regular_list  = ( 0 === strpos( $widget[0]['widget_id'], 'tribe-events-list-widget' ) );
    	$is_advanced_list = ( 0 === strpos( $widget[0]['widget_id'], 'tribe-events-adv-list-widget' ) );
    
    	if ( ! $is_advanced_list || ! $is_regular_list ) return $widget;
    
    	$widget[0]['before_title'] = '';
    	$widget[0]['after_title'] = '';
    
    	return $widget;
    }

    Does that work for you (you could place the code above within your theme’s functions.php file, for instance)?

    #932601
    Steve
    Participant

    Brian,
    Thanks for the quick reply. Unfortunately this doesn’t make any noticeable changes.

    When I view source for my site I see this code:

    <div class=”widget tribe-events-adv-list-widget”><h2 class=”widgettitle”>Upcoming Events</h2>

    Trying to figure out where that code is coming from…

    Could be from my original theme and I’m just missing it, but if it’s coming from an events calendar/events calendar pro file I would love to go in and edit directly.

    #932623
    Steve
    Participant

    Ok, I actually just changed the title to null in adv list widget class, and will just mess around with the CSS styling of that widget class so am all set. Thanks again!

    #932842
    Barry
    Member

    No worries – glad you’re all set 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How can I remove the List Widget's title?’ is closed to new replies.