philbuchanan / Accordion-Shortcodes

A WordPress plugin that adds a few shortcodes to allow for accordion dropdowns.
https://wordpress.org/plugins/accordion-shortcodes/
16 stars 10 forks source link

When post loads, accordion is fully open and all functions are disabled. #10

Closed p5laris closed 10 years ago

p5laris commented 10 years ago

Hello, Hello, first time working with wordpress and customization and learning as I go. —Love this short code because it's clear and just what I need.

I am using the accordion shortcut on a post to hold description text.

[accordion autoclose="true" openfirst="false" openall="false" clicktoclose="true"][accordion-item title = "Project Name"] Sample text. [/accordion-item][/accordion]

If you click on 'Project Name', the accordion will reveal some descriptive text. Clicking again on 'Project Name' will close the accordion. Everything seems to be working properly when you access the page directly: http://mhdo.org/?p=514

my issue when I click on any other page to get to the post (or the back button) the page shows the accordion fully 'open' and clicking on the accordion title does not close it.

example:

  1. go to mhdo.org
  2. click on white box (when you rollover you will see, test page', which will land you to the problem page—clicking on 'Project Name' does not close the accordion.
  3. refresh to view page properly working.

When this problem page is accessed from another link, the script doesn't seem to work. (I'm guessing?) But when the page refreshes, everything seems fine.

I should note: • I checked to make sure that the "wp_footer() "being called right before the closing tag in your themes footer.php file.—it is there screen shot 2014-06-28 at 4 17 37 am

• I'm using a custom theme but java seems to load fine so, I'm confused.

Has anyone seen something like this or have any recommendations? Any help would be appreciated~! Thanks in advance.

https://wordpress.org/plugins/accordion-shortcodes/

p5laris commented 10 years ago

I wasn't sure if it's that the footer is not being added to all pages (since it is accessed by clicking'). I checked and saw that: <?php include('footer.php'); ?> is included:

archive.php index.php page.php attachment.php 404.php

p5laris commented 10 years ago

Also...screengrab of what was at end of footer...

screen shot 2014-06-28 at 4 17 37 am

philbuchanan commented 10 years ago

This is likely an issue with the JavaScript file not loading properly. It could be the result of a number of things such as a conflicting plugin. This plugin will only load the JavaScript on the pages that actually use the [accordion] shortcode. If another plugin is using that same shortcode it will likely override this plugin. Are there any other plugins installed that use the [accordion] shortcode?

p5laris commented 10 years ago

Hi, Phil—Thank you for your patience and for answering my question posted here (and posted on Wordpress .)

Just to answer your question—and for anyone else who might for some reason run into this problem, for them to refer to

In answer to your question, I do not have any other accordion short codes that I am using. However, that said, in trying to find out the right plug-in to use, I had installed, deactivated, and deleted a few plugins until I found yours—which is more fitting for my needs. Currently, only your accordion plug-in is the one that I am using.

The other plugins I am using are: Jetpack Regenerate Thumbnails Search Everything W3 Total Cache WP No Category Base


Per the instructions you provided, (ref http://wordpress.org/support/topic/when-post-first-loads-accordions-do-not-work) You suggested that for all php pages with <?php include('footer.php'); ?> to replace it with: <?php get_footer(); ?>. The files I found were:

404.php archive.php attachment.php index.php page.php search.php single.php

I did it and And it now works!

THANK YOU—YOU TOTALLY MADE MY DAY!