Collapse Pro Matic – Adding 2nd Trigger in Excerpt

Collapse-Pro-Matic version 1.3.15 introduces a couple new features dealing with secondary triggers and excerpt filtering. The following demonstrates the new features by using a filter to add a second trigger with it’s own swaptitle to all excerpts.

The following code, when placed in the child-theme’s function.php file, will add an extra ‘…read more’ trigger to the end of all excerpts. The data-swaptitle attribute defines the swaptitle for this extra trigger.

 add_filter( 'colomat_excerpt', 'my_excerpt', 10, 2 );
 function my_excerpt( $id, $excerpt ) {
     $excerpt .= ' <span class="collapseomatic" id="extra1-'.$id.'" data-swaptitle=" less"> more</span>';
     return $excerpt;

Then each shortcode that contains an excerpt will include the second trigger:

[expand title="I am a little tea-pot" excerpt="short and stout"]Here is my handle, here is my spout.[/expand]

And here is an example of the above in action:

I am a little tea-pot
short and stout
Here is my handle, here is my spout.

Next, what happens when there are multiple triggers with swaptitles? Let’s see.

[expand title="main trigger" swaptitle="main trigger swap" id="mankey"]this is the hidden text for this multi-target test[/expand]
<div id="extra1-mankey" class="collapseomatic" data-swaptitle="Trigger 2 Swap Titlte">Trigger 2</div>
<div id="extra2-mankey" class="collapseomatic" data-swaptitle="Trigger 3 Swap Titlte">Trigger 3</div>
main trigger
this is the hidden text for this multi-target test
Trigger 2
Trigger 3
hey dude

Guttenberg Collapse-O-Matic Image Embed

This is a little test of how to embed an image in a guttenberg expand shortcode block. The issue this aims to resolved can be found here.

since there is not an easy way to ‘insert’ an image inside a shortcode, the raw html will have to be placed. First we insert an image in a normal Gutenberg block:

Then we need to grab the html for that image by editing the block as html. The source for the above image is:

<img src="" alt="" class="wp-image-2398"/>

So we paste that in the shortcode block… so all togher it looks like:

[expand title="click to view image"] <img src="" alt="" class="wp-image-2398"/> [/expand]

And here is an example of the whole shebang in action:

click to view image

Countdown Timer with Offset

Warning: Undefined array key "tminus_exclude_dates" in /var/www/vhosts/ on line 267

Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /var/www/vhosts/ Stack trace: #0 /var/www/vhosts/ in_array() #1 /var/www/vhosts/ schedulator() #2 /var/www/vhosts/ launchTarget() #3 /var/www/vhosts/ WP_TMinusCountdown->shortcode() #4 [internal function]: do_shortcode_tag() #5 /var/www/vhosts/ preg_replace_callback() #6 /var/www/vhosts/ do_shortcode() #7 /var/www/vhosts/ WP_Hook->apply_filters() #8 /var/www/vhosts/ apply_filters() #9 /var/www/vhosts/ the_content() #10 /var/www/vhosts/ require('...') #11 /var/www/vhosts/ load_template() #12 /var/www/vhosts/ locate_template() #13 /var/www/vhosts/ get_template_part() #14 /var/www/vhosts/ include('...') #15 /var/www/vhosts/ require_once('...') #16 /var/www/vhosts/ require('...') #17 {main} thrown in /var/www/vhosts/ on line 40