generate_cancel_reply

generate_cancel_reply

Note: This filter has been removed starting in GeneratePress 2.0.
The generate_cancel_reply filter allows you to change the default Cancel reply text.
Default (string): Cancel reply
Usage
Please refer to the Using Filters article to learn how to use this filter.

generate_leave_reply

generate_leave_reply

Note: This filter has been removed starting in GeneratePress 2.0.
The generate_leave_reply filter allows you to change the default Leave a Reply text.
Default (string): Leave a reply to %s
Usage
Please refer to the Using Filters article to learn how to use this filter.

generate_sidebars

generate_sidebars

Note: This hook has been removed starting in GeneratePress 2.0 as it was causing a PHP bottleneck and hurting performance.
If you』re using a child theme with custom page templates, you will need to replace this hook with the new generate_after_primary_content_area hook, and add the sidebars function. You can see these new elements by viewing the page.php file in 2.0.
Of course, we kept backward compatibility so your sidebars won』t disappear when you update.

Back to Top Button

Back to Top Button

You can find the option to turn on the back to top button in Customize > Layout > Footer.
This option adds a button to the bottom of your website once you start scrolling that helps your visitor scroll back to the top of the page.
Moving the button
By default, the button appears at the bottom right of your page. We can move it around using some CSS:
.generate-back-to-top,
.generate-back-to-top:visited {
bottom: 30px; /* 30px from the bottom of your screen */
left: 30px; /* 30px from the left of your screen */
}

In the above example, we replace the default right: 30px; with left: 30px;.
Learn how to add CSS here.
Changing the color
If you have GP Premium, you can change the color in the Customizer by going to Customize > Colors > Footer.
Otherwise, we can change the background color and other styles using some CSS:
.generate-back-to-top,
.generate-back-to-top:visited {
background-color: rgba( 0, 0, 0, 0.4 ); /* rgba or hex */
color: #FFFFFF;
}

/* the button when you hover/click it */

.generate-back-to-top:hover,
.generate-back-to-top:focus {
background-color: rgba( 0, 0, 0, 0.6 ); /* rgba or hex */
color: #FFFFFF;
}

Learn how to add CSS here.
Other styles
Many other styles can be added to the button using CSS:
.generate-back-to-top,
.generate-back-to-top:visited {
border-radius: 3px; /* how round the button is */
line-height: 40px; /* how tall it is */
width: 40px; /* how wide it is */
}

Learn how to add CSS here.
Change how fast it scrolls you to the top
We can change how long it takes to scroll back to the top of the page with a simple filter:
add_filter( 'generate_back_to_top_scroll_speed', 'tu_back_to_top_scroll_speed' );
function tu_back_to_top_scroll_speed() {
return 400; // milliseconds
}

Learn how to add PHP here.
Change how far from the top it appears
By default, it will show up once you hit 300px from the top of the page. We can adjust this with a filter:
add_filter( 'generate_back_to_top_start_scroll', 'tu_back_to_top_start_scroll' );
function tu_back_to_top_start_scroll() {
return 300; // 300px from the top
}

Learn how to add PHP here.

generate_navigation_logo_output

generate_navigation_logo_output

Note: This filter requires the Menu Plus add-on in GP Premium.
The generate_navigation_logo_output filter allows us to alter the HTML of our navigation logo.
Examples
If we don』t want a link surrounding our navigation logo:
add_filter( 'generate_navigation_logo_output','lh_change_navigation_logo_output' );
function lh_change_navigation_logo_output( $output ) {
return sprintf(
'

',
'http://LOGO-URL-HERE',
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
);
}

generate_navigation_logo

generate_navigation_logo

The generate_navigation_logo filter allows you to change the navigation logo.
Default (URL): Your logo set in Customize > Layout > Primary Navigation.
Usage
Please refer to the Using Filters article to learn how to use this filter.
Example
If you want to show a different navigation logo inside categories, you could do this:
add_filter( 'generate_navigation_logo','lh_category_navigation_logo' );
function lh_category_navigation_logo( $logo ) {

// Return our category logo URL
if ( is_category() ) {
return 'URL TO YOUR CATEGORY LOGO';
}

// Otherwise, return our default logo
return $logo;
}

generate_mobile_header_logo

generate_mobile_header_logo

The generate_mobile_header_logo filter allows you to change the mobile header logo.
Default (URL): Your logo set in Customize > Layout > Header.
Usage
Please refer to the Using Filters article to learn how to use this filter.
Example
If you want to show a different mobile header logo inside categories, you could do this:
add_filter( 'generate_mobile_header_logo','lh_category_mobile_header_logo' );
function lh_category_mobile_header_logo( $logo ) {

// Return our category logo URL
if ( is_category() ) {
return 'URL TO YOUR CATEGORY LOGO';
}

// Otherwise, return our default logo
return $logo;
}

Using Columns & Masonry in the Blog

Using Columns & Masonry in the Blog

Note: These options require the Blog add-on in GP Premium.
Starting in GP Premium 1.5, the columns and masonry options are combined in the same panel.

Display posts in columns – Enable columns for posts to see the rest of the options.
Columns – Set the number of columns.
Make first post featured – Enable the latest post to be featured.
Display posts in masonry grid – Enable masonry grid with columns.

Using full width for featured post
The CSS snippet below enable full width for the featured post:
.generate-columns-container .featured-column {
float: none;
width: 100%;
}
Learn how to add CSS here.
Adding columns to your custom post type
By default, columns only apply to the post post type. However, you can add columns to your custom post type using the filter:
add_filter( 'generate_blog_columns','tu_portfolio_columns' );
function tu_portfolio_columns( $columns ) {
if ( is_post_type_archive( 'portfolio' ) ) {
return true;
}

return $columns;
}
You can use this filter to enable or disable columns under any conditions you need by using the WordPress conditional tags.
Learn how to add PHP here.
Changing the number of columns
In some cases, you might want a different number of columns on certain custom post types, categories etc.. We can use a filter for this as well.
For example, if we want to change our column count on the search page:
add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
if ( is_search() ) {
return 33;
}

return $count;
}
33 means 33%, which is 3 columns.
50 would be 50%, 2 columns.
20 would be 20%, 5 columns.
And so on..
You can use this filter under any conditions you need by using the WordPress conditional tags.
Adding masonry to your custom post type
By default, masonry only applies to the post post type. However, you can add masonry to your custom post type using the filter:
add_filter( 'generate_blog_masonry','tu_portfolio_masonry' );
function tu_portfolio_masonry( $masonry ) {
if ( is_post_type_archive( 'portfolio' ) ) {
return 'true';
}

return $masonry;
}
You can use this filter to enable or disable masonry under any conditions you need by using the WordPress conditional tags.
Learn how to add PHP here.