Block Element – Post Navigation

Block Element – Post Navigation

Starting in GP Premium 2.0, you can create a post navigation in the Block Element module with the help of Dynamic Blocks and Dynamic Data.

You can access it by creating a new block element, then select post navigation under the Element type dropdown menu:

Settings

Templates

Import a template.

Quick hook select

Select one of the three common hooks to insert the post meta template.

Hook name

Select other hooks that are not listed under quick hook select.

Priority

Set the priority of the post meta template. This is useful when there are multiple elements added within the same hook.

Disable default post navigation

Remove the default post navigation.

Add default archive navigation container

Keep the default paging-navigation container so the content padding applies.

GenerateBlocks Container Settings

Inline post meta items

Inline the items inside this container. This is useful when adding dynamic data items such as author, post date, categories etc.

Inline alignment

Set the alignment of the inline post meta items.

Remove Container condition

Remove the container under certain condition such as when there is no previous or next post available.

In Same term

Set further condition when the container is removed based on taxonomy.

Import / Export Overview

Import / Export Overview

Starting in GP Premium 1.6, the Import/Export module has been re-written from the ground up. It now allows you to export all of your GP options into one file, instead of one for each individual module.

You can still choose to only export individual modules if need be.

NOTE: Customizer > Additional CSS is not part of the themes import/export settings. This should be manually copied and pasted between sites.

Exporting your Settings

Importing your Settings

Content Padding

Content Padding

Note: This option requires the Spacing add-on in GP Premium.

You can adjust the padding inside your content container in Appearance > Customize > Layout > Container.

The value you see is in pixels, and controls the amount of space between the edge of your content container and content inside of it.

Note that this can be adjusted separately for desktop and mobile by using the toggle buttons.

Content Padding Not Working

If you have content paddings set in the customizer but it』s not working/showing no paddings at all, the reason is likely that the Content Container options are being applied through the Layout Metabox or a Layout Element.

generate_comments_title_output

generate_comments_title_output

The generate_comments_title_output filter allows you to change the output of the comment title element.

For example, if we want to change the comment title from

 to

, then we can we this PHP snippet:

add_filter( 'generate_comments_title_output', function( $output, $comments_title ) {
return sprintf(
'

%s

',
esc_html( $comments_title )
);
}, 10, 2 );

Sidebar Layout

Sidebar Layout

There are two sidebars by default in GeneratePress that come with multiple layouts including:

Content / SidebarSidebar / ContentContent (no sidebars)Sidebar / Content / SidebarSidebar / Sidebar / ContentContent / Sidebar / Sidebar

There are three different options you can find in Customize > Layout > Sidebars. These options apply to the entire site.

Sidebar Layout

This setting refers to your regular pages.

Blog Sidebar Layout

This setting is specific for your blog, archives, search results etc..

Single Post Sidebar Layout

This setting is specific to your single posts, including blog posts or any kind of custom post type post.

Different sidebar layouts for individual pages and posts

Some individual pages and posts might require a different layout than your global settings. In this case, you can use the Layout metabox while editing that page/post.

Default Widgets

The search and archives widgets are added by default to fill the space when a sidebar layout is selected but no widgets are added in the sidebar widgets area. The two default widgets are removed automatically when you add the desired widgets in the sidebar widgets area.

If you want to remove the entire sidebar instead, then select Content (no sidebars) as explained above.

If you want to remove the default widgets but also keep the sidebar area, you can use the generate_show_default_sidebar_widgets filter.

Using a function

Note: Starting in GP Premium 1.7, the options below can be achieved using the Layout Element without writing any code at all.

Sometimes, the global settings and individual meta box won』t be enough, and you』ll have tougher conditionals to meet like specific archive pages, categories or custom post types.

In these cases, you can use the filter to set your sidebar layouts.

WooCommerce

add_filter( 'generate_sidebar_layout', function( $layout ) {
// If we are on a woocommerce page, set the sidebar
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
return 'both-left';
}

// Or else, set the regular layout
return $layout;
} );

Categories

add_filter( 'generate_sidebar_layout', function( $layout ) {
// If we are on a category, set the sidebar
if ( is_category() ) {
return 'no-sidebar';
}

// Or else, set the regular layout
return $layout;
} );

Search Results

add_filter( 'generate_sidebar_layout', function( $layout ) {
// If we are viewing search results, set the sidebar
if ( is_search() ) {
return 'no-sidebar';
}

// Or else, set the regular layout
return $layout;
} );

You can use any of the available  WordPress conditionals to determine your sidebar layout.

These are the available IDs you can return:

left-sidebar
right-sidebar
no-sidebar
both-sidebars
both-left
both-right

Learn how to add PHP here.

generate_page_class

generate_page_class

The generate_page_class filter allows you to add custom classes to the #page element.

For example:

add_filter( 'generate_page_class', function( $classes ) {
$classes[] = 'my-custom-class';

return $classes;
} );