• Resolved Filespit

    (@filespit)


    Hi there. I am using the Event Organiser plugin and I have the following problem. On my front page the widget works perfectly fine, I can click the Next and Previous month links and it loads just like it’s supposed to, and I can then click the dates and view the events.

    When you click on an event, you’re sent to a different-looking page. On this very page, I have the same widget in my Sidebar. However, the month links doesn’t work here. When I click either next or previous I am sent back to the front page. Why does this happen? Help would be much appreciated!

    This is the front page of my site, where the widget works;
    http://wptest.traineehalland.se/

    And this is the sub-page that also has the widget, where the month links doesn’t work;
    http://wptest.traineehalland.se/schema-program/

    http://wordpress.org/extend/plugins/event-organiser/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi Filespit,

    I get the following JavaScript errors in my console:

    GET http://wptest.traineehalland.se/schema-program/script/jquery.js 404 (Not Found) /schema-program/:24
    GET http://wptest.traineehalland.se/schema-program/global.js 404 (Not Found)

    It seems jQuery isn’t loading, hence the calendar navigation doesn’t work.

    It seems you using a relative url to find jQuery / globa.js:

    <script type="text/javascript" src="script/jquery.js"></script>

    Hence it doesn’t find it on a sub-page. (You seem to be loading jQuery twice too, which can cause problems) – once from WordPress and once using the above.

    Thread Starter Filespit

    (@filespit)

    Hello Stephen,

    Thank you for answering. I’ve looked into it and that does seem to be the problem. I tried hardcoding the url so it searches directly for the jquery and global files. It works for the front page but not the sub-page.

    <script type="text/javascript" src="http://wptest.traineehalland.se/wp-content/themes/traineehalland/script/js/jquery/jquery.js"></script>
    <script type="text/javascript" src="http://wptest.traineehalland.se/wp-content/themes/traineehalland/global.js"></script>

    What should I do here? Does it matter if the widget is placed in the sidebar? It’s placed there by default after all. If jquery is loaded twice, how do you prevent that?

    mmm… still can’t be found – it’s still using a relative url for me.

    In any case, you should probably remove the jquery call. You can load javascript by using wp_enqueue_script('jquery') whenever you need it (or in your header if you wanted loaded on every page).

    You should also register and enqueue your global.js script via the WordPress API (see Codex for details)

    Thread Starter Filespit

    (@filespit)

    I’ve removed the hardcoding for jquery and I’m using the wp_jquery_script instead. I also added this to register the global file. Still not loading on the sub-page though.

    <?php wp_enqueue_script('jquery', $src='http://wptest.traineehalland.se/wp-content/themes/traineehalland/global.js'); ?>

    That has stopped the errors. But the bug persists…

    I’ve just noticed that you are you using a shortcode on the main page, and a widget on the sub-page. Could you provide the code where you register the widget? It should be a call to register_sidebar() somewhere in your theme’s functions.php

    Looking at the calendar a bit closer, I’m almost certain this is the case.

    The register_sidebar() should be of the form:

    register_sidebar(array(
      'name' => __( 'Side bar name' ),
      'id' => 'sidebar-id',
      'description' => __( 'Widget area description' ),
      'before_title' => '<h1>',
      'after_title' => '</h1>',
      'before_widget' => '<div id="%1$s" class="widget %2$s">',
      'after_widget' => '</div>',
    ));

    Note the %1$s and %2$s in the before_widget argument – these are necessary for the calendar to function correctly. It seems you are missing the %2$s.

    Thread Starter Filespit

    (@filespit)

    Thanks again for answering. I have a new problem now that maybe you could help me with. I just installed WordPress on the www-adress, the link I posted above is my subdomain. I uploaded my theme with the same files, but the widget isn’t showing at all in the sidebar. Instead it lists my recent posts.

    I have tried replacing codes in sidebar.php, functions.php and archive-event.php, but I can’t get the sidebar to show the widget. What am I doing wrong here?

    Update: I just solved it. I had to add it to the sidebar under widgets in the admin panel. Now I’m back where I started this thread, I can’t browse the calendar.

    Have you tried the code above – looking at the links above, it still doesn’t appear to be using '<div id="%1$s" class="widget %2$s">' for the before_widget argument…

    Thread Starter Filespit

    (@filespit)

    Hi Stephen! I finally got it to work! It was indeed that code that was missing, thanks for helping me out!

    New question though; when I click a date in a month, the page loads and resets the calendar to the current month, which in this case is september. Say I click a date in april 2013, then I want the calendar to stay in april when the page reloads, and not reset to september 2012. Is that possible?

    This has been request before, I think in the next update I will change it so it does this…

    andyruw

    (@andyruw)

    Hi Stephen. Sorry for re-opening this. I’m having the same issue with the prev & next month links.

    The functions.php file has the code you mentioned above with the register-sidebars function, so I wondered if you’ve got any ideas why i’m having the problem?

    I’m getting this message in the console;

    ‘Uncaught TypeError: Object [object Object] has no method ‘off’ ‘

    The site is http://www.mycommunitychurch.org.uk/community/community-events/

    Love the plugin by the way, I just need to sort out this small issue.

    Thanks

    Plugin Author Stephen Harris

    (@stephenharris)

    Hi Andy,

    The site is using an out of date jQuery (1.6.4) – the plug-in requires 1.7+, since I think 1.9 will be included in WP 3.6 and that removes some functions (and their replacement was added in 1.7).

    It seems a plug-in/theme is replacing the WordPress shipped version (which is kept relatively up to date) with Google hosted jQuery.

    Chuffed to see a New Frontiers church using my plug-in :).

    andyruw

    (@andyruw)

    Thanks for the reply. Yeah, we have a few churches that your plugin is perfect for.

    This is a theme that i’ve built from a blank one. Is it possible to overide the out of date jQuery version in the theme’s header.php? (I think a plugin is causing the problem).

    Plugin Author Stephen Harris

    (@stephenharris)

    You’ll need to find which plug-in is doing it, and then prevent it (you can do this without editing the plug-in). I would also contact the plug-in author and ask them to fix this. Plug-ins should not be doing that, unless you’re using a plug-in whose explicit purpose is to replace the shipped jQuery with the Google hosted one.

    If you have any ‘performance’ related plug-ins they might be responsible.

    To find the plug-in do a grep search for ‘http://ajax.googleapis.com/ajax/libs/jquery/&#8217; – that should hopefully identify it.

    If the plug-in is hosted here on the repo then let me know – since plugins are moderated and they’ll want this fixed. If its hosted elsewhere then you’ll have to ask them to fix it / use another plug-in.

    Alternatively you could just use an old stable version of EO (1.8.4 might be ok) that doesn’t require jQuery 1.7+.

    andyruw

    (@andyruw)

    Thanks Stephen. I found the plugin causing the issue.

    http://wordpress.org/extend/plugins/thethe-image-slider/

    At the moment I edited the plugin (not ideal). Is there a way to prevent it rather than editing it?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Event Organiser – Next and Prev Month Links not working in Sidebar’ is closed to new replies.