wordpress - Exclude Images in Post from attachment images -


I am using a simple jQuery image slideshow in single.php, which calls all image attachments in my post But I want to exclude the images posted in the actual post, but really have to keep all the images related to the post.

I am using this code to capture all image attachments, but unfortunately, this post is also about grabbing all the images within the content, which is not necessary: ​​

  & lt ;? Php $ attachs = get_posts (array ('numberposts' => gt; -1,' post_type '= & gt;' attachment ',' post_perrent '= & gt; get_the_ID (),' post_mime_type '= & gt;' / / Enclosed images only 'output' = & gt; ARRAY_A)); Receive the source of the image based on the size ($!) (Attach $ $) {foreach ($ $ as $ et), // // 'thumbnail', 'medium', 'big', 'Complete' // can be registered or thumbnail size; $ src = wp_get_attachment_image_src ($ et-> id, 'full'); $ Src = $ src [0]; // show image echo "

Any recommendations?

Unfortunately there is no difference between images and images contained in a post in WordPress. For example, "_inserted_image" is a common solution used on the Web to add a meta data called "true", and when you put inline and image inline in the post, use the hook to update this value. Please. In my opinion a little too complicated.

A simple solution would be to create a category specifically for your slideshow and put all the images created for the slide show in this category from the Media Library at the same time. Then just 'Category' = & gt; Add the position of 'For_SloidesShow' for the posts for you.

  $ attaches = gate_posts (array ('numberposts' => gt; -1, 'post_type' = & gt; 'attachment', 'post_perrent' = & gt; get_the_ID () , 'Post_mime_type' = & gt; 'image', // attached images only 'output' = & gt; ARRAY_A, 'category' = & gt; 'for_slideshows'));   

Hope it helps.

Comments