generate_entry_meta_post_types

generate_entry_meta_post_types

This filter allows you to tell the entry meta to display on your custom post types. By default, it only shows for the post post type.

add_filter( 'generate_entry_meta_post_types', function( $types ) {
$types[] = 'my-post-type';
$types[] = 'recipes';

return $types;
} );

Load Essentials Icons Only

Load Essentials Icons Only

This option is no longer available as FontAwesome has been removed entirely from the free GeneratePress theme and GP Premium.
Starting in GeneratePress 2.0, instead of loading the entire FontAwesome library like before, only the essentials will load by default.
If you』re updating GP on an existing site, we』ll set it to the full library automatically for you, as we don』t want to break any icons you have in your content.

Show the 「Updated」 Post Date

Show the 「Updated」 Post Date

In some cases, you may wish to show the date your post was last updated instead of the published date.
We can do this with a little CSS:

.posted-on .updated {
display: inline-block;
}

.posted-on .updated + .entry-date {
display: none;
}
If you wish to display some text before the date, you can do this:

.posted-on .updated:before {
content: "Last Updated ";
}

Show the 「Updated」 Post Date in Header Element

To show the updated post date in Header Element, add the PHP snippet below to create the shortcode:

function post_modified_date() {
return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' );

Then add [modified_date] to the Header Element content.

Content Container

Content Container

Starting in GeneratePress 3.0, the previous Page Builder Container option has been renamed to Content Container option.

Default

The default option means that the Content Padding option in the customizer would apply:

Full Width

The Full Width option set the content area to be 100% of the screen width and allows for full width sections using GenerateBlocks or page builders.

This option also remove the default content padding set in the customizer so GenerateBlocks or page builders can have complete control of the content padding.

Contained

The Contained option simply removes the content padding set in the customizer so GenerateBlocks or page builders can have complete control of the content padding.

Apply the Option to Multiple Pages or Globally

The Layout metabox shown in the first screenshot here allows you to choose the setting per page. You can also create a Layout Element to apply the setting to multiple pages/posts or globally.

Content Layout

Content Layout

The Content Layout option found in Appearance > Customize > Layout > Container allows you to separate your website elements (content area, widgets, header, footer etc..) into separate blocks, or contain them all inside one container.
When you choose between the two options, you』ll see immediately what the difference is.

Separate Containers

One Container

Responsive Display

Responsive Display

Responsive Breakpoints
The default responsive breakpoints for GP are 768px for mobile and 1024px for desktop with tablet in between.
This means that you can target CSS to certain device by using @media:
@media (max-width: 768px) {
/* CSS in here for mobile only */
}
@media (min-width: 769px) and (max-width: 1024px) {
/* CSS in here for tablet only */
}
@media (min-width: 1025px) {
/* CSS in here for desktop only */
}

IE10+ Specific Styles
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
/* IE10+ specific styles go here */
}

Using our hide-on-* classes
To hide/show certain contents depending on devices, you can use the three handy built-in classes below:
hide-on-mobile
hide-on-tablet
hide-on-desktop
Some example usages:
– To hide certain menu items on mobile, you can add hide-on-mobile to the Custom Classes field.
– To show certain contents in desktop only, try this in the Text Editor:

Content here will only display in Desktop

Activating Read More with Custom Excerpt

Activating Read More with Custom Excerpt

By default, WordPress skips all of the excerpt_length and excerpt_more filters when the custom excerpt is used.
If you would like to use the read more links or read more buttons with custom excerpt, we can use the following snippets:

Read more text

add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
if ( has_excerpt() ) {
$output = sprintf( '%1$s %3$s',
$excerpt,
get_permalink(), __( 'Read more', 'generatepress' )
);
}
return $output;
}

Read more button

add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
if ( has_excerpt() ) {
$output = sprintf( '%1$s

%3$s

',
$excerpt,
get_permalink(), __( 'Read more', 'generatepress' )
);
}
return $output;
}

Remove E-mail and URL field from Comment Form

Remove E-mail and URL field from Comment Form

If you would like to remove e-mail and URL field from comment form, first uncheck the requirement in Settings > Discussion:

Then add the PHP snippet below to remove the field

add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
function tu_add_comment_url_filter() {
add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
}

function tu_disable_comment_url($fields) {
unset($fields['url']);
unset($fields['email']);
return $fields;
}

Page Hero Background Video

Page Hero Background Video

Adding a background video to our Page Hero is super easy. We just need to add some HTML into the content area, and add some CSS to our site.

The first thing we need to do is structure our HTML within our Element content. Here』s an example:

Your Element content in here.

In the HTML above, you』ll notice a couple different options we』ve added:

loop – This will make the video loop infinitely.
muted – This will mute any sound the video might have.
autoplay – This will make the video start playing as soon as the page loads.
poster – This is the URL to a fallback image that will show while the video loads.

You』ll also notice we have three different videos within our video element. Only one is required.

Now that our HTML is set up, we can add the CSS:

.background-video {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.5;
}

.page-hero {
position: relative;
overflow: hidden;
}

.background-video-content {
position: relative;
z-index: 1;
}

video[poster] {
object-fit: cover;
width: 100%;
height: 100%;
}

All of the above is plug-and-play, except for the opacity option. Adding the opacity will allow your background color to overlay the video element.