As far I understood you want to set the value of $id
randomly from adzones
post type post ids. I hope this helps you-
$args = array(
'orderby' => 'rand',
'posts_per_page' => '1',
'post_type' => 'adzones'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$id = get_the_ID();
echo do_shortcode("[pro_ad_display_adzone id=".$id."]");
endwhile;
Related Posts:
- How do I create a link that will always show the latest post?
- What is the difference between “post” and “page” in WordPress?
- Understand post type
- View the number of entries recorded per day
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- Post type no single page
- Target only single product page
- Woocommerce – custom post type of checkout page
- Taxonomy Category category.php not working
- How can I get the first post THIS SAME CATEGORY?
- How do i retrive a post from a custom post type
- How to get only post=’product’
- is it possible to get next_post_link
- Code to make a post sticky
- How to receive HTTP POST in WP?
- Why declare $post globally?
- Modify ‘Read more’ link adding a new class
- Modifying admin sidebar contents to show pending posts indicator
- Open WordPress ‘Add New Post’ admin page with parameters set via $_GET
- How to query posts with current or future date only
- When a user creates a post (pending), send a confirmation link that allows them to publish
- Get post only from ‘standard’ post format
- Add “Post Options” for new wordpress post
- How do I change the gallery that is inserted in the post?
- How can I export and then import posts with featured images?
- Posts Page Featured Image [closed]
- Use template of parent category for single post sub-categories
- How to add shortcode tags in single.php [closed]
- get post id in while loops outputting page id
- Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}
- Can’t publish new posts
- Two posts are loaded instead of one?
- how to find user ids of all commenters in a post
- When I re-save a post with [code] sections, the entities are double-escaped (> becomes > etc)
- How can I write comments/hidden text in a post?
- Automatic post deletion
- Lose “Blog Archive” from page title
- Should a photo gallery be in a post or on a page?
- Getting category posts from a certain year
- Add custom Facebook share link with share count and variable text
- How can I show many posts an author has per week?
- Disable inline_edit() on edit.php
- Display post X of Y in category
- custom post scheduler for drafts
- Help with Taxonomies
- Ajaxify This Code
- ERROR: Your feed is invalid (after update WP4.7) in custom types
- How do I display some posts fully on the homepage, and some as an excerpt only?
- How to bulk add vast amounts of posts
- 301 (static page instead latest posts)
- Users problem (multi-author plus multisite)
- Filter only the text in the_content
- Saving custom fields to a custom taxonomy
- (solved) getting post author’s user role
- Block editors annoying warnings
- Add get_the_tags() to Single Posts section via functions.php
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Force fill all fields when creating a new post
- Posts Missing in Dashboard after update
- Display recent posts from portfolio
- Auto update post title and slug when post status is changed
- How to make related post order by random?
- Accessing Post ID Within Loop
- Retrieving posts by their date and category
- WordPress displays post on subcategory only
- Update field in database for users
- wp-link-pages in header and footer of the post
- get last post’s link with SQL query
- Output Buffer Issue with Single Post View
- In admin panel, use a form to create a post?
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- Actions to use when flushing cache (when posts are added / deleted / modified)
- WP query taxonomy optimization
- can’t modify post title using the_posts filter
- How Do I Redirect WordPress Pages but not posts?
- Why is my custom post content only viewable when signed into WordPress?
- Single Post Gallery Using Shortcode
- Author post count in category
- How to show only homepage in google results instead of privacy, contact pages
- Post count doesn’t match number of posts shown in list in admin
- Show post count in custom taxonomy page
- how let users select categories for posts in frontend?
- Unable to get all the Posts Attachments
- view a list of 3 future post, from the nearest to the most far
- Category URL to use same string as Post URL Permalink
- Why do some post, listed under the “Mine” Tab, and the same posts listed tunder “Published” Tab
- Printable Page with all Posts from Tag
- Why the blog posts is not showing?
- WordPress search for specific Post Type
- Get the correct meta_value with get_post_meta
- How to get the postID inside ‘content_save_pre’? Other hook?
- Gallery just showing plain short code like [gallery ids="240,236,275"]. how to solve this?
- Posts are being posted in two categories instead of 1
- How can I change the look of a post as is displayed
- Show related (archive) month and year to post
- associate posts to a page
- Sort by category and then date?
- Display a custom field rating system in the front end
- the_time() cannot be placed correctly
- excerpt in template for specific page