Lucy Posted October 8, 2014 Share Posted October 8, 2014 Could someone point me in the right direction with this? Not expecting anyone to write the code up for me, and I suspect it's not possible, but anyhow... I'm making a Wordpress theme and want to enable my client to add an image to their posts that will act as a border. It will float to the left alongside the post. The issue is that the image needs to be inserted at the very top of the post to make this work; therefore, it sits before the ' <--more--> ' tag and currently shows up in post snippets. The images are going to be made to fit the full size post, so obviously this isn't going to look good. I have created a class for said images so I thought I might be able to use PHP to make it so images with that class will not show up in the short version of the post. Or is this more of a Javascript thing? Link to comment Share on other sites More sharing options...
niche Posted October 8, 2014 Share Posted October 8, 2014 please post the relevant code or supply a link of the current display. Link to comment Share on other sites More sharing options...
Ingolme Posted October 8, 2014 Share Posted October 8, 2014 You can use CSS to hide images. If they have a class name already you can select them by the class: HTML: <img src="..." alt="image" class="hidden-image"> CSS: .hidden-image { display: none; } Link to comment Share on other sites More sharing options...
Lucy Posted October 8, 2014 Author Share Posted October 8, 2014 You can use CSS to hide images. If they have a class name already you can select them by the class: I know, but I only want it to be hidden under some circumstances (when the post is not shown in full) - that's where I thought PHP might come in? Link to comment Share on other sites More sharing options...
Ingolme Posted October 8, 2014 Share Posted October 8, 2014 If you know which condition is the one which makes them appear or not you can put the class on the image using PHP: <img src="file.jpg" alt="image" <?php if($image_is_hidden) { echo 'class="hidden-image"'; } ?>> Change $image_is_hidden for whatever the condition is which hides the image. Link to comment Share on other sites More sharing options...
dsonesuk Posted October 9, 2014 Share Posted October 9, 2014 Usually a specific id or class identifies the type of post it is, use this to identify the short version of post you mentioned and use image class to show, hide resize to your needs. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now