- This topic has 3 replies, 2 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
January 17, 2023 at 5:11 am #2498728
Stefanie
Hi again,
i am just beginning to understand all the different possibilities of GP and GB, and must say i am thrilled and wonder why i didn’t discover you guys much earlier…
Here’s a quick question, just for understanding:
Basically, i can do without custom post types in the future, right? Because there are GP elements, so I can build a different page type for each category. Am I thinking in the right direction? Do I need then for such a case necessarily a plugin like ACF? (as I have understood so far, I can read the fields from ACF via Elements/Hooks).
Or do i need something else to create custom post types with GP Elements? I’m trying to find information on the net about this particular topic, but at the moment i haven’t found anything yet.
Thanks for a quick assessment
January 17, 2023 at 6:42 am #2498815David
StaffCustomer SupportHi there,
first off – thanks for the kind feedback. Super happy to hear that 🙂
Ill break my answer into parts.
1. Without registering a CPT
If you’re happy to just use the core Post types of: Post and Page.
And you want to display different content or a different design based upon a post taxonomy term
Then Yes, you can use a GP Element – Content Template and set the Display Rules for your taxonomy terms2. With CPT
Where you require a dedicated Admin Menu for your CPT then you would need to register one.
You would still need code or a plugin to do that. Handy site ( not related to GP ) for code otion: https://generatewp.com/post-type/Generally with CPTs you would create a template eg.
single-{cpt-slug}.phpto display a different layout or its custom content.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 theCustom Post Type Name.
This methods means you don’t require a custom template unless there are code specific things you need to change.3. Custom Content from ACF or other custom fields
The GenerateBlocks blocks supports dynamic data, and you can display content from a Custom Field by setting the blocks dynamic data Content Source to
Post Metaand adding the name of the custom field.There are some limitations for now. For example: you can’t get data from ACF Repeater Fields. you would need to write ACF shortcodes for that.
4. What if i need a custom template for my CPT but still want to use Block Elements.
You can do that too.
By using the themes templates as a basis you can save copies of eg.single.phpandcontent-single.phpfor your needs. There is some slight code changes that need to be made there, and if thats a requirement we can advise on that.Does that help ?
January 18, 2023 at 8:36 am #2500459Stefanie
Hi David
that sounds very very good, thank you for your detailed answer.
I have now created my first CPT without a plugin (with GenerateWP, that’s really very handy!) It is actually better to have a separate menu item in the dashboard, it makes the whole thing clearer.
>> But, If you do not create a specific template, then WP would use the themes single.php.
that is good to know!!So i will now continue to work with ACF and GBs dynamic data, i’m already very curious how that works out 🙂
Thanks a bunch!
StefanieJanuary 18, 2023 at 9:33 am #2500530David
StaffCustomer SupportAs a general note, when you register a CPT, you may need to regenerate the sites Permalinks for them to display. You can do this by Dashboard > Settings > Reading and Clicking Save Changes. Sometimes it can take a few goes 🙂
Glad to be of help!!
-
AuthorPosts
- You must be logged in to reply to this topic.