Filters

Filters allow you to replace certain elements like text strings or disable/enable specific features in Page Builder Framework. Ideally, filters would be added to the child-themes functions.php file.

General


Filter: wpbf_body_itemtype

Change the schema.org markup (itemtype).

Defaults:

  • On Post Archives & Posts: Blog
  • On Search Results Pages: SearchResultsPage
  • On all other Archives & Pages: WebPage
// Change the itemtype for docs posts.
function prefix_custom_itemtype( $itemtype ) {
    if( is_singular( 'docs' ) ) {
        $itemtype = 'YourItemtype';
    }
    return $itemtype;
}
add_filter( 'wpbf_body_itemtype', 'prefix_custom_itemtype' );

Filter: wpbf_block_editor_styles

Disable Page Builder Frameworks styles that apply to the WordPress Gutenberg editor.

Default: true

add_filter( 'wpbf_block_editor_styles', '__return_false' ); 

Navigation

Filter: wpbf_menu_variation

Allows you to change the menu variation. This is useful if you want to display a different menu variation on certain pages. In the example below we change the menu variation for logged-in users.

Variations available (Free Theme):

  • ‘menu-right’
  • ‘menu-left’
  • ‘menu-centered’
  • ‘menu-stacked’

Variations available (Premium Add-On):

  • ‘menu-stacked-advanced’
  • ‘menu-off-canvas’
  • ‘menu-off-canvas-left’
  • ‘menu-full-screen’
function your_prefix_custom_menu_variation( $variation ) {

	// Stop here if the user is not logged in.
	if ( ! is_user_logged_in() ) {
		return $variation;
	}

	// Show the "Left" navigation to logged-in users.
	$variation = 'menu-left';

	return $variation;

}
add_filter( 'wpbf_menu_variation', 'your_prefix_custom_menu_variation' );

Filter: wpbf_mobile_menu_variation

Allows you to change the mobile menu variation based on your own conditions similar to the example above.

Variations available (Free Theme):

  • ‘menu-mobile-default’
  • ‘menu-mobile-hamburger’

Variations available (Premium Add-On):

  • ‘menu-mobile-off-canvas’
function your_prefix_custom_mobile_menu_variation( $variation ) {

	// Stop here if the user is not logged in.
	if ( ! is_user_logged_in() ) {
		return $variation;
	}

	// Show the "Hamburger" navigation to logged-in users.
	$variation = 'menu-mobile-hamburger';

	return $variation;

}
add_filter( 'wpbf_mobile_menu_variation', 'your_prefix_custom_mobile_menu_variation' );

Filter: wpbf_mobile_menu_text

This filter lets you replace the button text for the “Default” mobile menu.

function your_prefix_custom_mobile_menu_text() {
	return 'My Menu';
}
add_filter( 'wpbf_mobile_menu_text', 'your_prefix_custom_mobile_menu_text' );

Logo

Filter: wpbf_logo

This filter lets you change the main menu logo. In this example, we replace the logo on our website only for on a specific page.

function your_prefix_custom_logo( $logo_url ) {
	if( is_page('193') ) {
		$logo_url = 'https://ourwebsite.com/custom-logo.jpg';
	}
	return $logo_url;
}
add_filter( 'wpbf_logo', 'your_prefix_custom_logo' );

Filter: wpbf_logo_mobile

This filter lets you change the mobile menu logo. In this example, we replace the logo on our website only for on a specific page.

function your_prefix_custom_mobile_logo( $logo_url ) {
	if( is_page('193') ) {
		$logo_url = 'https://ourwebsite.com/custom-logo.jpg';
	}
	return $logo_url;
}
add_filter( 'wpbf_logo_mobile', 'your_prefix_custom_mobile_logo' );

Filter: wpbf_logo_url

This filter lets you change the logo URL (Link). In this example, we replace the logo URL on our website only for on a specific page.

function your_prefix_custom_logo_link( $logo_link ) {
	if( is_page('193') ) {
		$logo_link = 'https://ourwebsite.com/about-us/';
	}
	return $logo_link;
}
add_filter( 'wpbf_logo_mobile', 'your_prefix_custom_logo_link' );

Archives

Filter: wpbf_blog_page_title

Other than regular archives, the default blog page does not have a page title by default. This filter allows you to add a title to the blog page. The correct markup is automatically applied.

function your_prefix_blog_page_title() {
	return 'Welcome to our Blog';
}
add_filter( 'wpbf_blog_page_title', 'your_prefix_blog_page_title' );

Filter: wpbf_blog_post_thumbnail_size

This filter lets you change the featured image size on archive pages.
Default: full

function your_prefix_custom_blog_post_thumbnail_size() {
	return 'medium';
}
add_filter( 'wpbf_blog_post_thumbnail_size', 'your_prefix_custom_blog_post_thumbnail_size' );

Filter: wpbf_read_more_text

Change the text of the read more button.
Default: Read more

function your_prefix_custom_read_more_text() {
	return 'Learn more';
}
add_filter( 'wpbf_read_more_text', 'your_prefix_custom_read_more_text' );

Filter: wpbf_categories_title

Change the categories title in the footer meta.
Default: Filed under:

function your_prefix_custom_categories_title() {
	return 'Categories:';
}
add_filter( 'wpbf_categories_title', 'your_prefix_custom_categories_title' );

Filter: wpbf_tags_title

Change the tags title in the footer meta.
Default: Tags:

function your_prefix_custom_tags_title() {
	return 'Tagged for:';
}
add_filter( 'wpbf_tags_title', 'your_prefix_custom_tags_title' );

Filter: wpbf_posts_pagination_size

Default: 2

function your_prefix_custom_posts_pagination_size() {
	return 3;
}
add_filter( 'wpbf_posts_pagination_size', 'your_prefix_custom_posts_pagination_size' );

Filter: wpbf_posts_pagination_prev_text

Default: ← Previous

function your_prefix_custom_posts_navigation_prev_text() {
	return 'Previous';
}
add_filter( 'wpbf_posts_navigation_prev_text', 'your_prefix_custom_posts_pagination_prev_text' );

Filter: wpbf_posts_pagination_next_text

Default: Next →

function your_prefix_custom_posts_navigation_next_text() {
	return 'Next';
}
add_filter( 'wpbf_posts_navigation_next_text', 'your_prefix_custom_posts_pagination_next_text' );

Filter: wpbf_no_post_headline

This filter lets you change the headline that’s being displayed if no post could be found.
Default: Oops, this article couldn’t be found!

function your_prefix_custom_no_post_headline() {
	return 'Oops, nothing here!';
}
add_filter( 'wpbf_no_post_headline', 'your_prefix_custom_no_post_headline' );

Filter: wpbf_no_post_content

This filter lets you change the content that’s being displayed if no post could be found.
Default: Something went wrong.

function your_prefix_custom_no_post_content() {
	return 'We're bad at content.';
}
add_filter( 'wpbf_no_post_content', 'your_prefix_custom_no_post_content' );

Post Meta

The post meta data is visible on archives & single pages.

Filter: wpbf_author_meta_avatar_size

Change the image size of the author meta avatar (displayed on single pages & archives).
Default: 128

function your_prefix_custom_author_meta_avatar_size() {
	return 256;
}
add_filter( 'wpbf_author_meta_avatar_size', 'your_prefix_custom_author_meta_avatar_size' );

Filter: wpbf_article_meta_separator

Change the separator between the author/article meta items.
Default: |

function your_prefix_custom_article_meta_separator() {
	return ' / ';
}
add_filter( 'wpbf_article_meta_separator', 'your_prefix_custom_article_meta_separator' );

Sidebar

Filter: wpbf_sidebar_layout

This filter allows you to change the sidebar position. Learn more

function your_prefix_custom_sidebar_layout( $layout ) {

	// Stop here if we're not on a page.
	if ( ! is_page() ) {
		return $layout;
	}

	// Set the sidebar position for all pages. Allowed are 'left', 'right' & 'none'.
	return 'right';

}
add_filter( 'wpbf_sidebar_layout', 'your_prefix_custom_sidebar_layout' );

Filter: wpbf_do_sidebar

This filter will allow you to change what sidebar is being displayed. You will have to have additional sidebars registered to be able to make use of them. Learn more

// Replace the default sidebar with a custom sidebar on all docs posts.
function prefix_do_custom_sidebar( $sidebar ) {

    if( is_singular( 'docs' ) ) {
        $sidebar ='custom-sidebar';
    }

    return $sidebar;

}
add_filter( 'wpbf_do_sidebar', 'prefix_do_custom_sidebar' );

Search

Filter: wpbf_search_page_title

This filter allows you to change the title on the search results page.
Default: Search Results for: {search-term}

function your_prefix_custom_search_page_title( $title ) {

	$title = sprintf( 'You searched for: %s', '<span>' . get_search_query() . '</span>' );

	return $title;

}
add_filter( 'wpbf_search_page_title', 'your_prefix_custom_search_page_title' );

Filter: wpbf_search_placeholder

This filter lets you change the placeholder text for the searchform which usually appears in sidebars.

function your_prefix_custom_search_form_placeholder() {
	return 'Search';
}
add_filter( 'wpbf_search_placeholder', 'your_prefix_custom_search_form_placeholder' );

Filter: wpbf_search_title

This filter lets you change the title text for the searchform.

function your_prefix_custom_search_form_title() {
	return 'Hit enter to search';
}
add_filter( 'wpbf_search_title', 'your_prefix_custom_search_form_title' );

Filter: wpbf_search_menu_item_form

This filter allows you to override the search form that’s being used inside the search menu item. Only use if you know what you are doing.
Default: get_search_form( $echo = false );


404

Filter: wpbf_404_headline

This filter lets you change the headline for the 404 pages

function your_prefix_custom_404_headline() {
	return 'Nothing to see here!';
}
add_filter( 'wpbf_404_headline', 'your_prefix_custom_404_headline' );

Filter: wpbf_404_text

This filter lets you change the text for the 404 pages

function your_prefix_custom_404_text() {
	return 'Oops, something went wrong!';
}
add_filter( 'wpbf_404_text', 'your_prefix_custom_404_text );

Posts

Filter: wpbf_remove_featured_image

This filter lets you remove the featured image on single pages.
Default: false

function your_prefix_remove_featured_image() {
	return true;
}
add_filter( 'wpbf_remove_featured_image', 'your_prefix_remove_featured_image' );

Filter: wpbf_single_post_thumbnail_size

This filter lets you change the featured image size on posts.
Default: full

function your_prefix_custom_single_post_thumbnail_size() {
	return 'medium';
}
add_filter( 'wpbf_single_post_thumbnail_size', 'your_prefix_custom_single_post_thumbnail_size' );

Filter: wpbf_previous_post_link

Change the previous post link text on the post navigation.
Default: ← Previous Post

function your_prefix_custom_previous_post_link_text() {
	return 'Previous Post';
}
add_filter( 'wpbf_previous_post_link', 'your_prefix_custom_previous_post_link_text' );

Filter: wpbf_next_post_link

Change the next post link text on the post navigation.
Default: Next Post →

function your_prefix_custom_next_post_link_text() {
	return 'Next Post';
}
add_filter( 'wpbf_next_post_link', 'your_prefix_custom_next_post_link_text' );

Comments

To change the comment form defaults, please filter comment_form_defaults directly as per the example below. The comments related wpbf filters were depreciated in favor for the built-in comment_form_defaults filter.

function my_comment_form_defaults( $defaults ) {

	$defaults['label_submit'] = __( 'Submit' );

	return $defaults;
}
add_filter( 'comment_form_defaults', 'my_comment_form_defaults' );

Filter: wpbf_leave_comment (Deprecated)

Change the “Leave a Comment” text on the comment form.
Default: Leave a Comment

function your_prefix_custom_leave_a_comment_text() {
	return 'Leave a Comment';
}
add_filter( 'wpbf_leave_comment', 'your_prefix_custom_leave_a_comment_text' );

Filter: wpbf_leave_reply (Deprecated)

Change the “Leave a Reply” text on the comment form.
Default: Leave a Reply

function your_prefix_custom_leave_a_reply_text() {
	return 'Leave a Reply';
}
add_filter( 'wpbf_leave_reply', 'your_prefix_custom_leave_a_reply_text' );

Filter: wpbf_cancel_reply (Deprecated)

Change the “Cancel Reply” text on the comment form.
Default: Cancel Reply

function your_prefix_custom_cancel_reply_text() {
	return 'Cancel Reply';
}
add_filter( 'wpbf_cancel_reply', 'your_prefix_custom_cancel_reply_text' );

Filter: wpbf_post_comment (Deprecated)

Change the “Post Comment” text on the comment form.
Default: Post Comment

function your_prefix_custom_post_comment_text() {
	return 'Post Comment';
}
add_filter( 'wpbf_post_comment', 'your_prefix_custom_post_comment_text' );

Footer

Filter: wpbf_theme_author

Change the theme author link in the footer. Premium Add-On users can change the theme author link right from within the WordPress Customizer.

function your_prefix_custom_theme_author_link( $theme_author ) {

	$theme_author['name'] = 'Your Company';
	$theme_author['url'] = 'https://yourdomain.com';

	return $theme_author;

}
add_filter( 'wpbf_theme_author', 'your_prefix_custom_theme_author_link', 0 );

Premium Add-On

Custom Sections

Filter: wpbf_custom_section_hooks

Can be used to add your own hooks to Custom Sections select field.

function your_prefix_custom_section_hooks( $hooks ) {

	$custom_hooks = array(
		'My Custom Hooks' => array(
			'my_hook_1',
			'my_hook_2',
			'my_hook_3',
		)
	);

	$hooks = array_merge( $hooks, $custom_hooks );

	return $hooks;

}
add_filter( 'wpbf_custom_section_hooks', 'your_prefix_custom_section_hooks' );

Filter: wpbf_custom_sections_capability

Change what capability is required to access Custom Section.
Default: manage_options

function your_prefix_custom_sections_capability() {
	return 'publish_posts';
}
add_filter( 'wpbf_custom_sections_capability', 'your_prefix_custom_sections_capability' );

Last updated on: June 10th, 2023


Related Articles

Scroll to Top

Download

Download Page Builder Framework and be the first to get informed about new features & updates!

OR

Get 10% off our Premium Add-On (yearly plan).
Coupon Code to enter during checkout: 10OFF View Pricing