Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WP Featured Images WordPress

I have a strange issue, which is that I have a set of posts that are recipes, but I would like to have the same image in the post as the featured image.

Is there a way to do this with a database script or within the database?

Answers (7)

2011-11-03

Fahad Murtaza answers:

Please explain what do you mean by " have the same image in the post as the featured image."


Greg Ellett comments:

sorry for the confusion.

1. I am running a recipe plugin that inserts an image, but the recipe itself is just a set of microformatted data that needs to be inserted into a post to display.
2. the post calls the recipe data block using a short code
3. The net result is that the post that has a recipe within it.

the issue is that I created a summary page that will automatically bring in posts and display the excerpt and featured image thumbnail.

The problem is that the post types do not have a featured image yet because it is actually in the recipe plugin data set.

I have the image and image path, so I was wondering if there was a way to automatically insert the image path of the featured image, but I can't find where in the database the URL is called.

Hope that makes sense.


Fahad Murtaza comments:

OK

If I understand your question right, try this plugin

http://wordpress.org/extend/plugins/add-post-thumbnail-shortcode/

Adds a [post_thumbnail] shortcode for use with wordpress post thumbnails. Also accepts [post_thumbnail size=""].

Just insert the shortcode into any post's content and when it will be replaced with the featured image.

This works only with the featured images introduced in WordPress 2.9.

So basically, you can use this short code anywhere within post content.


Fahad Murtaza comments:

OK

I got your message after I posted the last one, so I understand what you want but it wont be easy without understanding how the recipe plugin is working.

2011-11-03

Jens Filipsson answers:

You can show the featured image in your post, if that is what you mean. This code should do it. Add it to your single.php file:


<?php
// If WordPress 2.9 or above and a Post Thumbnail has been specified
if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>
<?php the_post_thumbnail('medium', array('alt' => ''.get_the_title().'')); ?>
<?php } ?>


Greg Ellett comments:

sorry for the confusion.

1. I am running a recipe plugin that inserts an image, but the recipe itself is just a set of microformatted data that needs to be inserted into a post to display.
2. the post calls the recipe data block using a short code
3. The net result is that the post that has a recipe within it.

the issue is that I created a summary page that will automatically bring in posts and display the excerpt and featured image thumbnail.

The problem is that the post types do not have a featured image yet because it is actually in the recipe plugin data set.

I have the image and image path, so I was wondering if there was a way to automatically insert the image path of the featured image, but I can't find where in the database the URL is called.

Hope that makes sense.

2011-11-03

Luis Abarca answers:

i dont get it, you want to show the featured thumbnail in the post content ??

If that is what you want you just need to add this before the_content() on the single.php


...
if ( has_post_thumnail() ) {
the_post_thumbnail('large'); // or medium, or any size you want
}

the_content();
...


Greg Ellett comments:

sorry for the confusion.

1. I am running a recipe plugin that inserts an image, but the recipe itself is just a set of microformatted data that needs to be inserted into a post to display.
2. the post calls the recipe data block using a short code
3. The net result is that the post that has a recipe within it.

the issue is that I created a summary page that will automatically bring in posts and display the excerpt and featured image thumbnail.

The problem is that the post types do not have a featured image yet because it is actually in the recipe plugin data set.

I have the image and image path, so I was wondering if there was a way to automatically insert the image path of the featured image, but I can't find where in the database the URL is called.

Hope that makes sense.

2011-11-03

Hai Bui answers:

You can use this plugin http://wordpress.org/extend/plugins/auto-post-thumbnail/ to "Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post or any custom post type only if Post Thumbnail is not set"

2011-11-03

juan manuel incaurgarat answers:

remember that when you set the featured image, there is a button to insert that image on the post as well

2011-11-03

Jatin Soni answers:

I usually use only this code to get featured image into post

<?php the_post_thumbnail(); ?>

This should get image from your featured image. If you have defined size you can assign it to display as below code.

<?php the_post_thumbnail('large'); ?> where large is your defined size code in function.php

like below

function.php
add_image_size( 'large', 970, 9999); // Featured Big Image doesn't crop the image
or
add_image_size( 'large', 970, 400, true); // Featured Big Image crop the image

2011-11-03

Clifford P answers:

I understand what you're asking. You need to pull from the plugin's data field. You're not asking about WP's built-in "featured image" functionality.

I would test if Hai Bu's recommended plugin does the trick. If not, let us know which recipe plugin you're using and we can go from there.

(Remember to backup before messing around - both files and database.)