How to get the “advert” Featured Image URL?
-
Hi, i’ve a problem with the featured image/thumbnail
i’ve added this code to the functions.php:
add_action("adverts_post_type", "customize_adverts_post_type"); function customize_adverts_post_type( $args ) { $args["supports"][] = "thumbnail"; return $args; }
It All works, i can set the featured image and all works.
Now, My question is: how do i get the featured image URL?
something like “get the post thumbnail” which contains the advert post ID too.
I need to use it in another plugin (onesignal) for push notifications on my iOS app.at the moment i’ve this
$image = adverts_get_main_image( get_the_ID() ); $fields['ios_attachments'] = array ('img1' => esc_attr($image),);
this works but it’s wrong.. because it doesn’t show the correct image for every post i publish, it always shows the latest image uploaded in the gallery
CASE 1: when i publish the adverts in real time it works, in the push notification i see the right image (because it’s also the latest in the gallery) but..
CASE 2: when i schedule the adverts, for example 5 posts, for every publication it always shows the latest image uploaded in the gallery. So Post 1, post 2 , post 3, and post 4 will always show the Post 5 image
I think this happens because i use a wrong code to recall the advert-post image, how can i do it properly?
- The topic ‘How to get the “advert” Featured Image URL?’ is closed to new replies.