Random Featured Image Based on Category

First of all when you call the get_image function pass the post categories slugs as param. Edit your autoset_featured function replacing … } else { set_post_thumbnail($post->ID, get_image()); } … with: … } else { $cat_slugs = wp_get_post_terms($post->ID, ‘event-categories’, array(“fields” => “slugs”)); $image = get_image( $cat_slugs ); if ( image ) set_post_thumbnail($post->ID, $image); } … Then … Read more

Disable post thumbnails in Twenty Thirteen child theme

How can we force has_post_thumbnails() to return false? Method #1 – disable theme support: You can remove the post thumbnails support from the backend, with function twentythirteen_child_setup() { remove_theme_support( ‘post-thumbnails’ ); } add_action( ‘after_setup_theme’, ‘twentythirteen_child_setup’, 11 ); but notice that this will not remove the featured images. If the _thumbnail_id post meta value is non-empty, … Read more

How to set post thumbnail size?

First add the following code to your theme functions.php: add_image_size( ‘square-150’, 150, 150, true ) In sarkpress-function.php file, change this line: <?php the_post_thumbnail(); ?> to: <?php the_post_thumbnail(‘square-150’); ?> You would have to regenerate your images by using Regenerate Thumbnails plugin Preferences: https://codex.wordpress.org/Function_Reference/the_post_thumbnail https://codex.wordpress.org/Function_Reference/add_image_size

Unable to set featured image

Try checking your Browsers Javascript console, Media Library in WordPress is heavily depended on javascript’s such as jQuery. also if your Javascript is broken due to concatenation, then add the below line in your wp-config.php file. define( ‘CONCATENATE_SCRIPTS’, false ); Or you can even try re-installing WordPress.