And why not using simple wordpress code, changing args ?
$args = array(
'post_type' => 'post',
'orderby' => 'rand',
'posts_per_page' => '1',
);
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post();
/* do your post output here */
} // end while
} // end if
Related Posts:
- Automatically Creating Posts for Popular Forum Topics or Products [closed]
- Summary and Comments on Main landing Page
- get post excerpt by query
- Matching Chapters to a Custom posts [closed]
- WordPress comments not appearing in blog posts, likely because of Redux template. Could I fix this with a plugin that adds a comment form as a block? [closed]
- code is working properly in Core PHP but writing coding in WordPress
- How to add an automatic refresh in WordPress for a Page/Post or an embedded OneDrive/Excel HTML Code?
- WordPress display breadcrumbs using Yoast plugin [closed]
- Outbound link autometic converted into linkdirect , and not opening
- Display by Category in Admin
- Preg Match All doesn’t Allow echo first character for WordPress Taxonomy Tags
- How to allow an editor to edit all WordPress blog posts but have the last say as administrator?
- Add An Activity Filter By User Id In Buddypress Plugin
- Two problems on my WordPress installation [closed]
- Buddypress – Add the post_id in the bp_activity_add function
- posts comments goes to trash
- How to save inputed data in a textbox [EDITED] [duplicate]
- Contributive page where people logged in can write
- After plugin activation all users marked as Spam
- WordPress change Language not working
- Excerpts on category page
- How to pull email and name from Flamingo plugin
- Which widget to use for display category post with view more? [closed]
- External RSS feed to WordPress Portfolio
- Why namespaces are rarely used in WordPress plugins?
- Trying to fix form resubmition with PRG (Getting error: Cannot modify header information – headers already sent by)
- Display wordpress post’s in popup?
- media page returnig to 404 in rtmedia [closed]
- Unable to add TAB character to post?
- how to add text to posts from tags
- Implementing an image hosting website using WordPress? [closed]
- Add category selection to custom post type (plugin)
- Redirect to another page using contact form 7? [closed]
- Would Gutenberg be considered a PlugIn?
- pagination on data fetched using SQL query
- How to delete all trashed item in one-go
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- How to get the first post and second post in a wordpress blog?
- Is it possible to send blog posts via email to subscribers?
- Custom setup of wordpress comments that are displayed
- Is there any plugin which can paste a common content to my every post?
- Recent posts per category loop?
- ‘Organize Series Plugin’ as muti author feature
- Import Instagram post to WordPress blog post
- Problem of encoding characters (apostrophes) in my posts publications
- How to backup single post in wordpress [closed]
- Duplicate New User Registration notices (BuddyPress and bbPress both installed)
- How to get all posts belongs to a user between a certain date
- Remove / overwrite some functions in buddypress.js
- How do I publish portfolio items with a future date?
- wordpress content .php file in an iframe’s src in a wordpress post
- Making my plugin create a page?
- Is there a way to make the main page only display a brief description of the full article?
- How to change the post form from plugin?
- WordPress plugin Post Creation [closed]
- Don’t publish/update a post when a plugin finds errors in custom fields
- Allowing users to Sign-up > Login > Post articles that need approval
- Can I do in-page changes binding events/triggers to actions in WordPress?
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- posts from multiple post types in one slider
- How to display the featured post on the category page?
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Flickering sidebar when scrolling page [closed]
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- Moving FB comments at the end of page
- Where Should i write the code for wordpress ajax voting?
- download button for audio file in post [closed]
- check uncategorized category by default
- Print posts category or tag as a formatted journal
- how to execute some code after a post is published in WordPress [duplicate]
- Post status doesn’t update to ‘future’ every time?
- How to override the Buddypress bp-members folder’s file?
- Function added to hook “new_to_publish” not executing – custom plugin
- Creating an admin meta box to save post as pending
- wp_get_http has been deprecated. Use WP_Http instead
- trigger email when post is published by someone a user follows
- Grab ID from post from plugin and use it to create an object
- BuddyPress activity on edit post for a CPT
- Article content navigator in wordpress like mbaskool website
- WP::is_main_query() Not Working
- BuddyPress: filter member based on Xprofile Field
- I would like to remove date display on photo preview
- Post deleted in trash [closed]
- Getting a list of the published posts
- How to relate 3 wordpress components with each other (Create database relationships)
- Change website directory safely to add a static page on startup
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- If post exists in the database – each time goes on `else`
- Custom Template for wordpress cpt plugin
- override function from my plugin [closed]
- Embed PDF into wordpress
- Hook Scripts and Styles in WordPress
- Get data from wp_posts of mysql in to variables of wordpress-php script
- WordPress plugin: Getting posts where checkbox selected
- What hook can I use to modify custom post data before it is displayed on the page?
- get current page number with wp_link_pages()
- problem with register_activation_hook in plugin
- How can i summerize posts or news automatically in word press site?
- WordPress “Add new tag” button is not working
- Delete data from custom table when deleting a post