• Resolved bubbadude425

    (@bubbadude425)


    Hello, I purchased the Collapse-O-Matic pro version a while back and I’ve had an idea of working with it to show/hide content pulled from custom fields without using the short code. However, I’m having a little issue with rolling-my-own. I’m using a hook within the Genesis framework, which pulls and displays the custom field data just fine, and then wraps the content with tags. Unfortunately the content is expanded and will not trigger to work to close or expand either way.

    When clicking on the title or arrow I see where the “colomat-close” class is added to the tag with the trigger, but nothing works. It’s probably a simple issue, and once figured out I’ll be laughing at my bone-head mistake, however, any assistance would be greatly appreciated.

    Genesis Hook Snippet

    add_action( 'genesis_entry_content', 'awards_achievements_content', 11 );
    function awards_achievements_content() {
      if ( is_single() && genesis_get_custom_field('awards_achievements') )
      	$col_id = 'awards-achievements';
        echo '<div class="collapseomatic" id="expand_' . $col_id.' " title="Awards & Achievements">Awards & Achievements</div>'; 
        echo '<div id="target_' . $col_id . '" class="collapseomatic_content">' . genesis_get_custom_field('awards_achievements') . '</div>';
    }  

    Output

    <div class="collapseomatic" id="expand_awards-achievements " title="Awards & Achievements">Awards & Achievements</div>
    <div id="target_awards-achievements" class="collapseomatic_content">
    Some content from custom fields...blah blah blah...
    </div>>
    • This topic was modified 7 years, 10 months ago by bubbadude425. Reason: Adding tags
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bubbadude425

    (@bubbadude425)

    Ok, I figured it out, and yes it was a bone-head mistake. The “id” needed to be changed on the trigger to just “id” without anything before it and the target “id” needed to be changed from an underscore to a dash and that did the trick.

    Here is the revised code that works:

    add_action( 'genesis_entry_content', 'awards_achievements_content', 11 );
    function awards_achievements_content() {
      if ( is_single() && genesis_get_custom_field('awards_achievements') )
      	$col_id = 'awards-achievements';
        echo '<div class="collapseomatic" id="' . $col_id.' " title="Awards & Achievements">Awards & Achievements</div>'; 
        echo '<div id="target-' . $col_id . '" class="collapseomatic_content">' . genesis_get_custom_field('awards_achievements') . '</div>';
    }
    Plugin Author twinpictures

    (@twinpictures)

    Great, thank you for posting your solution and marking the issue as resolved.
    If you require any more support just open a new thread!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Genesis Framework, Custom Fields and Collapse-O-Matic’ is closed to new replies.