Setting Up a Simple Custom Post Type

Setting Up a Simple Custom Post Type

Here are the quick steps to take when implementing a custom post type in GeneratePress.

1. Register your custom post type

You can either use the full method WordPress provided here:https://developer.wordpress.org/plugins/post-types/registering-custom-post-types/Or a use one of the tools like these:https://generatewp.com/post-type/https://en-ca.wordpress.org/plugins/custom-post-type-ui/This sets the parameters of what the CPT can do, the slug for the templates to be used and where its displayed in the Dashboard Menu.

2. Acquire the templates

Take a copy of the single.php and the content-single.php, then rename them to they match the slug of your CPT tag like single-project.php and content-project.php.

3. Update the single-project.php file

In the single-project.php file, replace this line with the following:

get_template_part( 'content', 'project' );

4. Edit the content-project.php file

Now you are ready to edit the content-project.php file if you need to adjust the structure at all.

Site Library Unavailable

Site Library Unavailable

Constant loading

If your Site Library page is in a constant state of loading, it can mean your WordPress installation is having trouble connecting to the WordPress REST API.

If this is the case, a simple fix that usually works is going to 「Settings > Permalinks」 and clicking the Save button. This can sometimes kickstart WordPress to start recognizing the REST API as it should. Now go into the Library to see if the sites are loading.

No sites found

If you can see the Site Library tab, but no sites exist, it means your server isn』t able to communicate with gpsites.co

First, click the 「Refresh Sites」 button. This will try to fetch the sites again.

Note: As of GP Premium 1.8.2, it may be necessary to click the Refresh Sites button twice (if nothing changes on first click). This will be fixed in GP Premium 1.9.

If that doesn』t work, install the Query Monitor plugin. Once installed and activated, head back to 「Appearance > GeneratePress > Site Library」 and click the Refresh Sites button again.

In your admin bar, hover the Query Monitor area and click the HTTP API Calls link, as the screenshot below shows.

The most common error is shown above: cURL error 28

This typically means your server isn』t able to communicate with gpsites.co (where the API for our Site Library lives).

You can check with your hosting support, as they will be able to tell why the error is happening.

If there isn』t a block in place, it』s possible that ModSecurity is enabled on your server. Ask your hosting to disable it while you use the Site Library. It can be turned back on once you』re done using the importer.

Supported PHP Version

If you activate GP Premium and the Site Library module but do not see the Site Library tab, it means your site is using an old version (<5.4) of PHP. You can check the version by using Display PHP Version plugin.

Our recommendation would be to use PHP version 7+ for the security and speed of your site.

Sections Overview

Sections Overview

This feature is deprecated and no longer supported as of GeneratePress Premium 2.0. Instead, we suggest checking out our GenerateBlocks plugin.

Sections is our own very simple page builder.

If you』re already using a more advanced page builder, you won』t need to activate Sections.

Please note that Sections cannot be used with Gutenberg editor.

Turning on Sections

By default, Sections can only be used on Pages and Posts.

Enabling Sections on the page will remove the default editor, and will also remove the sidebars from your page.

To turn them on, open your page/create a new page, and click the Use Sections toggle which should be at the top right.

Use Sections

Adding a Section

Once you』ve turned Sections on, the default editor will disappear, you』ll see the Add Section button.

Add Section

Clicking the Add Section button will add a new Section to the page.

Adding Content

You can click the Section title or the pencil icon to open the content area of your Section.

The Section content editor is an exact copy of the default WordPress editor, with all of the same options.

Section Content

Opening the Section Settings

If your Section is already open, you can just click on the Settings tab on the left of your content.

If not, you can open the settings directly by clicking on the cog icon in your Section bar.

Section Settings

Section Settings

Sections have the following settings.

Layout

Box type – whether your outer section container is full width or contained.Inner box type – whether your inner section container is full width or contained.Custom ID – Add a custom ID to your section – useful when linking to specific sections.Custom Classes – Add custom CSS classes to the section container.Top padding – Set the amount of padding (inner spacing) at the top of your section. Choose pixels or percentage.Bottom padding – Set the amount of padding at the bottom of your section. Choose pixels or percentage.

Colors

Background colorText colorLink colorLink color on hover

Background Image

Background image – Upload a background image for you sectionParallax effect – Add a parallax (slight movement) to your background image on scroll

Video Overview

Deprecated

As of GeneratePress Premium 2.0, this feature is officially deprecated and no longer supported.

If you absolutely must activate it, you can use the following filter. However, please be aware that this feature may break with future WordPress versions, so it』s highly recommended you go with an alternative like GenerateBlocks.

add_filter( 'generate_premium_deprecated_modules', function( $modules ) {
return array_diff( $modules, [ 'Sections' ] );
} );

Transparent Header and Navigation

Transparent Header and Navigation

Transparent header and navigation layout in the example above is very popular and can be achieve easily with our Header Element module. The steps are the same whether you are using a page builder or not. The key settings to achieve this are highlighted in blue below:

The settings highlighted in orange above are optional. It allows you to upload a custom Site Logo, Navigation Logo, Mobile Header Logo and set specific Navigation Location to match this specific page hero. Keep in mind that you will need to have existing logos uploaded in the customizer to use these options in header element.

Using the Site Library

Using the Site Library

GeneratePress Sites are importable sites that are built to give you a head start when building new websites.

These sites include GeneratePress options and demo content. If you already have content, you can choose to only import the GeneratePress options. The demo content should only ever be imported on fresh website with no content.

Importing a Site

Importing a site is super easy. First make sure you have GP Premium 1.6 or newer installed and the site library module activated, then head to Appearance > GeneratePress > Site Library. The filters on top of the page allow you to sort through sites by category and page builder:

You can click on the site you are interested in to see the details such as plugins required and responsive views:

If you have important data on your site already, please consider using a plugin like Duplicator to do a full backup of your site.

After you decided on a site that you would like to use, click Get Started to begin importing.

The second page shows the plugin(s) that will be installed and the plugins that are already installed.

There are two import options:

Import Theme Options: This option will import the customizer options only and skip all the demo content and page content.Import Demo Content: This option will import the demo content.

If you want your site to look exactly like the template, then importing both theme options and demo content are required.

Once you read the Confirm Import message, toggle the I understand button then click Begin Import.

After the importing process is completed, click the View Site button to start editing.

Removing an Imported Site

If you install a Site and decide you don』t want it, or you want to install a different one, head back into the main Site Library page and you』ll see the below message.

When you import a site, we take a quick backup of your existing settings first. If you decide to remove the imported site, we will restore those settings we took a backup of.

The removal process does make changes to your database, so if you have data you don』t want to risk losing, please take a site backup before doing this process.

It is possible to click the 「No thanks」 link and install another site on top of the site you already imported. However, remember that the backup is taken as you import a site, so if you import on top of another import, you will be taking a backup of the previously imported site. This means you won』t be able to go back to how your site was before the first site import.

Using the Premium Support Forum

Using the Premium Support Forum

Login

The first step to access the support forum and open a topic is to login using the username and password created during the checkout process when purchasing GP Premium.

The Log In button can be found at the top of the support page beside the search bar:

Open Support Topic

Once you are logged in, you will see the Open Support Topic button beside the search bar:

The button takes you to the bottom of the page which shows you the general forum rules:

And pre-topic check list:

We would really appreciate if you can go through the two lists before opening a topic.

Private Information

Please keep in mind that this is a public forum so make sure to use the Private information field if you are going to provide info such as website URLs, login credentials, screenshots etc.

The info provided in the field is only visible to our customer support staff and is automatically removed once the topic is marked as resolved.

Forum Profile

The forum profile feature is often missed by our users.

It allows you to check the topics you have started:

Or change your forum display name so you can remain completely anonymous when posting topics:

Uploading Screenshots

Generally, our support staff can resolve issues most efficiently if you can provide the site URL in the Private information box so that we can view the issues and inspect the code.

If you need to upload screenshots for explanations, you can use a cloud service like Postimages or Imgur.

Profile Picture

The forum profile picture/Avatar can be uploaded using the Gravatar service.

Debug Mode Enabled

Debug Mode Enabled

When using the Site Library, you may see a message like this:

Having WP_DEBUG enabled during the import process may cause issues if the plugins being imported have any PHP notices or errors.

In order to ensure a smooth import process, it』s a good idea to set WP_DEBUG to false.

To do so, find your wp-config.php file in the root folder of your website via FTP or File Manager, and set WP_DEBUG to false. Save the file, then refresh the Site Library and proceed with your import.

Block Element – Archive Navigation

Block Element – Archive Navigation

Starting in GP Premium 2.0, you can create an archive navigation in the Block Element module with the help of Dynamic Blocks and Dynamic Data.

You can access it by creating a new block element, then select archive navigation under the Element type dropdown menu:

Settings

Templates

Import a template.

Hook name

Select one of hooks to insert the archive navigation.

Priority

Set the priority of the archive navigation. This is useful when there are multiple elements added within the same hook.

Disable default pagination

Remove the default pagination.

Keep default archive navigation container

Keep the default paging-navigation container so the content padding applies.

Block Element – Post Navigation

Block Element – Post Navigation

Starting in GP Premium 2.0, you can create a post navigation in the Block Element module with the help of Dynamic Blocks and Dynamic Data.

You can access it by creating a new block element, then select post navigation under the Element type dropdown menu:

Settings

Templates

Import a template.

Quick hook select

Select one of the three common hooks to insert the post meta template.

Hook name

Select other hooks that are not listed under quick hook select.

Priority

Set the priority of the post meta template. This is useful when there are multiple elements added within the same hook.

Disable default post navigation

Remove the default post navigation.

Add default archive navigation container

Keep the default paging-navigation container so the content padding applies.

GenerateBlocks Container Settings

Inline post meta items

Inline the items inside this container. This is useful when adding dynamic data items such as author, post date, categories etc.

Inline alignment

Set the alignment of the inline post meta items.

Remove Container condition

Remove the container under certain condition such as when there is no previous or next post available.

In Same term

Set further condition when the container is removed based on taxonomy.

Block Element – Post Meta Template

Block Element – Post Meta Template

Starting in GP Premium 2.0, you can create a post meta template in the Block Element module with the help of Dynamic Blocks and Dynamic Data.

You can access it by creating a new block element, then select post meta template under the Element type dropdown menu:

Settings

Templates

Import a template.

Location

Choose the location to display this post meta.

Replace default primary post meta

Replace the default header entry meta with the template created.

Replace default secondary post meta

Replace the default footer entry meta with the template created.

GenerateBlocks Container Settings

Inline post meta items

Inline the items inside this container. This is useful when adding dynamic data items such as author, post date, categories etc.

Inline alignment

Set the alignment of the inline post meta items.