Making a thumbnail if there exist a link with. jpg or .png extension in WordPress

1) Check out: http://codex.wordpress.org/Function_Reference/media_sideload_image 2) I found that WP function to be somewhat limited to I wrote my own wrapper class/method. If you want to do the same you’re going to need PHP’s copy() function http://us2.php.net/manual/en/function.copy.php as well as WP’s wp_insert_attachment() http://codex.wordpress.org/Function_Reference/wp_insert_attachment Unfortunately, I haven’t pushed my code to GitHub just yet, so for now … Read more

Advanced Custom Field User Help URL

I have this exact thing working on a current project. Here’s the code: <div class=”photo-feature” style=”background: url(<?php the_field(‘the-image’, $page->ID) ;?>) no-repeat center center; “></div> Keep in mind a couple of things: You may need to use $post->ID or $page->ID if you’re using a custom query. Make sure you’re not overriding your background CSS anywhere else … Read more

Wrapping Featured Image on Add/Edit Page in div?

When you post this question @PontusAbrahamsson answered you with a good function: function wpse_111428_change_feature_image_admin( $content ) { global $post; $size = 100; $id = get_post_meta( $post->ID, ‘_thumbnail_id’, true ); if( $id ) { return wp_get_attachment_link( $id, array( $size, $size ) ); } } add_filter( ‘admin_post_thumbnail_html’, ‘wpse_111428_change_feature_image_admin’ ); just replace it with a modded version that … Read more

Always generate thumbnail after sideloading image

You’ll have to use wp_generate_attachment_metadata and wp_update_attachment_metadata to do this. // sideload it into wordpress (generates various sizes) $thumbid = media_handle_sideload( $file_array, $post->ID ); if ( is_wp_error($thumbid) ) { // deal with error here } // If this function is undefined in the environment where it is to be used, // such as within a … Read more

How to remove featured images from posts

Use Developer tools in Google Chrome and see what section is responsible for displaying the featured image on post page. Open page.php or single.php (relevant file responsible for generating single page) and delete that code. Keep a backup of the file before making any changes 🙂

How to strip thumb from widget

You should remove this part: <?php if ( (function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail()) ) { ?> <div class=”widget-img”> <a href=”https://wordpress.stackexchange.com/questions/116533/<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_post_thumbnail(‘lists’); ?></a> </div><!–widget-img–> <?php } ?> . Just to explain… This conditional statement askes… if there is a thumbnail run the code in between me and my closing tag… <?php if … Read more

Set featured link not showing

your theme needs to support Post Thumbnails to have the featured image meta box… Add this to your functions.php file: add_theme_support( ‘post-thumbnails’ ); See http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails