Disable Elements Overview

Disable Elements Overview

The Disable Elements add-on in GP Premium allows you to disable certain elements on your individual pages and posts.

Starting in GP Premium 1.7, you can also use the Layout Element to disable these elements site-wide.

To use this add-on, first make sure GP Premium is installed, and that the add-on is activated.

Once activated, you』ll find the options in the Layout metabox.

To disable the various elements, simply check the box next to their name.

Video Overview

generate_post_date_output

generate_post_date_output

This filter returns the HTML that displays your post date along with your blog posts.

You can use this filter to completely overwrite the HTML given, or even add to it.

For example, if you wanted to add a clock icon before your date, you could do this:

Only Show Updated Date

By default, the HTML for the published date and updated date (if it exists) is added to your site. The updated date is hidden with CSS.

In some cases, you might only want the updated date HTML to display. Then this filter can be used:

add_filter( 'generate_post_date_show_updated_only', '__return_true' );

Add Icon to Date

add_filter( 'generate_post_date_output','tu_add_to_post_date' );
function tu_add_to_post_date( $output ) {
return ' ' . $output;
}

Remove Link from Date

add_filter( 'generate_post_date_output', function( $output, $time_string ) {
printf( '%s ',
$time_string
);
}, 10, 2 );

As you can see, this filter is very powerful and gives you full control over your post dates.

Layout Metabox Overview

Layout Metabox Overview

Please note that WordPress ignores metabox values on index pages like blog and archive so this meta box won』t work for those pages.

Sidebar Layout

Footer Widgets

Disable Elements Overview

Content Container

Where Is It?

The Layout is usually located at the bottom right corner of the block editor screen:

If you don』t see the metabox there, make sure to enable it under Options setting:

Layout Element Overview

Layout Element Overview

Starting in GP Premium 1.7, the Layout element allows you to set the same options you』re used to in the Layout metabox, but on a site-wide scale.

This means you can change the sidebar layout on specific categories for example, or set the content layout to full width on your entire site if you』re using a page builder everywhere.

This element is a massive time saver.

Combine CSS

Combine CSS

By default, GeneratePress will now combine unsemantic-grid.css, style.css and mobile.css into one file. This results in fewer HTTP requests.

Existing sites will turn this option off by default to prevent any potential conflicts.

When combined, GeneratePress will use a slimmed down version of unsemantic-grid.css, which only includes the classes that are needed by the theme to function.

This option is unavailable for Flexbox version of the theme.

generate_after_do_template_part

generate_after_do_template_part

The generate_after_do_template_part hook appears at the end of generate_do_template_part() function.

This function is responsible for displaying the content on your page. In archives, it displays each post.

We can use this hook to display something after each post, or after a specific post. For example, this function will output text after the 4th post in your archives:

add_action( 'generate_after_do_template_part', function() {
global $wp_query;

if ( 3 === $wp_query->current_post ) {
echo 'Look at me after the fourth post';
}
} );

generate_load_child_theme_stylesheet

generate_load_child_theme_stylesheet

GeneratePress loads the child theme stylesheet by default if a child theme is active.

The generate_load_child_theme_stylesheet filter allows you to disable that so you can add your own child theme stylesheet.

add_filter( 'generate_load_child_theme_stylesheet', '__return_false' );