astra_get_option_meta( string $option_id, string $default = '', boolean $only_meta = false, string $extension = '', string $post_id = '' )
Return Theme options from postmeta.
Description
Parameters
- $option_id
-
(string) (Required) Option ID.
- $default
-
(string) (Optional) Option default value.
Default value: ''
- $only_meta
-
(boolean) (Optional) Get only meta value.
Default value: false
- $extension
-
(string) (Optional) Is value from extension.
Default value: ''
- $post_id
-
(string) (Optional) Get value from specific post by post ID.
Default value: ''
Return
(Mixed) Return option value.
Source
File: inc/core/common-functions.php
function astra_get_option_meta( $option_id, $default = '', $only_meta = false, $extension = '', $post_id = '' ) {
$post_id = ( '' != $post_id ) ? $post_id : astra_get_post_id();
$value = astra_get_option( $option_id, $default );
// Get value from option 'post-meta'.
if ( is_singular() || ( is_home() && ! is_front_page() ) ) {
$value = get_post_meta( $post_id, $option_id, true );
if ( empty( $value ) || 'default' == $value ) {
if ( true === $only_meta ) {
return false;
}
$value = astra_get_option( $option_id, $default );
}
}
/**
* Dynamic filter astra_get_option_meta_$option.
* $option_id is the name of the Astra Meta Setting.
*
* @since 1.0.20
* @var Mixed.
*/
return apply_filters( "astra_get_option_meta_{$option_id}", $value, $default, $default );
}
Expand full source code Collapse full source code View on Trac