the_excerpt()
-
So I ran into something interesting regarding the the_excerpt() function.
I have this piece of code in my blog layout:
echo '<div class="box blog-item">'; /* Featured Image */ if ( has_post_thumbnail() ) : woffice_render_featured_image_single_post($post->ID, "", true); endif; /* Content */ echo '<div class="intern-padding">'; /* Title */ echo'<div class="intern-box box-title"> <h3><a href="'. get_the_permalink() .'">'.get_the_title().'</a></h3> </div>'; /* Excerpt */ echo '<p>'; the_excerpt(); echo '</p>';
Almost every blogpost contains normal text.
Some blogpost however contain an embedded PDF file.
What happens then, my blog page shows the pdfviewer shortcode instead of the PDF contents (which I completely understand).I am now searching for a way to edit that piece of code above so that if the the_excerpt() function contains the pdfviewer shortcode in it, it should replace it with a piece of text of my choice, for ex: “Click read more to view this post.”.
How can I achieve this?
Hope to hear from you asap!!Here is a screenshot of what I actually mean..: https://i.imgur.com/NRXCIaP.png
- The topic ‘the_excerpt()’ is closed to new replies.