Forum Replies Created
-
AuthorPosts
-
Simon
ParticipantNo worries, Geoff!
Thanks for confirming that it is in fact marked for review. Is there any way I can be notified when it gets updated?
Thanks again! Have a great evening yourself – day’s just getting started here mate! :).
January 20, 2016 at 6:36 pm in reply to: Update Blues. After update, permalinks and tribe_get_event_link() are busted #1059598Simon
ParticipantMarking resolved.
January 20, 2016 at 6:35 pm in reply to: Update Blues. After update, permalinks and tribe_get_event_link() are busted #1059597Simon
ParticipantWoah, that’s something. As you noted, I had changed theme/deactivated all plugins, but hadn’t flushed in between.
I spun up a clone of the site so I could go through one by one deactivating plugins and flushing permalinks without wonkifying the front-facing site – turns out the PODS plugin was the issue! Once that was deactivated and flushed, then it was fine :). Re-activated PODS without issue. Did this on the live site and it’s fine there too – resolved!
—
the link to /calendar is still problematic, but like you say, it’ll probably be a result of updating the KB article to keep up with changes in the core :).
thanks Baz, you’re a champ! Sorry it ended up being so goose-chase-y!
-
This reply was modified 10 years, 3 months ago by
Simon.
January 20, 2016 at 5:07 pm in reply to: Update Blues. After update, permalinks and tribe_get_event_link() are busted #1059550Simon
ParticipantThis reply is private.
January 20, 2016 at 4:11 pm in reply to: Update Blues. After update, permalinks and tribe_get_event_link() are busted #1059507Simon
ParticipantThis reply is private.
January 20, 2016 at 4:08 pm in reply to: Update Blues. After update, permalinks and tribe_get_event_link() are busted #1059504Simon
Participantso it may be that the second half of that knowledgebase post needs to be updated – and I’ve flagged it for further review accordingly.
Thanks! Appreciate it :).
you could use a suitable redirect plugin to avoid problems for those users who are following the currently-invalid URLs
We held off updating until a period where there’s not really many events running, so it’s not a huge issue to leave the site slightly wonky for a bit. For this reason I’m going to leave redirects out of place for now – less to undo later.
Example of tribe_get_event_link() acting weird: There’s actually only one place in the template I’ve called it directly, which is the home page just under the main image. It lives within a function in functions.php and (while it’s pretty inelegant) it doesn’t relate to rewrite customisations.
function custom_widget_featured_image() { global $post; if( is_front_page() ) { //img /*echo tribe_event_featured_image( $post->ID, 'large' );*/ $box_image_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); echo('<a href="' . esc_url( tribe_get_event_link() ) . '" title="' . get_the_title( $post_id ) . '">'); echo('<div class="middle box" style="background-image:url('.$box_image_src[0].')">'); //meta $microformatStartFormat_year = tribe_get_start_date( $event, false, 'Y' ); $microformatStartFormat_month = tribe_get_start_date( $event, false, 'M' ); $microformatStartFormat_day = tribe_get_start_date( $event, false, 'd' ); echo ('<p class="p-meta-2"><span>' . $microformatStartFormat_day . '</span><span>' . $microformatStartFormat_month . '</span><span>' . $microformatStartFormat_year . '</span></p>'); echo('</div>'); echo('</a>'); }; } add_action( 'tribe_events_list_widget_before_the_event_title', 'custom_widget_featured_image' );Additionally, when the events are listed at /events and /events/month, they’re using pretty much the stock TEC templates and they’re spitting out /tribe-events/ in the URL string there too. eg, from /%theme-child%/tribe-events/pro/photo/single-event.php:
<!-- Event Title --> <?php do_action( 'tribe_events_before_the_event_title' ); ?> <h2 class="tribe-events-list-event-title entry-title summary"> <a class="url" href="<?php echo esc_url( tribe_get_event_link() ); ?>" title="<?php the_title() ?>" rel="bookmark"> <?php the_title(); ?> </a> </h2> <?php do_action( 'tribe_events_after_the_event_title' ); ?>I’ll reply in a moment with some system info/login ;). Thanks guys.
-
This reply was modified 10 years, 3 months ago by
Simon.
Simon
ParticipantGeoff! You’re a gentleman and a scholar.
Worked flawlessly ;). Thanks heaps for your time and efforts on this!
Simon
ParticipantHey!
That’s partially fixed it :). So it was just a case of adding that priority number to that first part?
*
The issue now is that /events/all-events leads us to a 404, despite following the KB article (I’ve opened up the ‘Permalinks’ page pretty regularly to make sure that’s not the issue, as mentioned in the KB article).
So ‘All Events’ now displays in the dropdown at the top of Events pages, but clicking it leads to a 404 :(.
*
Keen to hear your feedback :).
Simon
ParticipantHi Geoff, thanks for the quick reply.
I think you’re misunderstanding what I’m trying to do – sorry! Let me try again 🙂
I’m trying to do exactly what’s discribed in this article:
https://theeventscalendar.com/knowledgebase/renaming-views/The only difference is that one of the views I want to rename is the ‘photos’ view, instead of the ‘list’ view used in the article.
I’ve added the following code into my functions.php file:
// =========================== // EVENTS CALENDAR STUFF // =========================== //PART ONE: adapt the names of views listed within the Tribe Events Bar add_filter( 'tribe-events-bar-views', 'rename_tribe_views_in_selector' ); function rename_tribe_views_in_selector( $views ) { // This lists the original view names you wish to change along // with the substitutes to wish to use in their place $to_change = array( 'Photo' => 'All Events', 'Month' => 'Calendar', ); // Look through the list of active views and modify names accordingly foreach ( $views as &$view ) if ( isset( $to_change[ $view['anchor'] ] ) ) $view['anchor'] = $to_change[ $view['anchor'] ]; // Return our revised list return $views; } // PART TWO: Slug rewrite rules add_filter( 'tribe_events_rewrite_rules', 'rename_event_view_slugs', 10, 2 ); function rename_event_view_slugs( $rules, $new_rules = null ) { if ( null === $new_rules ) return $rules; // Original event view slugs and what we want to change each to $to_change = array( 'photo' => 'all-events', 'month' => 'calendar' ); // Scan for rules relating to the views in question and update accordingly foreach ( $new_rules as $added_rule => $query_string ) { foreach ( $to_change as $look_for => $change_to ) { // Skip if we don't have a match if ( false === strpos( $added_rule, "/$look_for" ) ) continue; // Form the revised rule $revised_rule = array( str_replace( "/$look_for", "/$change_to", $added_rule ) => $query_string ); // Remove the old rule and insert the new one unset( $rules[$added_rule] ); $rules = $revised_rule + $rules; } } return $rules; } // PART THREE: Whenever The Events Calendar displays a link to month/list view, we need to update it in respect of our new slug add_filter( 'tribe_events_getLink', 'modify_month_list_link_urls', 10, 2 ); function modify_month_list_link_urls( $url, $type ) { if ( 'month' === $type ) return str_replace( 'month', 'calendar', $url ); if ( 'photo' === $type ) return str_replace( 'photo', 'all-events', $url ); return $url; }Now, what’s happened is:
The ‘Month’ => ‘Calendar’ stuff has worked perfectly – it’s renamed in the back end, the events bar, and slug.
The ‘Photo’ => ‘All Events’ stuff has not worked, it’s still called photo in the back end, or the ‘event bar’ at the top of events pages and typing heading to /events/photo shows the photo view, so it hasn’t changed the slug. It’s like what I’ve entered hasn’t touched it :/.Thanks again for taking a look!
-
This reply was modified 10 years, 3 months ago by
-
AuthorPosts
