Display featured image on blog page
Display featured image on blog page
Display featured image on blog page
You can try the following: /** * Get the featured image by post title (Simple version) * * @see http://wordpress.stackexchange.com/a/158344/26350 * @param string $title Post title * @param mixed $size Featured image size */ function get_featured_image_by_post_title_wpse_simple( $title=””, $size=”thumbnail” ) { $obj = get_page_by_title( $title, OBJECT, ‘post’ ); return ( is_object ( $obj ) ) ? … Read more
This is pseudo-code answer. First get the posts you want with get_posts (you can pass the post_type as an argument) Then get the ID of the images you want to set as thumnbail Now do a loop and try with a query similar to this one: “UPDATE wp_postmeta SET meta_value = $image_id WHERE post_id = … Read more
It’s even easier than what you did. . Copy the entire wp structure from the old server to the new, mysql backup the database with creates enabled and import to the new database (preferably blank) . Then just edit the wp configuration file for the new locations of everything (including database name) . I have … Read more
Add notice to add image popup
Not sure how you do it in your single.php, but I’m fairly certain not the same way. The main problem is that both the_post_thumbnail() and get_the_post_thumbnail() are generating the img tag output for you – so putting it into the src attribute of an img tag like in your code can’t work. Additionally: The latter … Read more
change true to false in set_post_thumbnail_size( 760, 330, true ) add_theme_support( ‘post-thumbnails’ ); set_post_thumbnail_size( 760, 330, false ); This will make it not crop automatically.
the_post_thumbnail allows for size specificiations. So you would do: <?php the_post_thumbnail(‘medium’); ?> if you changed the image dimensions in the admin, you will need to go back and re-upload the images so they crop to the correct size that you set up If the issue is the dimensions of the image you are probably looking … Read more
So the quickest and easiest way to resolve this is to add and run the plugin Regenerate Thumbnails as Pieter Goosen suggested. Back up your db first!
While looking at some code for another issue I had a lightbulb went off in my head and brought me back to this problem. So after several tries at it I came up with this… function add_image_to_feed( $thumbz){ if( is_feed() ){ $def_thmb = get_post_meta( get_the_ID(),’def_thmb’,true); $subPath = tube_sub_dir_path(get_the_ID()); $upload_dir = wp_upload_dir(); $thumb_ur = $upload_dir[baseurl].”/tube-thumbs/”.$subPath.””; $thumbz … Read more