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.

Add Site Title To Navigation

Add Site Title To Navigation

Our navigation logo option allows you to add logo to the navigation. If you want to display the site title instead, try the PHP snippet below:

add_action( 'after_setup_theme', 'tu_navigation_as_header' );

function tu_navigation_as_header() {

remove_action( 'generate_header', 'generate_construct_header' );

add_action( 'generate_inside_navigation', 'tu_site_title_navigation' );

}

function tu_site_title_navigation() {

?>

<a href="" rel="home">

<?php

}

view raw

gistfile1.txt

hosted with ❤ by GitHub

with the CSS snippet to style it:

.main-navigation .site-branding {
float: left;
}

.main-navigation .site-branding a {
line-height: 60px;
font-size: 20px;
}

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;
}

Hooks Element Overview

Hooks Element Overview

Starting in GP Premium 1.7, the Hook element replaces the GP Hooks module.
This element allows you to insert content into any available hook on your website. There』s a list of available GP and GP Premium hooks, and there』s a custom hook option that allows you to define your own hook name if it doesn』t exist in the dropdown.
The usage of each hook is reference and explained in this list.
The location of the hooks are shown in our visual hook guide.

Hooks Overview

Hooks Overview

GeneratePress uses the WordPress Hooks API to insert actions throughout the theme.
This allows us to 「hook」 our own custom code into various areas of the theme without changing core files.
You can see all of the available hooks in GeneratePress here.
The Hooks add-on makes it easier for you to add content into many of the main hooks without the need to write any PHP.
To find the Hooks area, go to Appearance > GP Hooks.
If you need a visual reference of where these hooks are located, check out this page.
Execute PHP
If you』ve added PHP into your hook, you must check the Execute PHP checkbox in order for it to work.
Disable Hook
If you need to, you can check the Disable Hook option to stop the hook from inserting into the page.
Video Overview

Moving Hooks & Page Headers to Elements

Moving Hooks & Page Headers to Elements

In the videos below, we go over migrating your old Hooks and Page Headers to the new Elements module in GP Premium 1.7.

This first video was made by Mike Oliver of Zephyr Studio. It』s about 45 minutes long, and goes over migrating Page Headers to Page Heros.

This next video is much shorter, but goes over the concept of switching to Elements.

Page Headers are from 0:00 to 6:36, and Hooks are from 6:36 until the end.

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;
}

Off Canvas Panel Overview

Off Canvas Panel Overview

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

Starting in GP Premium 1.8, the former Slideout Navigation panel is replaced by the off canvas panel.

First, make sure there is a menu assigned to Off Canvas Menu under menu settings

You can choose to activate your off canvas panel on mobile, desktop, both or disable it completely.

Style

Slide – This is the typical slideout navigation. You can also choose the side it slides out and where the close button is positioned.

Overlay – This is the full-screen overlay style off canvas panel that has been increasingly popular nowadays. When activated, you can choose Set Overlay Defaults and let GP style it for you. These settings can also be changed in Colors > Off Canvas Panel and Typography > Off Canvas Panel.

Menu Item Height

Set the menu item height for the off canvas panel.

Off Canvas Panel Widget Area

The off canvas panel has a widget area, which you can add widgets to in Appearance > Widgets or Customize > Widgets.

You can simply use for widgets, and leave out the navigation completely if you like!

Use Off Canvas Menu Only

Some users wish to use off canvas menu only on desktop. This can be done with the simple method below:

First, create a menu with the desired items and assign it to Off Canvas Menu in theme locations.

Then create an empty menu and assign it to Primary Menu in theme locations

Then you can head to navigation location to adjust the position of the toggle.

Empty Off Canvas Navigation

If you have activated the off canvas navigation but the menu items aren』t showing up:

Then make sure you have a menu assigned to off canvas menu in Theme Location.