generate_footer_entry_meta_items

generate_footer_entry_meta_items

The generate_footer_entry_meta_items allows us to re-order or add footer meta items.

Example

If we want to move the date from header entry meta to the footer entry meta and before categories and comments link, we can use this PHP snippet:

add_filter( 'generate_footer_entry_meta_items', function() {
return array(
'date',
'categories',
'comments-link',
'post-navigation',
);
} );

cURL error 28: Connection timed out

cURL error 28: Connection timed out

This error can happen when trying to activate your license key, or while trying to update GP Premium.

WordPress uses something called cURL to communicate with other websites, specifically using this function: wp_remote_post()

This is a core WordPress function that we use to verify license keys and perform updates.

It』s necessary for your website to communicate with our website, as we need to know the license key you』ve input so we can validate it in our records, and then send a response back to your website to activate it.

When cURL times out, it typically means one of the two websites is blocking that communication. This can happen via firewalls or other means of server security.

The first thing to do is go through this list. Your hosting support should be able to help you with most of it.

Make sure your server is running a recent version of PHP and the cURL library.Try increasing your PHP memory limit.Try increasing your cURL timeout limit.Ask your host if there is some limitation with wp-cron, or if loopback is disabled.Ask your host if there are firewall or security modules (e.g. mod_security) that could block the outgoing cURL requests.Install the Query Monitor plugin and check the status of the HTTP API Calls in the admin page where the error is displayed.

If none of the above fixes the issue, you will need to ask your hosting support to confirm that your server can communicate with our server (generatepress.com) via cURL without any limitations.

If they are sure there are no limitations, you can contact us with your server IP (where the request is coming from), and we』ll make sure it isn』t banned on our server (this is very rarely the case). Our server processes hundreds of these cURL requests successfully every day.

This article also has some great information on this specific error and may help you/your hosting support team debug the issue.

Split Header In Three Sections

Split Header In Three Sections

The header widget area allows you to put any kind of widget in it and it will show up on the right side of the header area.

This leaves some space in the center of the header. If you would like to use this area by splitting the header in three, try the following steps:

1. Create a new Hook Element:

2. Set the hook to header and check the 「Disable Site Header」 checkbox.

3. Add the following HTML in the content area:

Header center content
Header right content

4. Add the CSS below:

.header-section {
display: flex;
flex-wrap: wrap;
}

.header-section > div {
width: calc(100% / 3);
}

@media (max-width: 768px) {
.header-section > div {
width: 100%;
text-align: center;
}
}

5. This is the basic result:

Depending on your browser requirements, you might want to run that code through this tool: https://autoprefixer.github.io/

If you want to insert widgets in those sections, we recommend trying a plugin like Widget Shortcode.

Navigation as a Header

Navigation as a Header

Using navigation as a header as seen above is one of the most popular and requested layouts currently. Starting in GP Premium 1.8, you can find this option under Layout > Header:

Basic

Make sure there is a site title or/and a logo in added Site Identity.Check to activate Use Navigation as Header option above.Adjust the logo and navigation height by changing the Menu Item Height.

Sticky Navigation with Height Transition

To create transition effect above, first you need to complete the Basic steps above, then follow the additional steps below:

Set Sticky Navigation to Desktop only or Both.Set Transition to None.Set Sticky Navigation Height to a number smaller than step 3 above.

Merge with Header Elements

We also have the option to merge the header navigation with a page hero in our Header Element as seen above. Follow the Basic steps first, then the Height Transition steps if it』s desired, then we are ready to merge with the options detailed in the Transparent Header and Navigation article.

Different Logo and Navigation Colors

If you want to use a different logo and navigation colors to match a specific page hero, you can do so by uploading the logo in Navigation Logo and change the Navigation Colors under the Site Header tab for that specific page hero.

Adding the Site Tagline

The site tagline is removed by default when this option is activated as there typically isn』t enough space for it. However, you can add it back in using this PHP snippet:

add_filter( 'generate_site_title_output', function( $output ) {
$tagline = '

Your tagline here

';

return $output . $tagline;
} );

generate_post_date_show_updated_only

generate_post_date_show_updated_only

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.

If you only want the updated date HTML to display use the generate_post_date_show_updated_only below:

add_filter( 'generate_post_date_show_updated_only', '__return_true' );

Fixing WordPress Excerpts Word Count in Chinese

Fixing WordPress Excerpts Word Count in Chinese

Some users reported that the WordPress excerpts word count is incorrect in Chinese. This PHP snippet should help:

function dez_filter_chinese_excerpt( $output ) {
global $post;
//check if its chinese character input
$chinese_output = preg_match_all("/p{Han}+/u", $post->post_content, $matches);
if($chinese_output) {
$output = sprintf( '%1$s

%3$s

',
mb_substr( $output, 0, 50 ) . '...',
get_permalink(),
__( 'Read more', 'generatepress' )
);
}
return $output;
}
add_filter( 'get_the_excerpt', 'dez_filter_chinese_excerpt' );

Sidebar Widths

Sidebar Widths

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

You can adjust the width of your sidebars in Customize > Layout > Sidebars.

The widths are percentage based, and the width of the content area is determined by the width of the sidebars.

Fixed Width

If you prefer to use a fixed width sidebar on desktop, try using the following CSS:

@media (min-width: 769px) {
#right-sidebar {
width: 300px;
}
.inside-right-sidebar {
padding-right: 20px;
}
body:not(.no-sidebar) #primary {
width: calc(100% - 300px);
}
}

Using a filter

In some cases you might want to set the width of your sidebar(s) differently than the global setting.

For this, we can use some PHP. For example, the right sidebar:

add_filter( 'generate_right_sidebar_width','tu_custom_right_sidebar_width' );
function tu_custom_right_sidebar_width( $width ) {
// If we're on the home page
if ( is_front_page() ) {
return 40;
}

// Return the default
return $width;
}

add_filter( 'generate_left_sidebar_width','tu_custom_left_sidebar_width' );
function tu_custom_left_sidebar_width( $width ) {
// If we're on a category
if ( category() ) {
return 40;
}

// Return the default
return $width;
}

Learn how to add PHP here.

When setting your custom value, set it as an integer while remember it represents a percentage. The above example is assuming we want a 40% wide sidebar.

You can use any of the available WordPress conditionals.

generate_after_header

generate_after_header

Note: This hook is included in the GP Hooks add-on inside GP Premium.
The generate_after_header hook appears right after the closing

 element.
Usage
Please refer to the Using Hooks article to learn how to use this hook.