Do not use the Featured Image

January 2013 WordPress Theme
GK User
Sun Jan 27, 2013 3:42 pm
There are Users who do not use featured image feature. I have seen that In category pages, if my posts have no featured image, then it will just show the text. Same thing is with some of the plugins you have provided, they only fetch featured images.

It would be great if you guys provide an option to fetch first image as well.

Thanks.
User avatar
Senior Boarder

GK User
Sun Jan 27, 2013 6:21 pm
Hi,

Sorry but it is connected with the WordPress engine - the HTML images inside the content are not displayed in the excerpt of the post. This is a standard way of adding main image to the article, and currently we have no plans to change this behaviour also in our widgets.
User avatar
Administrator

GK User
Mon Jan 28, 2013 5:49 am
Is there a possibility to add featured image after the first paragraph of every post? [As far as I have seen, it above the post.]
Also, is there any plugin available to convert first images of all the posts into featured images?

Thanks.
User avatar
Senior Boarder

GK User
Mon Jan 28, 2013 8:44 am
puneetjain wrote:Is there a possibility to add featured image after the first paragraph of every post? [As far as I have seen, it above the post.]


Sorry but there is no way to place the featured image after first paragraph - you can only place the featured image before the whole text - the featured image is loaded by this line in all content*.php files:

Code: Select all
<?php include('layouts/content.post.featured.php'); ?>


BUT NOW I HAVE GOOD IDEA and solution for your problem (regarding your second question):

puneetjain wrote:Also, is there any plugin available to convert first images of all the posts into featured images?


I don't see any plugins, but you can try tips like this: http://www.technophileshub.com/1306/set ... ress-posts

Remember to backup your database before this operation!

If you will do this then probably you will have the same image DUPLICATED - as featured image and as image in the content. If yes, please try to make the following change in layouts/content.featured.php.php file:

Fragment:

Code: Select all
<?php if(has_post_thumbnail()) : ?>
<figure class="featured-image">
   <?php the_post_thumbnail(); ?>
</figure>
<?php endif; ?>


Please replace to:

Code: Select all
<?php if(has_post_thumbnail() && ( is_search() || is_archive() || is_tag() )) : ?>
<figure class="featured-image">
   <?php the_post_thumbnail(); ?>
</figure>
<?php endif; ?>


THEN

the featured image won't be displayed on the single post page (the first image will be still displayed)

AND

on the category/tag/search/archive/author pages the first image won't be displayed (because the excerpt doesn't display it) BUT the featured image (the same as the first image) will be displayed there due these changes.

BUT as I wrote - it will work only if the mentioned SQL code will cause that the article will contain two the same images - featured image and first image (this code works only if the images was added to the post using the Media Manager).

IF it will works - please remember to always set in the new articles the featured image as the same as the first image.

Hope this will help :)
User avatar
Administrator

GK User
Tue Jan 29, 2013 7:53 am
Thanks for the nice explanation.

I am not a coder, but is there a possibility where a code can be used to insert featured image after the first </p> , by this way featured image will be below the first paragraph.
User avatar
Senior Boarder

GK User
Tue Jan 29, 2013 9:35 am
Did you read my previous post? It is a solution for this problem. Please read it once again and carefully.
User avatar
Administrator

GK User
Tue Feb 05, 2013 10:30 am
Yes, I read that. But I did not want to make any changes in mysql. Anyways I did some more search and got a php code to be added in functions.php to resolve this. I also used the code you have shared in your earlier post.
User avatar
Senior Boarder

GK User
Tue Feb 05, 2013 10:35 am
Please share your code here, maybe it will be useful for our other members :)
User avatar
Administrator

GK User
Tue Feb 05, 2013 11:17 am
Here you go. One needs to put this code in functions.php

Code: Select all
function autoset_featured() {
          global $post;
          $already_has_thumb = has_post_thumbnail($post->ID);
              if (!$already_has_thumb)  {
              $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
                          if ($attached_image) {
                                foreach ($attached_image as $attachment_id => $attachment) {
                                set_post_thumbnail($post->ID, $attachment_id);
                                }
                           }
                        }
      }
add_action('the_post', 'autoset_featured');
add_action('save_post', 'autoset_featured');
add_action('draft_to_publish', 'autoset_featured');
add_action('new_to_publish', 'autoset_featured');
add_action('pending_to_publish', 'autoset_featured');
add_action('future_to_publish', 'autoset_featured');



Also, you will have to use the php code you have shared below to avoid image duplication on post page.

:)
User avatar
Senior Boarder

GK User
Fri Nov 15, 2013 8:04 pm
This doesn't work with the version 1.4. Please help. How can I remove featured image from the article.
User avatar
Senior Boarder

GK User
Sat Nov 16, 2013 11:47 am
First of all - the update didn't overrided your changes in the theme code?
User avatar
Administrator

GK User
Sat Nov 16, 2013 4:43 pm
I came back here, because it did. When I updated the theme, I started seeing featured image again, which is obvious. To remove it I try to follow the instruction in this thread, however I could not do that as there are some changes in the file. If you want I can share the file which I am seeing in v1.4 here.
User avatar
Senior Boarder

GK User
Sat Nov 16, 2013 4:53 pm
Let's forget this, instead of getting into any kind of arguments. Let's say I directly used v1.4 without using any of the earlier versions. Now if I don't want to show featured image on my posts, can you please help me with that.

Thanks.
User avatar
Senior Boarder

GK User
Sun Nov 17, 2013 12:40 pm
This below solution didn't help you?

dziudek wrote:
puneetjain wrote:Is there a possibility to add featured image after the first paragraph of every post? [As far as I have seen, it above the post.]


Sorry but there is no way to place the featured image after first paragraph - you can only place the featured image before the whole text - the featured image is loaded by this line in all content*.php files:

Code: Select all
<?php include('layouts/content.post.featured.php'); ?>


BUT NOW I HAVE GOOD IDEA and solution for your problem (regarding your second question):

puneetjain wrote:Also, is there any plugin available to convert first images of all the posts into featured images?


I don't see any plugins, but you can try tips like this: http://www.technophileshub.com/1306/set ... ress-posts

Remember to backup your database before this operation!

If you will do this then probably you will have the same image DUPLICATED - as featured image and as image in the content. If yes, please try to make the following change in layouts/content.featured.php.php file:

Fragment:

Code: Select all
<?php if(has_post_thumbnail()) : ?>
<figure class="featured-image">
   <?php the_post_thumbnail(); ?>
</figure>
<?php endif; ?>


Please replace to:

Code: Select all
<?php if(has_post_thumbnail() && ( is_search() || is_archive() || is_tag() )) : ?>
<figure class="featured-image">
   <?php the_post_thumbnail(); ?>
</figure>
<?php endif; ?>


THEN

the featured image won't be displayed on the single post page (the first image will be still displayed)

AND

on the category/tag/search/archive/author pages the first image won't be displayed (because the excerpt doesn't display it) BUT the featured image (the same as the first image) will be displayed there due these changes.

BUT as I wrote - it will work only if the mentioned SQL code will cause that the article will contain two the same images - featured image and first image (this code works only if the images was added to the post using the Media Manager).

IF it will works - please remember to always set in the new articles the featured image as the same as the first image.

Hope this will help :)
User avatar
Administrator


cron