• Resolved shawnsmalley

    (@shawnsmalley)


    On our company website we don’t have any upcoming events but we are maintaining a large archive of previous ones (about 26 events so far). Whether on the default view (list w/ filter bar) or list or month view, the list of passed events only ever shows the three most recent ones. Under Settings > General > Number of events to show per page I’ve got it set to 12. If I set it to 1 or 2 then I will see 1 or 2 past events, but setting it to any higher numbers still only ever shows the 3 most recent. Interestingly, if you use the Filter Bar and search for a date that has a known past event (anything as far back as Mar 31, 2020) you will begin seeing previous events in search results only. I believe I’m misunderstanding “Latest Past Events”, and why it will only ever show a maximum of 3 past events on the default views.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Abz

    (@abzlevelup)

    Hi @shawnsmalley, thanks for providing more details here. It seems like this is due to the number of posts per page for archives — this is usually an option/setting for different themes. I recommend checking the theme settings. I’m also curious what theme are you using, could you also share which theme?

    Let me know how it goes on your end.

    Best,
    Abz

    Thread Starter shawnsmalley

    (@shawnsmalley)

    The theme is custom, built in-house. I can change whatever needs to be changed, though this should all still be controlled by the Reading Settings within the WP dashboard. I have “Blog pages show at most [9] posts” and “Syndication feeds show the most recent [9] items” as my settings. I do have a custom conditional setup for a single page that hooks the pre_get_posts action and sets $query->set( 'posts_per_page', 24 ); for a single post type on a single page template, but that should be the only place I’m overriding anything.

    Plugin Support Abz

    (@abzlevelup)

    Hi @shawnsmalley, I see. Thanks for providing more details here, this seems to be more technical with the custom theme. I’d reach out to our dev team and check with them what they could recommend in regard to this one. I’d get back to you whenever I hear from them.

    Hang tight for now, and please do not hesitate to create another ticket for a different topic/issue.

    Have a great day.

    Best,
    Abz

    Plugin Support Abz

    (@abzlevelup)

    Hi @shawnsmalley, one of our devs responded saying:

    They are looking for latest_past_per_page, there are two approaches:

    The first is to filter the repository arg:

    add_filter(
        'tribe_events_views_v2_view_latest-past_repository_args',
        function( $args, $context, $view ) {
            $args['posts_per_page'] = 10;// Or whatever...
    
            return $args;
        }
    );

    The other is to filter the $context->get() like so:

    add_filter(
        'tribe_context_latest_past_per_page',
        function( $value ) {
            return 10; // Or whatever...
        }
    );

    Let me know if this helps.

    Best,
    Abz

    Thread Starter shawnsmalley

    (@shawnsmalley)

    That did help with being able to see more events. I’ve done a test deployment on a staging website. However, we were expecting this to behave like an archive of past events with proper pagination. On the staging website, there are 11 events, and only the front 10 are shown, with the last one hidden. It seems this part of the page was only ever intended to be a small history loop rather than a full-featured chronological archive. As we rarely have large upcoming catalogs of events (but will want to feature them when we do), but want to prominently display dense archives of past recordings, is there another setting or set of features we should be considering instead?

    Plugin Support Abz

    (@abzlevelup)

    Hi @shawnsmalley, good to know it helped out. Appreciate the update here as well.

    On the staging website, there are 11 events, and only the front 10 are shown, with the last one hidden. It seems this part of the page was only ever intended to be a small history loop rather than a full-featured chronological archive.

    For the events, have you tried increasing the value to > 10? Should be able to show events depending on the value set for the parameter.

    As we rarely have large upcoming catalogs of events (but will want to feature them when we do), but want to prominently display dense archives of past recordings, is there another setting or set of features we should be considering instead?

    The closest we have is via shortcode. You can set the date parameter/attribute to display past events. One thing to note, using shortcodes is only available with our Pro Version. https://theeventscalendar.com/knowledgebase/k/shortcodes/

    Let me know if have more questions.

    Best,
    Abz

    Thread Starter shawnsmalley

    (@shawnsmalley)

    Yes, I can set the value to greater than 10, but for performance reasons we probably wouldn’t want to have every single past event on the page at once without pagination.

    The shortcode method may be the approach we need to take, but only if it can work independently of the existing “Latest Past Events” feed, such as if I can disable that part of the page and have the shortcode load instead. Would either code snippets above (the repo arg or context get methods), when zeroed out, have any impact on the shortcode? If I can use one of those methods to empty the existing list of previous posts then the shortcode could take its place.

    If this sounds like a feasible approach then I’ll see if our team will go Pro.

    Plugin Support Abz

    (@abzlevelup)

    Hi @shawnsmalley, appreciate you providing me with more details about what you’re trying to accomplish. Let me confirm this with one of our devs in regard to the shortcode. I’d get back to you as soon as I hear from him.

    Best,
    Abz

    Plugin Support Abz

    (@abzlevelup)

    Hi @shawnsmalley, thanks for your patience here. I heard back from one of our devs saying:

    If they use the filter for Lastest Past Events to increase the number of events shown to the same as the list view limit:

    add_filter(
        'tribe_context_latest_past_per_page',
        function( $value ) {
            return tribe_get_option( 'postsPerPage', 3);
        }
    );

    the only issue I can see is that the first pagination “back” shows the same events.

    They can filter the prev link to instead skip a page, which will put them on page 2 (counting up as we go back in time) which would make it act like a regular archive.

    Rough code for prev URL:

    add_filter(
    	'tribe_events_views_v2_view_prev_url',
    	function( $url, $canonical, $view ) {
    		$parsed_url = wp_parse_url( $url );
    		
    		if ( empty( $parsed_url['query'] ) || false === strpos( 'eventDisplay=past', $parsed_url['query'] ) ) {
    			return $url;
    		}
    		
    		if ( ! empty( $parsed_url['path'] ) && false !== strpos( 'page', $parsed_url['path'] ) ) {
    			return $url;
    		}
    		
    		return add_query_arg( 'paged', '2', $url );
    	},
    	10,
    	3
    );

    Let me know if this helps.

    Best,
    Abz

    Plugin Support Abz

    (@abzlevelup)

    Hey @shawnsmalley, this thread has been inactive for a while, so we’re going to go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up, and we’d be happy to help.

    Cheers,
    Abz

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Only 3 max past events shown per page, site has 26’ is closed to new replies.