[tribe_events] Shortcode Limit option not Working

Home Forums Calendar Products Events Calendar PRO [tribe_events] Shortcode Limit option not Working

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1206512
    devdept
    Participant

    Hello!

    I’m trying to show only one event in my “featured-events” category, but it keeps showing 2 events. I have the shortcode set as:

    [tribe_events view=”list” category=”featured-events” limit=”1″]

    but that doesn’t seem to be working properly. Please help? The only way I’ve gotten it to work is by setting whatever second event to display:none; and I’d rather not have to constantly go in and set my new featured event every time an old one passes. Thank you.

    #1206611
    Geoff
    Member

    Hi Nick, thanks for reaching out!

    I think the issue is that there actually is no “limit” filter available for the shortcode.

    Looking at our documentaiton for shortcodes, the only filter available for limiting the number of events that might display is to set a date range, like:

    [tribe_events view="list" category="featured-events" date="2016-08-21"]

    Does this help answer your question? Please let me know.

    Cheers!
    Geoff

    #1210073
    Andres Fernandez
    Participant

    Hello Tribe,

    Trying to accomplish the exact same thing as Nick… it would be tremendously helpful if you guys would consider adding the “limit” parameter to the “calendar view” [tribe_events] shortcode, to override the limit set in the plug-in’s main settings.

    The reason this would be helpful is that for Events Calendar Pro users (like Nick and myself), having the ability to display a “rich” view on any given page (other than the main events page) while being able to control the number of events displayed, would be more interesting than being restricted to rendering the list widget via shortcode (the list view widget is great for a sidebar, but not nearly as great to display events in a section of a full-width page).

    I highly encourage you to consider this improvement to an upcoming update of the plug-in, it’ll make it that much more powerful.

    Thanks!

    #1210990
    Geoff
    Member

    Howdy @aplussideas.

    Thanks for the feedback! It would be awesome if you would add your support behind the feature request for this so we can see more demand for it:

    https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/17229266-add-limit-x-option-to-tribe-events-shortcode

    Thanks a ton!
    Geoff

    #1217300
    Eric
    Participant

    Added a vote to the uservoice topic!

    Just a quick note how you can achieve this in a kind of hacky way. Add the following code to your functions.php to change the number of posts in a shortcode:

        
        function sif_tribe_option($option, $optionName, $default) {
    	//change number of posts per page
    	$numberOfPostsInShortcode = 3;
    	if($optionName == 'postsPerPage') {
    	    //are we in a shortcode?
    	    $in_shortcode = in_array(
    		'do_shortcode',
    		wp_list_pluck(
    		    debug_backtrace(),
    		    'function'
    		)
    	    );
    	    if($in_shortcode) {
    		return $numberOfPostsInShortcode;
    	    } else {
    		return $option;
    	    }
    	}
    	//always return an option
    	return $option;
        }
        add_filter('tribe_get_option', 'sif_tribe_option', 10, 3);
    
    #1217346
    Geoff
    Member

    That is really awesome, @Eric! Thanks so much for the tip — I know others will find that super helpful and I couldn’t appreciate it more. 🙂

    Cheers,
    Geoff

    #1224267
    akalwp
    Participant

    Hi @Geoff

    I’m facing the same issue. I don’t understand when you said “I think the issue is that there actually is no “limit” filter available for the shortcode.”

    I found this fonction in the knowledge base of your site for those who paid for the Pro version:
    “Events Calendar PRO Widget Shortcodes Overview”= https://theeventscalendar.com/knowledgebase/pro-widget-shortcodes/

    Event List Shortcode Part:
    “Finally, you can specify the maximum number of events that should be listed: [tribe_events_list limit=”10″]”

    The tribe events limit fonction worked great before last update.

    Regards
    Akal

    #1224340
    Geoff
    Member

    Hello @akalwp,

    You’re absolutely right, but the topic of this thread is actually about the use of a “limit” variable in the full view shortcodes:

    https://theeventscalendar.com/knowledgebase/embedding-calendar-views-tribe_events-shortcode/

    The “limit” you are referring to is specifically for the calendar widgets. I searched the forums and was unable to find another other reports of “limit” not working, but please do open a new thread and we’d be happy to troubleshoot it with you and open a ticket to fix it if we can confirm the issue.

    Thanks so much!
    Geoff

    #1239949
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘[tribe_events] Shortcode Limit option not Working’ is closed to new replies.