Hide the first image but not in Smart List

Posted in: Newsmag
Post count: 199

I added this code in the functions.php to hide the first image of an article.

function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace(“/<img[^>]+\>/i”, “”, $content, 1);
} return $content;
}
add_filter(‘the_content’, ‘remove_first_image’);

I would, however, exclude it from the Smart List. How can I do?

Post count: 6600

Hi,

You could try to seraph for a specific string in the content so that when you find the smart lists on posts page you don;t apply the filter.
I suggest you get someone to help you with this if you don;t how to do it as you need custom work for this and we can’t offer any type of custom work for this. Sorry!

Thanks for the message!

Post count: 199

OK, then we can hide the first picture without deleting it from the Smart List?

Post count: 6600

Hi,

That filter, as it is right now, it doesn’t work like you want it. Like I stated above you need to alter it to detect the smart-lists on posts and not apply in those cases.
You need custom work for this so if you don’t know how to do it I suggest you get a freelancer or hire a developer to help you with it as we cannot provide custom work. Sorry!

Thanks for the message!

Post count: 199

Can’t help you? 🙂

I would like to hide the first images on all articles and leave only active on smart-list.

Post count: 6600

Hi,

Unfortunately not as you would need custom modifications for this and we cannot provide any type of custom work at this moment as we work hard on development, updates, fixes and support so the time and resources don’t allow us to provide custom work. Sorry!
I suggest you get a freelancer form site like: http://studio.envato.com/ ..if you really need this or search for a plugin that could help you do it.

Thanks for the message!

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newsmag’ is closed to new topics and replies.