Astra_Ext_Advanced_Hooks_Loader::get_random_preview_post()
Get random preview post.
Description
Source
File: addons/advanced-hooks/classes/class-astra-ext-advanced-hooks-loader.php
public function get_random_preview_post() { $args = apply_filters( 'astra_addon_default_preview_post_query', array( 'posts_per_page' => 1, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'orderby' => 'rand', ) ); $single_product = new WP_Query( $args ); if ( ! $single_product->have_posts() ) { return false; } $post_id = absint( isset( $single_product->posts[0]->ID ) ? $single_product->posts[0]->ID : '' ); return( array( 'post_id' => $post_id, 'post_type' => 'post', 'post_title' => get_the_title( $post_id ), ) ); }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
4.3.1 | Introduced. |