Images not showing after changing wp-content folder name

The safe way to change wp-content folder, is the following: First, define the new wp-content name in your wp-config.php file: define (‘WP_CONTENT_FOLDERNAME’, ‘hamza’); Then, define the new path for images, style, scripts, etc: define (‘WP_CONTENT_DIR’, ABSPATH . WP_CONTENT_FOLDERNAME) ; define(‘WP_CONTENT_URL’, WP_SITEURL . WP_CONTENT_FOLDERNAME); This will allow your plugins and other stuff to be notified about … Read more

Adding different backgrounds for different pages

It would be helpful if you’ve said your CSS selector is whether not working or it’s working but the image just doesn’t appear. You also didn’t clarify if your image should appear literally behind the entire page (header, content and footer) or just behind the content. Anyway, Enfold adds a background-color property to almost every … Read more

Comma separated all attached image ID numbers except featured image ID number

If we want to exclude the featured post image then here’s the one-liner updated: $ids = join( ‘,’, wp_filter_object_list( get_attached_media(‘image’ ), [ ‘ID’ => get_post_thumbnail_id() ], ‘NOT’, ‘ID’ ) ); here it’s expanded: $ids = join( ‘,’, // join array by comma wp_filter_object_list( get_attached_media(‘image’ ), // fetch attached images [ ‘ID’ => get_post_thumbnail_id() ], // … Read more

add_image_size for header_image

This may can help you add_theme_support( ‘post-thumbnails’, array( ‘post’ ,’promotions’, ‘services’, ‘counter’) ); set_post_thumbnail_size( 200, 200, true ); add_image_size( ‘slider-image’, true ); Image will resize according to your html code

Random Size on Featured Image

You can put the sizes into an array and use PHP’s array_rand to choose a random size: $sizes = array( ‘small’, ‘medium’, ‘large’ ); foreach( $pages as $page ){ $random_size = array_rand( $sizes, 1 ); echo get_the_post_thumbnail( $page->ID, $sizes[$random_size] ); }

Generating different dimension images while uploading image file from custom plugin page

Resized different dimension image sets are generated by using wp_generate_attachment_metadata and wp_update_attachment_metadata method. $absFilename = $wp_upload_dir[‘path’].”https://wordpress.stackexchange.com/”.$filename; $attach_data = wp_generate_attachment_metadata( $attach_id, $absFilename); wp_update_attachment_metadata( $attach_id, $attach_data ); This will update the image details in the wp_postmeta table. Thanks @DaveRomsey