Note: This section requires content to the added in the Content section of the Page Header meta box.
The Advanced section in the Page Header meta box allows us to merge our Page Header Content and our site header/navigation.
Page Header Advanced
Merge with site header
Enable the section by enabling the Merge with site header option.
Place content behind header (sliders etc..)
This option is useful if your page header background has been added to the Content section (a slider shortcode for example), and isn』t the default image or background video set in the meta box.
Site title
Change your site title color.
Site tagline
Change your site tagline color.
Custom Navigation Colors
Adjust the colors of your navigation so they match your page header. Enabling this option will make more options appear.
Page Header Custom Navigation Colors
generate_woocommerce_menu_cart_icon
The generate_woocommerce_menu_cart_icon filter allows you to change the icon HTML that builds the WooCommerce cart icon in the primary navigation.
Usage
Please refer to the Using Filters article to learn how to use this filter.
Examples
add_filter( 'generate_woocommerce_menu_cart_icon', 'tu_change_wc_menu_cart_icon' );
function tu_change_wc_menu_cart_icon() {
return '';
}
Page Header Overview
The Page Header add-on in GP Premium gives you the ability to add a really nice hero section to your website.
To use this add-on, first make sure GP Premium is installed, and that the add-on is activated.
Please refer to the related articles below for specific instructions.
Video Overview
generate_page_header_legacy_metabox
The generate_page_header_legacy_metabox filter allows you to bring back the Page Header meta box on your posts.
In GPP 1.4, the meta box was removed from individual pages and replaced by a custom post type.
Usage
add_filter( 'generate_page_header_legacy_metabox', '__return_true' );
Page Header Global Locations
We can apply Page Headers to global locations by navigating to Pages Headers > Global Locations.
This allows us to create a Page Header, and apply it to areas within WordPress that typically can』t be edited.
These areas include:
Posts page (blog)
Search results
404 template
Post Types – Single
We can also apply Page Headers to single posts within any public post type on our site.
By default, these post types include:
Posts
Pages
Media
Whenever a new post type is added – by you or a plugin – they will be added to this list.
For example, we can create a Page Header using dynamic template tags, then we can apply that single Page Header to every single post on our website. This allows us to create a global template for all of our posts which can include things like the post title, author, date, terms and even custom fields.
Post Types – Archives
If you have any custom post types that have an archives page – like your WooCommerce shop page – you can apply a Page Header to it as well.
By default, there are no archive pages like this in WordPress. However, as you add plugins, post types will appear in this section if available.
Adding Page Headers to Taxonomies
You can easily add your created page headers to your taxonomies, like category archives, tag archives and other custom taxonomies (WooCommerce product categories etc..).
First, create your Page Header by doing to Page Headers > Add New.
Once your Page Header is created and published, enter your taxonomy.
For example, let』s say we have a category named Travel. We would go to Posts > Categories and enter the Travel category.
Now that we』re inside the Travel category, we can use the Page Header select dropdown to apply our published Page Header to this category.
Page Header Template Tags
Page Headers have a list of dynamic template tags which you can add to your content.
These tags will pick up elements based on the page you』re currently viewing.
{{post_title}}
Will pick up the title of the page or post you』re currently viewing. It will also pick up the current taxonomy title if the Page Header is applied to a taxonomy (category, tag etc..).
{{post_date}}
Will print the published date of the post you』re currently viewing.
{{post_author}}
Will print the author of the post you』re currently viewing.
{{post_terms.taxonomy}}
This template tag will list the associated terms of the post you』re viewing. For example, if you want to display the categories the current post is added to, you would do this:
{{post_terms.category}}
If you wanted to display the product categories, you would do this:
{{post_terms.product_cat}}
For tags, you would do this:
{{post_terms.post_tag}}
As you can see, this template tag can be used to display terms from any taxonomy you want.
{{custom_field.name}}
This template tag allows you to display custom fields from the currently viewed post. This is one of the most powerful template tags, as it can be used to display nearly anything you like.
So we if we add a custom field and name it something like description, and give it a value:
We can then print this custom field inside our Page Header like this:
{{custom_field.description}}
If you want to print your featured image in your Page Header, you can do this:
{{custom_field._thumbnail_id}}
This will generate the full HTML for your featured image.
generate_pagination_mid_size
The generate_pagination_mid_size filter allows you to increase the number of page links shown in your post pagination.
Example
add_filter( 'generate_pagination_mid_size','tu_increase_pagination_numbers' );
function tu_increase_pagination_numbers() {
return 3;
}
Usage
Please refer to the Using Filters article to learn how to use this filter.
generate_hooks_capability
Note: This filter is included in GP Premium.
The generate_hooks_capability filter allows you to specify user access to the Hooks add-on.
For example, if you only want the network admin to have access:
add_filter( 'generate_hooks_capability','tu_network_admin_hooks' );
function tu_network_admin_hooks() {
return 'manage_network';
}
Usage
Please refer to the Using Filters article to learn how to use this filter.
generate_blog_masonry
Note: This filter is included in GP Premium.
The generate_blog_masonry filter allows you to apply masonry to a custom post type.
See example here.
Usage
Please refer to the Using Filters article to learn how to use this filter.