Jump to content
Sign in to follow this  
gremmie

PlatformPro Feature Slider Excerpt Image

Recommended Posts

gremmie

Hello again. Quick question. I use an image as part of my excerpts on a majority of blog posts. As some of those posts wind up in the feature slider (based on Category), I've noticed that the bottom-side transparent excerpt includes a cropped version of the image and some of the text. How do I ensure the images do not appear in feature slider text excerpt?

Share this post


Link to post
Share on other sites
cmunns

Interesting dilemma. Are you using Base? I would add this filter to the functions.php file ` add_filter( 'the_excerpt', 'my_excerpt' ); function my_excerpt( $content ) { return preg_replace( '/(<)(%7Boption%7D)(w+)([^>]*>)/','', $content ); echo $content; } `

Share this post


Link to post
Share on other sites
Andrew

Hmm... are you adding images to your excerpts? How are they getting there in the first place?

Share this post


Link to post
Share on other sites
gremmie

Yes I add images to my excerpts because when a user clicks on a category, a page of worth of nice, neat excerpts pops up with what is basically a feature thumb attached to each. Also, when a blog post is displayed on the front page, the thumb gives the post a bit more flair. Apologies for not providing the site address, we're under construction at the moment and the only way in is by providing me with an exception IP. Otherwise, you'd just see the under construction page. If you provide your IP, I'll be happy to add you to the list. That way you can view the site. www.gremmie.net

Share this post


Link to post
Share on other sites
gremmie

cmunns, the only problem with your solution is that it also removes the image from any excerpt, not just the feature slider. i'm trying to isolate the removal within the feature slider.

Share this post


Link to post
Share on other sites
Kate

@Matthew I did forward this, but will do so again. Thanks for your patience.

Share this post


Link to post
Share on other sites
cmunns

Matthew we can modify the code I provided with a conditional and you'll be good to go ` if( get_post_type() == 'feature' ): add_filter( 'the_excerpt', 'my_excerpt' ); function my_excerpt( $content ) { return preg_replace( '/(<)(%7Boption%7D)(w+)([^>]*>)/','', $content ); echo $content; } endif; `

Share this post


Link to post
Share on other sites
gremmie

@cmunns This approach doesn't apply here because all posts, even the ones that are chosen (by category) for the feature, are of type 'post', not type 'feature'. I guess I need to figure out how to identify that I am in the loop that is constructing the feature rather than the posts themselves being distinguishable from other posts. Thoughts?

Share this post


Link to post
Share on other sites
gremmie

@cmunns it occurred to me that while it would be nice to filter the image out of the feature excerpts so they aren't sent to the browser, I could also just let them stay and hide them with CSS. So:

div.ftext img
	{
	display: none;
	}

That was the easy fix for this!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×