WordPress.org

Ready to get started?Download WordPress

Forums

Collapse-O-Matic
[resolved] Include auto expand in hyperlink (9 posts)

  1. CliffHobbs
    Member
    Posted 1 year ago #

    So I'm LOVING the fact I can assign a name to my various expand items on a page and then hyperlink to that particular one (good taste in Star Wars and Kraftwerk btw ;-)

    Is there anyway that as part of the hyperlink I can include the command to expand the item?

    So I blog about a new article on my site and rather than relying on the user to click the title to expand it when they click the hyperlink and arrive on the page, the link takes them to page and auto-expands the item (hope this makes sense)?

    Many thanks,
    Cliff

    http://wordpress.org/extend/plugins/jquery-collapse-o-matic/

  2. CliffHobbs
    Member
    Posted 1 year ago #

    OK I've re-read the docs which state:

    "When the optional ID attribute is defined, the id value can be used as a URL anchor to automatically expand the content:"

    However, this isn't working for me. I've created a new page and hyperlinked from it from here:

    http://www.faqshop.com/wp/blogs

    The right page loads but the item doesn't auto expand like it should :-(

    Appreciate any help you can offer to get this working.

  3. Baden
    Member
    Plugin Author

    Posted 1 year ago #

    To auto-expand via url, you need two things. A specific ID, and the id as anchor text in your URL. So, in your example you start out with the base URL: http://www.faqshop.com/wp/acctest and have, say Johny 5 Alive auto expand (loved that move as a kid... I still say :'People at night are liking lights' in an Indian accent) you would first need to assign the id:

    [expand id="johnny5" title="Johnny 5 Alive"]Who's Johnny, she said<br/>And smiled in her special way[/expand]

    Then, all you need to do is tack a /# and your id (johnny5 in this case) to the end of your url like so: http://www.faqshop.com/wp/acctest/#johnny5
    and BAM, you're golden.

  4. CliffHobbs
    Member
    Posted 1 year ago #

    Thanks for the reply but feeling like my Mumma is a Snow Blower :-(

    If you goto here:

    http://www.faqshop.com/wp/blogs

    Then click "This is a test" hyperlink in the "Test" post which links to the following page using your "kraftwerk" tag (I like to keep things simple when I start out with something new ;-)

    http://www.faqshop.com/wp/acctest/#kraftwerk

    The page loads but doesn't expand the Pocket Calculator item - It's like everything is happening in reverse.

  5. CliffHobbs
    Member
    Posted 1 year ago #

    BTW this isn't resolved

  6. Baden
    Member
    Plugin Author

    Posted 1 year ago #

    So in your example, which collapse element did you assign the kraftwerk id? Looking at your source, 'kraftwerk' is not assigned anywhere.
    In the intrest of keeping things simple, please post the exact shortcode you are using for 'Pocket Calculator' on this page: http://www.faqshop.com/wp/acctest

  7. CliffHobbs
    Member
    Posted 1 year ago #

    Here we code apologies if I've messed something up:

    [expand title="Pocket Calculator" tag="h4" id="kraftwerk"]
    over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.
    
    The quick brown fox jumped over the lazy dog.
    
    Target Content[/expand]
  8. Baden
    Member
    Plugin Author

    Posted 1 year ago #

    Are you by chance using a cacheing plugin? It's working now: http://www.faqshop.com/wp/acctest#kraftwerk

  9. CliffHobbs
    Member
    Posted 1 year ago #

    Apologies <blush> my bad:

    Yours:

    http://www.faqshop.com/wp/acctest#kraftwerk

    What I had:

    http://www.faqshop.com/wp/acctest/#kraftwerk

    Extra "/" before the #

    Sorry, please close this.

    Just the "jumping pages" problem to fix (my other thread I know you're looking at thank you) and all is good with the World.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic