Title: Randomize ads in PDF export?
Last modified: August 27, 2019

---

# Randomize ads in PDF export?

 *  Resolved [loggins](https://wordpress.org/support/users/loggins/)
 * (@loggins)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/)
 * WE have a feature which exports to a PDF file and would like to be able to randomize
   the ads used within AdvancedAds within the PDF. Is there code available to use
   to make this possible with the plugin?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Frandomize-ads-in-pdf-export%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11874157)
 * Hi loggins,
 * thanks for that interesting question.
 * It is possible that placements don’t work here due to some constrictions.
 * If shortcodes work in your files then you could try placing a group shortcode
   into the content and test with that.
 * Please let me know if this works or maybe a bit more about the technology behind
   it so that I can come up with a bit more.
 * Thanks,
    Thomas
 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11905376)
 * Hi [@loggins](https://wordpress.org/support/users/loggins/),
 * have you been able to make it work or is there still something I could help you
   with?
 * Best regards,
    Thomas
 *  Thread Starter [loggins](https://wordpress.org/support/users/loggins/)
 * (@loggins)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11907484)
 * Unfortunately, we have not been able to figure out the code to be able to pull
   in ads from Advanced Ads into MPDF.
 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11907507)
 * Thanks for your feedback.
 * If default shortcodes from WordPress won’t work here either then I fear there
   is nothing I can help with.
 * Best regards,
    Thomas
 *  Thread Starter [loggins](https://wordpress.org/support/users/loggins/)
 * (@loggins)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11907511)
 * Let me clarify what we are trying to accomplish. We use MPDF script (located 
   on a different domain) from our theme template using Advanced Ads. We are wanting
   to pull in the separate ad groups into our MPDF script, however i cannot seem
   to locate a direct code string (or link) which can called by MPDF where to pull
   the ads from (i.e. Ad Group ID: 8114) in our theme template.
 *  Thread Starter [loggins](https://wordpress.org/support/users/loggins/)
 * (@loggins)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11908290)
 * I have created a layout in wordpress with an Advanced Ad group here [https://newmusicweekly.com/tbuilder-layout/ac-ad/](https://newmusicweekly.com/tbuilder-layout/ac-ad/)
   however, in order for MPDF to recognize the image Advanced Ad would need to propagate
   an image, image tag, or something for it to be imported for MPDF use. Is this
   possible rather than just pointing to the “group” folder “ac-ad”?
 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11908628)
 * Hi loggins,
 * thanks for the details.
 * You can load the content of an ad group using something like this:
 *     ```
       $adgroup = new Advanced_Ads_Group( $group_id, $args );
       $ordered_ad_ids = $adgroup->get_ordered_ad_ids();
       echo $adgroup->output( $ordered_ad_ids );
       ```
   
 * By default, it should return you the HTML of a single ad.
 * You can find the code of that class in `advanced-ads/classes/ad_group.php`.
 * Does that help?
 * Best regards,
    Thomas

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Randomize ads in PDF export?’ is closed to new replies.

 * ![](https://ps.w.org/advanced-ads/assets/icon-256x256.gif?rev=2773443)
 * [Advanced Ads – Ad Manager & AdSense](https://wordpress.org/plugins/advanced-ads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-ads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-ads/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-ads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-ads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-ads/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/randomize-ads-in-pdf-export/#post-11908628)
 * Status: resolved