WordPress.org

Ready to get started?Download WordPress

Forums

My Calendar
[resolved] Navigation creates multiple calendars (5 posts)

  1. Rnubi
    Member
    Posted 1 year ago #

    Hello,

    WordPress - 3.5.1
    My Calendar - 2.1.5

    Background -

    I have multiple calendars (5+) shown on one page, each showing a different category of events (30+). I am using the standard large calendar for each one and also have an upcoming events widget in the sidebar. I have made numerous changes to the styling and templating for the pop-up event details and the stand-alone event (generated) pages. I have not touched the JavaScript side of things except to switch on the Ajax navigation. Im using simple shortcodes e.g [my_calendar shownav="yes" showkey="no" category="CategoryName"]

    Problem -

    Just noticed today that if I use the Ajax navigation to move forwards or backwards through the months, after the 'please wait . .' I get multiple calendars appear where each shortcode is positioned.

    I get the same number of extra calendars as there are shortcodes on the page, so I'm showing is 5 calendars I get 5 calendars per section shortcode e.g 25 calendars on the page, the extra 4 directly under the first in all five positions.

    The extra calendars all show their respective categories in the right order, so I'm guessing the ajax is picking up every shortcode and is inserting them all each time it finds a shortcode.

    Any ideas?

    Remedials -

    I have tried disabled all plugins, I tried changing themes. This doesnt happen if I switch off the Ajax navigation but it is needed as each of these calendars were originally within an symple_accordion structure. They have been stripped out to fault-find. It was definitely working when I first installed and setup. Not much has changed except I have just added lots of events and categories.

    The site is going live soon but is not available for public consumption right now.

    Any help greatly appreciated.
    Look forward to a reply!

    Regards
    Rnubi

    http://wordpress.org/extend/plugins/my-calendar/

  2. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    I'm not in a place where I can actually reference the code right now, but I'll check on this when I am, later today. I think I know what's going on, but without checking code I don't think my comments would be all that useful...

  3. Rnubi
    Member
    Posted 1 year ago #

    Thank you Joe.

    Look forward to it.

    Rnubi

  4. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    All right. Here's the deal - you'll need to make changes to each shortcode, to use the 'id' attribute, then follow that up with some changes to the AJAX jQuery.

    There's probably a better way to do this, but this is pretty simple to explain.

    First, add the "id" attribute to each shortcode, each with a different value. Example:

    [my_calendar shownav="yes" showkey="no" category="CategoryName" id="mc1"]

    [my_calendar shownav="yes" showkey="no" category="CategoryName2" id="mc2"]

    And so on.

    Then, you'll need to modify the AJAX navigation script so that each of these individual references is used for navigation, instead of the generic .mc-main container; because that container applies to all displayed containers instead of just the currently active calendar.

    For the above, you'd end up with this (ignoring list and mini ajax; which don't need to change, but I'm omitting for convenience.)

    jQuery(document).ready(function($){
    	$('#mc1 .my-calendar-nav a').live('click', function(e){
    		e.preventDefault();
    		var link = $(this).attr('href');
    		$('#mc1').html('Loading...');
    		$('#mc1').load(link+' #mc1 > *', function() {
    			$('.calendar-event').children().not('h3').hide();
    		});
    	});
    	$('#mc2 .my-calendar-nav a').live('click', function(e){
    		e.preventDefault();
    		var link = $(this).attr('href');
    		$('#mc2').html('Loading...');
    		$('#mc2').load(link+' #mc2 > *', function() {
    			$('.calendar-event').children().not('h3').hide();
    		});
    	});
    });

    The change is that the .mc-main and .calendar references are replaced with references to the assigned IDs for each shown calendar.

  5. Rnubi
    Member
    Posted 1 year ago #

    Hi Joe,

    That is perfect. Thank you very much.
    Please expect a donation very soon.

    Regards

    Rnubi

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic