• Resolved exitghost

    (@exitghost)


    Hi there,

    Love this plugin. Was wondering if there’s a way to activate SLB for photos in excerpts?
    I tried following along with this but couldn’t quite seem to figure it out:
    https://archetyped.com/lab/slb-2-3-0/

    This is how my theme calls the excerpt (for the home page and archive / category pages):

    <?php if ( ( is_search() && get_theme_mod(‘athemes_search_excerpt’) ==” ) || ( is_home() && get_theme_mod(‘athemes_home_excerpt’) ==” ) || ( is_archive() && get_theme_mod(‘athemes_arch_excerpt’) ==” ) ) : ?>
    <div class=”entry-summary”>
    <?php the_excerpt(); ?>
    <!– .entry-summary –></div>
    <?php else : ?>
    <div class=”clearfix entry-content”>
    <?php the_content( __( ‘Continue Reading <span class=”meta-nav”>→</span>’, ‘athemes’ ) ); ?>
    <?php wp_link_pages( array( ‘before’ => ‘<div class=”page-links”>’ . __( ‘Pages:’, ‘athemes’ ), ‘after’ => ‘</div>’ ) ); ?>
    <!– .entry-content –></div>
    <?php endif; ?>

    Thank you!

    https://www.ads-software.com/plugins/simple-lightbox/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Archetyped

    (@archetyped)

    Hi,

    WordPress strips HTML from excerpts by default, so SLB does not directly support excerpts.

    You can use get_the_excerpt() to save the excerpt content to a variable, which you can then activate with slb_activate() like so:

    $excerpt = get_the_excerpt();
    echo slb_activate($excerpt);
    
    Thread Starter exitghost

    (@exitghost)

    Great, thank you, this worked wonderfully with getting the images in excerpt to open with SLB and keeping most of my formatting.

    Only thing is I use Rich Text Excerpts to create my excerpts and using this removes paragraph spacing / formatting.

    Just a matter of which one I would want to sacrifice for the home page. Either way, still a handy fix. Thank you!

    Plugin Author Archetyped

    (@archetyped)

    You can use output buffering in PHP to save the output generated by the_excerpt() to a variable (rather than it immediately printing to the page). You can then use slb_activate() on this variable to activate SLB for any links in the rich excerpt.

    Thread Starter exitghost

    (@exitghost)

    Thanks so much for the tip. I wish I knew what all this meant and that I could figure out how to implement it in my code. But I really do appreciate the help! Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Lightbox and excerpts?’ is closed to new replies.