• Hi,

    First of all I want to say that the collapse-o-matic is a great plugin. It’s very user friendly and simple to use.

    I have an idea that I don’t know how to achieve:
    I use collapse-o-matic to only show a small portion of all the posts when wordpress shows lists of multiple posts. My idea is that when you click on a certain post and see only that one, it should start in expanded mode. I think the easiest way would be to include a trigger event in the “single_post.php”, that triggers the opening of the collapse-o-matic when the page is loaded/generated.

    What would that code look like?

    Or does anyone have an even simpler method of achieving this?

    Thanks in advance!

    https://www.ads-software.com/plugins/jquery-collapse-o-matic/

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

    (@simonkallioinen)

    The solution you are proposing would show the field expanded in all places where it’s visible right?

    I want it to be expanded only in the single post.php-format. See my earlier post for a better explanation.

    Plugin Author Baden

    (@baden03)

    Can you share a link to your site. I think I know what you want, but would like to make sure. What you want is a conditional attribute (in this case the expanded attribute) that is only set when a specific template is used.

    While this feature is not built into the plugin there are a couple of work-arounds that come to mind.

    1a) add a bit of jQuery to your single.php template that expands any (and all) collapse elements. Pro: Does what you want. Cons: Need to know a bit about jQuery. Not the cleanest way to do it.

    1b) there is a hidden jQuery callback function that might be tasked for this…. more info later.

    2) rather than add the shortcode to the content, add the shortcode to your template. This way, you can add the expanded="true" conditionally. Pro: Does what you want. Cleanly. Cons: Need to know a bit about PHP. Can not block out just a ‘section’ of your content.

    Conditional attributes do sound like an interesting feature. We will noodle a bit on how best to execute. If we do add it, it will most likely be a Pro feature, as this is developer level functionality.

    Thanks for the feedback, and get back to us with a link (if possible)

    Thread Starter simonkallioinen

    (@simonkallioinen)

    Thank you!
    The address is https://www.aplusdevelopment.se.

    I think solution 1a is not possible because single post.php inserts the whole post as sort of a block. I was hoping the template could “simulate” a mouse click, and thereby expand the code.

    Solution 1b would be the best one as it would demand less work from me. We are probably willing to pay a little bit for this functionality. It would be great if it was a part of the shortcode like everything else in your plugin. For example: startinexpanded:”single_post.php” or something similar.

    Solution 2 as you propose, seems to work also. I guess I could find a WordPress command to see what the current template is. I know some php but almost zero jquery.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Start in expanded mode in a certain page’ is closed to new replies.