astra_get_post_id( string $post_id_override = '' )
Get post ID.
Description
Parameters
- $post_id_override
-
(string) (Optional) Get override post ID.
Default value: ''
Return
(number) Post ID.
Source
File: inc/core/common-functions.php
function astra_get_post_id( $post_id_override = '' ) { if ( null == Astra_Theme_Options::$post_id ) { global $post; $post_id = 0; if ( is_home() ) { $post_id = get_option( 'page_for_posts' ); } elseif ( is_archive() ) { global $wp_query; $post_id = $wp_query->get_queried_object_id(); } elseif ( isset( $post->ID ) && ! is_search() && ! is_category() ) { $post_id = $post->ID; } Astra_Theme_Options::$post_id = $post_id; } return apply_filters( 'astra_get_post_id', Astra_Theme_Options::$post_id, $post_id_override ); }
Expand full source code Collapse full source code View on Trac