• Resolved p5laris

    (@p5laris)


    Hello, first time working with wordpress and customization and learning as I go.

    I am using the accordion shortcut on a post to hold description text. In my post I have:

    [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: https://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 </body> tag in your themes footer.php file.—it is there
    ? 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? Thanks in advance.

    https://www.ads-software.com/plugins/accordion-shortcodes/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter p5laris

    (@p5laris)

    After trying a myriad of things, my best guess is that for some reason, when the ‘post’ page is accessed whether directed there by clicking on a link from the ‘cover’ page, using the back button, or from any page within the site, for some reason the Javascript for the Accordion-shortcodes is not properly being added/accessed on the landing page—with the exception of landing on the page via clicking on a direct link. In snooping around a bunch of php pages, I was able to confirm that

    I checked and saw that: <?php include(‘footer.php’); ?> is included:

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

    Baffling.

    Please let me know if there is any other information i can provide to make it easier to resolve this issue.

    Plugin Author philbuchanan

    (@philbuchanan)

    I’m not 100% sure what the exact issue is but please try using <?php get_footer(); ?> wherever you have <?php include('footer.php'); ?>. WordPress provides a function (get_footer()) for this very purpose. It will load the footer.php file for you automatically. That may be part of the issue you are running into.

    If that doesn’t resolve the issue, on the pages that are not loading properly, please check the HTML (view source) for the accordion.min.js file. If should be near the bottom, just before the closing </body> tag. If it’s not loading that, please let me know.

    https://mhdo.org/?p=514 came up as a 404 error for me and I could not find your “test page” so I am unable to verify any of this for you.

    Thread Starter p5laris

    (@p5laris)

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

    I went ahead and did as you directed and looked at all the .php files that accessed the footer. You were absolutely right— there were several pages that had <?php include(‘footer.php’); ?>. When you see the pages it now totally makes sense why I was having trouble with landing pages. The files I found were:

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

    And just to document what I did for anyone else that runs into my problem, I had a custom theme and so I did a text search and found the pages listed above with <?php include(‘footer.php’); ?> towards the bottom of the page . I went ahead and replaced it with the text that you provided: <?php get_footer(); ?> and it now works!

    (I’m going to also post this same response just for anyone else that might need reference from github…)

    THANK YOU—YOU TOTALLY MADE MY DAY!

    ——

    Just to answer your question (from my posting of the same issue on github)—and for anyone else who might for some reason run into this problem, for them to refer to.

    You asked if I had any other plugin installed that might be using the same accordion shortcodes—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

    Plugin Author philbuchanan

    (@philbuchanan)

    Glad I could help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘When post first loads, accordions do not work’ is closed to new replies.