Expert Group of programming
Loading...

Upload images in WP Post Attachment

Posted by : Heycode Tech | Posted in : Admin Feature, wordpress | Sep 26,2015 | 0 comments

The article explains about uploading the images in post attachment. Now post attachment images are connected to our posts and will get when ever we needed . Here is the steps how we can upload it .

Before uploading the images, we understand that you have already logged in with ADMIN credentials .

Step-1 : Click on the button ” Add Media ” .

step-1

Step-2: We need to select the option “Uploaded to this post” .
i)- Now when you will select this option then it will show all uploaded image i.e post attachment image in post.
ii)-Now if you are not uploading any images in previously then a screen will show for uploading the images.

step-2
Note : Now you can upload the multiple image.

Step-3: When you will upload the image then just close the screen . Now these images will automatically uploaded on your post.

step-3

Your work for uploading images on POST Attachment have been done . Finish .

How to call these images in Front end
Use the function : get_posts with parameter : post_parent= 'current_post_id', 'post_type'='attachment' then it will be get all the post attachment images.

$attachments = get_posts( array(
    'post_parent' => $post->ID,
    'post_type' => 'attachment',
    'post_mime_type' => 'image'
) );
print_r($attachments);
it will print all the images of the post attachment. 

Now for more detailed, please visit on : codex.wordpress.org or you can leave a comment also . I will reply you soon.

Tags:

Author information - Heycode Tech

Every world can ask question and my website registered user give the suggestion.

See all posts by Author

Connect to author

About us

Heycodetech is a platform where you can ask any questions related to the programming like PHP,jQuery, MYSQL,HTML , CSS and moreHere is the Expert group of programming.