I have added the style “background-position: center center;” and it work perfectly!
So the new code will look like this:
<?php
global $post;
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' );
?>
<div class="mainblogwrapper" style="background-image: url(<?php echo $src[0]; ?> ) !important; background-attachment : fixed;background-position: center center;">
Related Posts:
- How do I change/modify the_post_thumbnail(); html output?
- What’s the best way to use the Featured Image for responsive web design?
- Adding Featured Image to Post programatically
- How to upload imagick resource to media in wordpress
- How do I get images (with a thumbnail preview) to show in search results?
- Assign a picture URL to a page via PHP
- How to scale image with equal width and height without distortion?
- Echo URL of large version of Featured Image
- Recent posts with featured image or fallback image with permalink
- Set the background to a default image if there isn’t a specified “featured image”
- Three Questions with Twenty Eleven theme
- Resize image to specific dimension (X to Y ratio)
- Get featured image with custom size outside WordPress
- Else/If Statement to Display Photo Descriptions
- How to set a featured image (thumbnail) with PHP?
- Get the featured image url of clicked post
- Generate responsive post thumbnails of same size
- How to Make Thumbnail of Post Stay Animated
- not outputting medium size image URL
- Replace background image with post thumbnail in shortcode
- Resize post thumbnail
- Retrieving specific images from Media Library
- How to display thumbnail if post is assigned one otherwise not
- Setting post thumbnail sizes in template file and functions.php
- add if statement to the featured image
- Remove default Image Sizes
- Generate and upload screenshot as featured image for user-submitted post
- Restricting Image Upload Sizes using ‘wp_handle_upload_prefilter’ – Stuck media progress bar when Featured Image?
- Reprinting tags with all attributes
- How to get next image with this code from same post?
- Unread Repeater field IMG alt not working
- Can’t upload image using media_sideload_image
- Upload multiple images to a Woocomerce product
- How to use thumbnail size of image if I’m only using src to get image
- Display custom post type title as text if post thumbnail is not available
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- Accessing an image folder inside public web directory
- get_children displaying images removed from the page
- Why is image hard cropping for one image using add_image_size not working?
- Enable custom logo upload if logo is not in header
- Why my image upload button is not working in wordpress widget area?
- WordPress Multiple Navigation bars
- Scrape external webpage for first image and add it to new post
- How to make own crop image function for WordPress plugin
- “imagejpeg” function is not working in wordpress
- Display image from an external rss feed on wordpress without plugins
- Using Select HTML in Bootstrap Popovers
- Add class to group inner container
- Redirect to another page using contact form 7? [closed]
- Custom Background by Page IDs
- WordPress style.css not updating, only after theme reload
- WordPress automatically adds links to uploaded images
- post thumbnail, conditions, else wont work
- WordPress function when file is uploaded, deleted or edited
- ‘Post-thumbnails’ feature does not seem to register
- height should be set to auto to avoid pixelation in the post thumbnail function
- Download images from media library to computer in BULK?
- Display related posts without a plugin
- How to loop through all the attached images in a post, and get their url one by one
- Which function crops images in wordpress?
- WordPress function and string as variable?
- Division by zero error in image.php
- How can I automatically resize up images to fit into all of my registered image sizes
- Clickable image link sends people to wrong URL
- Apply class to every third list item? [duplicate]
- Only show image from custom field when present
- Timthumb.php image gallery not working on Multisite WordPress
- Upload non-featured image to image field
- Automatically add images to a menu
- Where are the src and srcset sizes coming from?
- HTML showing after PHP code in tag
- My website is not showing Footer section
- Only show first image in foreach loop
- trying to get wp_get_attachment_url to output clickable link
- Using featured image of blog archive page
- Change default gallery images – Currently they are displaying full size imagese
- if custom field doesn’t exist, use post thumbnail instead, as image background
- I’m unable to call img path using single quotes in an array?
- Creating black and white copy of an image [closed]
- Bootstrap Carousel HTML structure and funny output [closed]
- Help Fallback (thumbnail)
- Handling repeater data
- Get the id of all images in a post
- Shortcode function doesnt work without caption
- How to add post thumbnail dynamically using Jquery?
- Images Uploaded saving onto older/previous year folders
- Posts are not looping through correctly
- Display an image based on field value
- Add valid XHTML closing img tags to WordPress galleries
- Convert canvas to image and upload image to server
- How to change thumbnail src attribute?
- Error display post thumbnails for previous and next post
- Controlling image output size ACF repeater [closed]
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- WordPress İmages Upload & Delete Error
- Fallback image URL if no featured image exists via a shortcode function
- How to replace URL protocol using PHP?
- Call featured image url
- How to pick “full/thumbnail” images in the loop?
- Why in this WordPress theme I can’t see the Main Menu?