- This topic has 12 replies, 2 voices, and was last updated 1 week, 2 days ago by David.
March 17, 2023 at 2:33 am #2570789xie
I have created a custom post type, how do I load its content, I have made a template into a plug-in, which is convenient for maintenance, how do I do it?March 17, 2023 at 3:00 am #2570807xie
But, If you do not create a specific template, then WP would use the themes single.php.
Then you can use a Block element Content Template to design the CPT, by setting the Display Rules Location to the Custom Post Type Name.
This methods means you don’t require a custom template unless there are code specific things you need to change.”
I saw this answer in this post. This is what I want. I just want to display the default GP theme template, but I don’t know how to set it up. If I need to add code, I hope it will be added to the custom plugin. If not, add it code, that’s even better. Because you don’t want to break your custom code by updating.March 17, 2023 at 3:10 am #2570816xie
By the way, I need to add products and pages, and I want to manage products separately, so I just registered the new post type, if there is another way that is better, please let me know.March 17, 2023 at 4:37 am #2570923DavidStaffCustomer Support
you can try using the Block Element – Content Template.
1, go to Appearance > Elements –> Add New —> Block Element.
2. set the Element Type to
3. In the editor add a Post Content block.
4. Set the Display Rules -> Location to your single post type.
5. Publish this.
Then check if it shows your posts.
If it does you can edit the block element and design it and add other dynamic data as you need.
Adding CSS: http://docs.generatepress.com/article/adding-css/March 18, 2023 at 5:12 am #2572022xie
I’m a little dizzy looking at it, the documentation is too simple, I know that you can use element block positioning to make different templates, which works great.
However, I’m still figuring it out, like if I want to create a new menu and post type for others to use, how do I set this field only?
I looked at the settings and it seems that only terms and custom fields can be used.
Don’t see custom post types.March 18, 2023 at 5:15 am #2572027xie
I have to say the design is really cool. But the usage docs are terrible. I’m not smart enough to know all of its features just by looking at a little description. HahahaMarch 18, 2023 at 5:44 am #2572059DavidStaffCustomer Support
The Block Element is only means to displaying the content ie. you are making a template to display your data.
What it cannot do is create the fields you may need on your custom post type.
Did you follow the steps i provided above? And did you see any thing on your custom post types ?
Adding CSS: http://docs.generatepress.com/article/adding-css/March 18, 2023 at 8:18 am #2572307xie
Opening the link before I set it shows 404
I do this step:
【4. Set the Display Rules -> Location to your single post type.】
But the page will now 301 to the homepage.
I don’t know where I went wrong, hahaha.March 18, 2023 at 8:41 am #2572326xie
I tried the steps on a test site, all ok. Now we can know that it is not a gp problem.March 18, 2023 at 8:54 am #2572338xie
I know the problem, I set the data, and then 404, but rank math gave it 301 (I have confirmed that the 301 function is turned off, but it still automatically 301, which makes me don’t know why this happens, after After checking, only this plugin has this function, I uninstalled it. Now everything is fine.)
My problem solved, GPP is awesome, it does what I want, I’ve removed the 3 plugins I had to install before, it’s great.
I don’t know where these configuration options can be used, can you tell me.
Select the tag names to apply to the content template.
Set the condition which the content template is applied to.March 18, 2023 at 10:23 am #2572425DavidStaffCustomer Support
Glad to hear that 🙂
Tag Name: this changes the HTML wrapper of your template it defaults as
<article>and in most cases you can leave it as is.
Apply to: for most cases and particulary a single post you can leave that on the default All posts.
For more complex scenarios on say an archive page, you can create a template that only applies to the first post or posts with a specific term, allowing you to mix content templates. See here for an example:
Adding CSS: http://docs.generatepress.com/article/adding-css/March 18, 2023 at 8:16 pm #2572677xie
Thank you so much. This solved my problem.March 19, 2023 at 5:26 am #2572879DavidStaffCustomer Support
Adding CSS: http://docs.generatepress.com/article/adding-css/
- You must be logged in to reply to this topic.