Using Fancybox with WordPress Trim Words

Description

This is an example of how to use fancybox with wordpress trim words. The sections that says “a data-fancybox data-src=”#’ . get_the_ID() .” fynacially creates a popup window to display content from the id. Fancybox plugin must be installed in order for this to work

This is an example of how to use fancybox with wordpress trim words. The sections that says “a data-fancybox data-src=”#’ . get_the_ID() .” fynacially creates a popup window to display content from the id. Fancybox plugin must be installed in order for this to work

PHP Source Code

                        
                          <?php echo wp_trim_words( get_the_content(), 22, '...<a data-fancybox data-src="#' . get_the_ID() . '" href="javascript:;">Read More</a>' ); ?>

<!--Fancybox Start-->
<div style="display: none;" id="<?php the_ID(); ?>">
<p class="text-center"> <?php the_content(); ?>
</div>
<!--Fancybox End-->	
									
                        
                        


Post Categories