Timeline for If post content exists (any post content), do not display featured image
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 24, 2012 at 20:26 | comment | added | Sergei Katalinski | Actually the code completely worked after I added it after: <?php else : ?> in my code in loop.php. Thanks again.... | |
Oct 24, 2012 at 12:53 | comment | added | Sergei Katalinski | Thanks for your reply. The featured image is there so it can take over the post if no post content is available, its just like a "filler" for empty post content. So, if no post to be posted, the image shows up instead, and if there is a post content then, featured image do not show. Thanks. | |
Oct 24, 2012 at 7:22 | comment | added | fuxia♦ | But why do you include the featured image in the post content if don’t want to show it always? The problem here is: featured is an attribute for all sizes of this one image, so it might be part of the content in a different size. Hard to find. | |
Oct 23, 2012 at 21:35 | comment | added | Sergei Katalinski | Sorry 4 that, your code works great, it displays whatever is in the post content. For example if I have a post with the post content in it and there is also a featured image there too, I want some kind of code to ignore the featured image and only to display the post content; on the other hand, if there is nothing in post to be displayed, then I want that featured image to be displayed. This is all done in the front page (homepage), so there is always going to be something to be displayed no matter if its post or featured image....Thanks | |
Oct 23, 2012 at 21:30 | comment | added | fuxia♦ | I am not sure I can follow. Could you try to edit your question to make that easier to understand? | |
Oct 23, 2012 at 21:19 | comment | added | Sergei Katalinski | Your code works same as what I had: <?php $pattern = get_shortcode_regex(); $matches = array(); preg_match_all("/$pattern/s", get_the_content(), $matches); echo preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $matches[0][0] ); ?> . I just cant figure out how to display post content without featured image showing up? But, I do want the featured image to show up if nothing else in post. Thanks again.... | |
Oct 23, 2012 at 21:18 | vote | accept | Sergei Katalinski | ||
Oct 23, 2012 at 20:36 | comment | added | fuxia♦ |
In a loop. You could encapsulate it in a function and move it to the functions.php but I think just using it as showed here will be easier to understand later.
|
|
Oct 23, 2012 at 20:23 | comment | added | Sergei Katalinski | Do I do this in loop or function.php? Thanks | |
Oct 23, 2012 at 20:17 | history | answered | fuxia♦ | CC BY-SA 3.0 |