Support

Home Forums Event Espresso Premium Remove Upcoming Events widget title link – bis

Remove Upcoming Events widget title link – bis

Posted: August 3, 2023 at 6:01 am

Viewing 9 reply threads


Fysim_BV

August 3, 2023 at 6:01 am

Hi,
I read the post “Remove Upcoming Events widget title link” and pasted the solution in my functions.php, but that did not move the link as expected.

// remove link from upcoming events widget title
function ee_remove_widget_title_link( $title ) {
if ( is_active_widget( '', '', 'ee-upcoming-events-widget' ) ) {
$title = wp_strip_all_tags( $title, false );
}
return $title;
}
add_filter('widget_title', 'ee_remove_widget_title_link', 16 );

Did something change in the meantime?
Can I add a custom link to the title of the widget that shows my own agenda-page instead of a generated page with the events?
Thanks in advanced!


Tony

  • Support Staff

August 3, 2023 at 6:29 am

Hi there,

I’ve just tested that code and it removed the links around the Widget title for me.

Try placing your code within a custom functions plugin rather than your theme’s functions.php file, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Fysim_BV

August 3, 2023 at 6:44 am

Hi Tony,
That didn’t work…
I assume it has something todo with the use of Elementor and the fact that it might overwrite the title. Other suggestions?
Thanks in advanced!


Tony

  • Support Staff

August 3, 2023 at 6:58 am

Change this line:
add_filter('widget_title', 'ee_remove_widget_title_link', 16 );

To be:
add_filter('widget_title', 'ee_remove_widget_title_link', 999 );

Any different?


Fysim_BV

August 3, 2023 at 7:15 am

Hi Tony,
That didn’t work either…


Tony

  • Support Staff

August 3, 2023 at 7:28 am

Then something isn’t right, EE uses that filter to add the title at priority 15 so that filter is running otherwise it wouldn’t have the links and the above is hooking in at priority 999 (originally 16 in that snippet) to remove the link.

You have your custom functions plugin activated, correct?


Tony

  • Support Staff

August 3, 2023 at 7:39 am

Try just:

function ee_remove_widget_title_link( $title ) {
    return wp_strip_all_tags( $title, false );
}
add_filter('widget_title', 'ee_remove_widget_title_link', 16 );

Note that’s going to remove the links of EVERY widget title, your doing the above to test rather than as a ‘proper’ solution.


Fysim_BV

August 3, 2023 at 8:59 am

Hi Tony,
That works just fine… Thanks for that!
Can I now add a new custom link to that title?
Thanks in advanced.


Tony

  • Support Staff

August 3, 2023 at 11:46 am

You could, but you’ll need to compare the value to make sure your adding a link to the correct widget title, right now that’s filtering ALL widget titles.

Is the link a custom link specifically for the Widget?

It currently uses the default events archive and there’s a filter that can be used to change ALL instances of that link, meaning you would need the above at all. But that obviously only works if all instances of that link need to be changed?


Fysim_BV

August 3, 2023 at 12:13 pm

Hi Tony,
I just want to link the title of the EE-widget to a certain page that has a custom overview of all the events. I know EE forsees an url in the EE-settings, but that doesn’t work if it’s a sub-page in a menu (fe.: classes/agenda), and EE then generates its own content and lay-out.
So the easiest way for me is to link the title of the EE-widget to a custom url, like https://…./classes/agenda.
Thanks in advanced!

Viewing 9 reply threads

The support post ‘Remove Upcoming Events widget title link – bis’ 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.

Event Espresso