';
}
}
add_action( 'wp_head', 'wpbf_pingback_header' );
/**
* Schema markup (body).
*/
function wpbf_body_schema_markup() {
// Blog variable.
$is_blog = ( is_home() || is_date() || is_category() || is_author() || is_tag() || is_attachment() || is_singular( 'post' ) ) ? true : false;
// Default itemtype.
$itemtype = 'WebPage';
// Define itemtype for blog pages, otherwise use WebPage.
$itemtype = ( $is_blog ) ? 'Blog' : $itemtype;
// Define itemtype for search results, otherwise use WebPage.
$itemtype = ( is_search() ) ? 'SearchResultsPage' : $itemtype;
// Make result filterable.
$result = apply_filters( 'wpbf_body_itemtype', $itemtype );
// Output.
echo 'itemscope="itemscope" itemtype="https://schema.org/' . esc_html( $result ) . '"';
}
/**
* Schema markup (archive).
*/
function wpbf_archive_schema_markup() {
// Default itemtype.
$itemtype = 'CreativeWork';
// Make result filterable.
$result = apply_filters( 'wpbf_archive_itemtype', $itemtype );
// Output.
echo 'itemscope="itemscope" itemtype="https://schema.org/' . esc_html( $result ) . '"';
}
/**
* Schema markup (single).
*/
function wpbf_single_schema_markup() {
// Default itemtype.
$itemtype = 'CreativeWork';
// Make result filterable.
$result = apply_filters( 'wpbf_single_itemtype', $itemtype );
// Output.
echo 'itemscope="itemscope" itemtype="https://schema.org/' . esc_html( $result ) . '"';
}
/**
* Add a class to our main navigation.
*/
function wpbf_navigation_classes() {
echo apply_filters( 'wpbf_navigation_classes', 'wpbf-navigation' );
}
/**
* Inner content open.
*
* @param boolean $echo Determine wether result should return or echo.
*/
function wpbf_inner_content( $echo = true ) {
if ( is_singular() ) {
$options = get_post_meta( get_the_ID(), 'wpbf_options', true );
// Check if template is set to full width.
$fullwidth = $options ? in_array( 'full-width', $options ) : false;
// Check if template is set to contained.
$contained = $options ? in_array( 'contained', $options ) : false;
// Construct inner content wrapper.
$inner_content = $fullwidth ? false : apply_filters( 'wpbf_inner_content', '
' );
// Check if Premium Add-On is active and template is not set to contained.
if ( wpbf_is_premium() && ! $contained ) {
$wpbf_settings = get_option( 'wpbf_settings' );
// Get array of post types that are set to full width under Appearance > Theme Settings > Global Templat Settings.
$fullwidth_global = isset( $wpbf_settings['wpbf_fullwidth_global'] ) ? $wpbf_settings['wpbf_fullwidth_global'] : array();
// If current post type has been set to full-width globally, set $inner_content to false.
$inner_content = $fullwidth_global && in_array( get_post_type(), $fullwidth_global ) ? false : $inner_content;
}
// On archives, we only add the wpbf_inner_content filter.
} else {
$inner_content = apply_filters( 'wpbf_inner_content', '
' );
}
if ( $echo ) {
echo $inner_content;
} else {
return $inner_content;
}
}
/**
* Inner content close.
*/
function wpbf_inner_content_close() {
if ( is_singular() ) {
$options = get_post_meta( get_the_ID(), 'wpbf_options', true );
$fullwidth = $options ? in_array( 'full-width', $options ) : false;
$contained = $options ? in_array( 'contained', $options ) : false;
$inner_content_close = $fullwidth ? false : '
';
if ( wpbf_is_premium() && ! $contained ) {
$wpbf_settings = get_option( 'wpbf_settings' );
$fullwidth_global = isset( $wpbf_settings['wpbf_fullwidth_global'] ) ? $wpbf_settings['wpbf_fullwidth_global'] : array();
$inner_content_close = $fullwidth_global && in_array( get_post_type(), $fullwidth_global ) ? false : $inner_content_close;
}
} else {
$inner_content_close = '
';
}
echo $inner_content_close;
}
/**
* Title.
*/
function wpbf_title() {
$options = get_post_meta( get_the_ID(), 'wpbf_options', true );
$removetitle = $options ? in_array( 'remove-title', $options ) : false;
$title = $removetitle ? false : '';
do_action( 'wpbf_article_meta_open' );
foreach ( $blog_meta as $value ) {
switch ( $value ) {
case 'author':
do_action( 'wpbf_before_author_meta' );
do_action( 'wpbf_author_meta' );
do_action( 'wpbf_after_author_meta' );
break;
case 'date':
do_action( 'wpbf_before_date_meta' );
do_action( 'wpbf_date_meta' );
do_action( 'wpbf_after_date_meta' );
break;
case 'comments':
do_action( 'wpbf_before_comments_meta' );
do_action( 'wpbf_comments_meta' );
do_action( 'wpbf_after_comments_meta' );
break;
default:
break;
}
}
do_action( 'wpbf_article_meta_close' );
echo '
';
do_action( 'wpbf_after_article_meta' );
}
}
/**
* Article meta (author).
*/
function wpbf_do_author_meta() {
$rtl = is_rtl();
$avatar = get_theme_mod( 'blog_author_avatar' );
$avatar_size = apply_filters( 'wpbf_author_meta_avatar_size', 128 );
if ( ! $rtl && $avatar ) {
echo get_avatar( get_the_author_meta( 'ID' ), $avatar_size );
}
echo sprintf(
'' . $html . '
';
}
return $html;
}
add_filter( 'embed_oembed_html', 'wpbf_responsive_embed', 10, 3 );
/**
* Page builder compatibility.
*
* Make the page full-width & remove the title if Page Builder is being used.
*
* @param int $id the ID.
*/
function wpbf_page_builder_compatibility( $id ) {
// Stop here if we're not on a page.
if ( 'page' !== get_post_type() ) {
return;
}
$elementor = get_post_meta( $id, '_elementor_edit_mode', true );
$fl_enabled = get_post_meta( $id, '_fl_builder_enabled', true );
if ( $fl_enabled || 'builder' === $elementor ) {
$wpbf_stored_meta = get_post_meta( $id );
$mydata = $wpbf_stored_meta['wpbf_options'];
// Stop here if auto conversion already took place.
if ( in_array( 'auto-convert', $mydata ) ) {
return;
}
$mydata[] .= 'remove-title';
$mydata[] .= 'full-width';
$mydata[] .= 'auto-convert';
update_post_meta( $id, 'wpbf_options', $mydata );
}
}
// add_action( 'wpbf_page_builder_compatibility', 'task' );