Widget “view calendar” not working
-
using the widget you have a “view calendar” link at the bottom, but this simply links to the home page, and not to the calendar slug. I had to hide it using CSS and create my own link to view the calendar.
-
This topic was modified 5 months ago by
cilycwmweb.
The page I need help with: [log in to see the link]
-
This topic was modified 5 months ago by
-
Hi @cilycwmweb ,
Thank you for reaching out and bringing this to our attention.
I’m noticing that you’re not using the Post type permalink structure (WordPress Settings -> Permalinks), have you tried switching this to the said structure or regenerating your permalinks (see How to Regenerate Your Permalinks in WordPress)?
Also, I’d like to note that you can change the View Calendar link via a filter hook (snippet below):
add_filter ( 'tribe_events_views_v2_view_template_vars', function ( $template_vars, $view ) {
if ( $view->get_view_slug() == 'widget-events-list' ) {
$template_vars['view_more_link'] = 'https://cilycwm.com/?post_type=tribe_events';
}
return $template_vars;
}, 20, 2 );We’re using the plain type permalinks at the moment, and I’m not going to change that as we have references all over the site using these links, and I don’t see that this would make any difference as the calendar slug doesn’t use a plain permalink.
I’ve regenerated the permalinks as you suggest and it has no effect.
We have no filter bar installed at the moment, and I note that it will cost an extra £89 to do so.
-
This reply was modified 5 months ago by
cilycwmweb.
Hi @cilycwmweb ,
Thank you for your message, and I’m sorry to hear of the continued difficulties.
You do not need the Filter Bar here, but I’d like to clarify that the following code snippet would allow you to change the “View Calendar” link’s URL (so that you don’t have to hide it via CSS and create your own link). You can append this snippet to your theme’s functions.php file or use a Code Snippets plugin.
add_filter ( 'tribe_events_views_v2_view_template_vars', function ( $template_vars, $view ) {
if ( $view->get_view_slug() == 'widget-events-list' ) {
$template_vars['view_more_link'] = 'https://cilycwm.com/?post_type=tribe_events';
}
return $template_vars;
}, 20, 2 );would that be the file functions.php in the wp-includes folder? I edited it and inserted the code you suggested and it caused the site to crash (error 500)
-
This reply was modified 5 months ago by
cilycwmweb.
Hi @cilycwmweb ,
Thank you for your message, and I’m sorry to hear of the continued difficulties.
I was referring to your theme’s functions.php file — i.e.,
/wp-content/themes/twentytwentyone/functions.php.thanks. I found the correct file through the WP admin functions and updated the file with your code, but when I saved it I got this error:
Your PHP code changes were not applied due to an error on line 815 of file wp-content/themes/twentyten/functions.php. Please fix and try saving again.
Unclosed ‘{‘ on line 343
-
This reply was modified 5 months ago by
cilycwmweb.
update: I’ve just checked the funtions.php file and it’s now empty. I wish I hadn’t started this.
I’ve managed to retrieve a backup of functions.php
Could you please try adding the snippet again? If the issue persists, kindly share a screenshot of the specific line in your
functions.phpfile that’s causing the issue, so I can investigate it further.I’ve created a screenshot, but there doesnt seem to be a mechanism here to upload an attachment
Hi @cilycwmweb ,
Thank you for your message. You can share the screenshot through online platforms like ScreenPal or SnipBoard.
Alternatively, if you still have difficulties adding the code with your theme’s
functions.phpfile. I recommend you go with another route, which is to use a third-party plugin like Code Snippets.ok, here’s the screenshot:
https://snipboard.io/ge3HdY.jpg
Hi @cilycwmweb ,
Thank you for your message and for sending through the screenshot.
I am not sure how this came about, but it appears to be some unexpected characters occurred when you pasted the code to your
functions.phpfile (see https://go.screenpal.com/watch/cOnbikn0TVe). Could you replace the [ characters with the opening square bracket — [ — character?ok, I’ve done that, and it didn’t give an error this time. However, after hard refreshing the page, the link is still just https://cilycwm.com without the “/?post_type=tribe_events” at the end.
-
This reply was modified 4 months, 4 weeks ago by
cilycwmweb.
-
This reply was modified 4 months, 4 weeks ago by
cilycwmweb.
-
This reply was modified 4 months, 4 weeks ago by
cilycwmweb.
Hi @cilycwmweb
Thanks for your response. I’ve just checked again on my end, and it appears to be working correctly now.
For reference, here’s a screen recording:
https://share.zight.com/eDuOWWv8If it’s still not working on your end, could you please let me know which browser you’re using? This will help me troubleshoot the issue more accurately.
-
This reply was modified 5 months ago by
You must be logged in to reply to this topic.