Support

Home Forums Event Espresso Premium Event Espresso Upcoming Events Widget – Title Problem

Event Espresso Upcoming Events Widget – Title Problem

Posted: October 29, 2015 at 3:38 pm


jeff nickel

October 29, 2015 at 3:38 pm

Not sure if this is a theme issue, or plugin issue, but on my Upcoming Events widget, the HREF code is visible in front of the Widget Title.

See example here:

Any ideas?

Thanks!


jeff nickel

October 29, 2015 at 3:39 pm

Not sure why I can’t edit my forum post, but please see link here: http://adrc.wpengine.com/?page_id=3073


Josh

  • Support Staff

October 29, 2015 at 5:09 pm

Hi Jeff,

It looks like your active WordPress theme is filtering all of the widget titles, and wraps each widget title in a set of i tags, which in turn is affecting the event widget because the event widget title is wrapped in an h tag. The WordPress filter hook that’s being used here is widget_title.

The solution will be to find the function in the theme that’s adding the i tags via the filter and a small function that does a remove_filter. Can you check for that function? If not, can you send a copy of the WordPress theme to our support at eventespresso.com email address so we can investigate?


jeff nickel

October 29, 2015 at 6:00 pm

Thank you for the quick reply! I’ve done a search of all of the code in the theme, and here are the resulting files and lines referencing ‘widget_title’. Any of this look suspect?

Results


jeff nickel

October 29, 2015 at 6:01 pm

Here’s a link to a the image so you can see it full-size

http://imgur.com/mMgZsvh


Josh

  • Support Staff

October 29, 2015 at 7:10 pm

None of those look suspect because they don’t do add_filter('widget_title', 'some_function_name');


jeff nickel

October 30, 2015 at 7:57 am

Sent the theme to the support email. I can’t the code unfortunately.

Thanks!


Josh

  • Support Staff

October 30, 2015 at 7:59 am

Hi Jeff,

It turns out the theme is manipulating the widget titles, with JavaScript! So here’s the code that’s in play from the theme’s custom.js starting on line 22:

$('.king-sidebar h3.widget-title,.footer h3.widget-title').each(function(){
	var html = this.innerHTML;
	if( html.indexOf(' ') > -1 ){
		var title = html.substring( 0 , html.indexOf(' ') );
		title += '<i>'+html.substring( html.indexOf(' '), html.length )+'</i>';
		this.innerHTML = title;
	}
});

While removing it would work to fix, that would be kind of hacky because your changes would be lost on an update. Another solution that could work for you is just filter the before_title and after_title so the widget titles are not h3, so they no longer are affected by the above code. You can add the following to your child theme’s functions.php file to change the widget titles to wrap in h4’s:

function my_edit_linstar_widget_title_before_after($params) {
    $params[0]['before_title'] = '<h4 class="' . $params[0]['widget_name'] . '">' ;
    $params[0]['after_title'] = '</h4>' ;
    return $params;
}
add_filter('dynamic_sidebar_params', 'my_edit_linstar_widget_title_before_after');


jeff nickel

November 6, 2015 at 9:28 pm

Thank you Josh! This worked a charm.

The support post ‘Event Espresso Upcoming Events Widget – Title Problem’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  jeff nickel 3 years, 11 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!