/** * Return a CPT Archive setting value from the options table. * * @since 2.0.0 * * @uses genesis_get_global_post_type_name() Get the `post_type` from the global `$post` if supplied value is empty. * @uses genesis_get_option() Return option from the options table and cache result. * @uses GENESIS_CPT_ARCHIVE_SETTINGS_FIELD_PREFIX * * @param string $key Option name. * @param string $post_type_name Post type name. * @param bool $use_cache Optional. Whether to use the Genesis cache value or not. Defaults to true. * * @return mixed The option value. */ function genesis_get_cpt_option($key, $post_type_name = '', $use_cache = true) { $post_type_name = genesis_get_global_post_type_name($post_type_name); return genesis_get_option($key, GENESIS_CPT_ARCHIVE_SETTINGS_FIELD_PREFIX . $post_type_name, $use_cache); }
/** * Check if a post type supports an archive setting page. * * @since 2.0.0 * * @uses genesis_get_global_post_type_name() Get the `post_type` from the global `$post` if supplied value is empty. * @uses genesis_get_cpt_archive_types_names() Get list of custom post type names which need an archive settings page. * * @param string $post_type_name Post type name. * * @return bool True if custom post type name has support, false otherwise. */ function genesis_has_post_type_archive_support($post_type_name = '') { $post_type_name = genesis_get_global_post_type_name($post_type_name); return in_array($post_type_name, genesis_get_cpt_archive_types_names()) && post_type_supports($post_type_name, 'genesis-cpt-archives-settings'); }