[Support request] generate_do_template_part CPT with or without child theme?

Home Forums Support [Support request] generate_do_template_part CPT with or without child theme?

Home Forums Support generate_do_template_part CPT with or without child theme?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2355814
    Troy

    Ive created a CPT in a plugin. Ive created custom fields using ACF and its all working. I duplicated the single and content php files and switched the line of code in single-cpt.php. My single php template loads but not the content php.

    I had hoped not to resort to asking for help, but I’m out of my depth apparently. Ive come to realize that it has to do partly with the choice to use a child theme or not. Is this correct?

    Ive been led to believe over the years that using a child theme is always the correct choice in all manners of site customization. Is this not true? If I didnt use a child theme and the parent theme updates, will it not overwrite any custom template files I might have (if they are in the generatepress theme directory)?

    Is it best to not use a child theme? I read somewhere here that you lose some of the features of GPP if you use a child theme with get_template_part( ‘content’, ‘cpt’ ).

    Anyways, Im just trying to suss out best practices (or something resembling intermediate web development) in all of this as gutenberg, GPP and GBP become more mature and feature rich. Ive only been using GPP for a year or so now and my head is spinning with all the changes that have already occurred in that short time.

    This is just a dev site, so it’s in relative disarray atm.

    Thx,

    Troy

    #2356648
    Ying
    Staff
    Customer Support

    Hi there,

    The UN/PW doesn’t work when I try to log in.

    Can you tell me what changes you want to make to the CPT template?

    #2356795
    Troy

    The changes I intend to make to the CPT template include creating a custom layout with various custom fields in regards to the CPT (price, image, tagline, description, ingredients, etc).

    I traditionally preferred to do this type of thing manually, as it was the best way for me to learn more about WP, PHP, etc (Im formally an artist and self taught developer). I tend to stay away from builders per se. My point is, I realize GBP will at some point allow me to build all of this within gutenberg 100% visually, but that day isn’t today…correct me if Im wrong. I’d rather custom code the template all in one place rather than create a dozen hook elements as well, which I understand is a great functionality to have, but it’s really not ideal for building a fully custom page or template.

    GPP and GBP are awesome…but it has to cater to both page builder non programmers as much as advanced web dev’s. I’m somewhere in the middle unfortunately.

    If I could create blocks for all my ACF fields and create the layout I want outside any major constraints, I would do that…but I don’t think I can at this point, right? I’ve managed to get dynamic fields for images from ACF working ok, but not for data.

    Im all ears as far as a better or best way to do this, especially looking forward.

    I posted/tested new credentials.

    Thx,

    Troy

    #2356933
    Ying
    Staff
    Customer Support

    I realize GBP will at some point allow me to build all of this within gutenberg 100% visually, but that day isn’t today

    Do you know about block element - content template? It allows you to create the content template using Gutenberg.
    https://docs.generatepress.com/article/block-element-content-template/

    I’ve managed to get dynamic fields for images from ACF working ok, but not for data.

    What kind of data? Let me know!

    #2356942
    Troy

    Ive only used the block element for page hero’s, which was definitely nice…as I was able to do things there that I would normally manually code.

    The data would come from ACF such as I mentioned above…price, image, tagline, description, ingredients, booking form info / modal etc.

    Am I able to pull those types of custom fields data into blocks?

    Any idea why my content template doesnt loud though…out of curiousity? It works if I use the old get_template_part.

    Thx,

    Troy

    #2356959
    Ying
    Staff
    Customer Support

    The data would come from ACF such as I mentioned above…price, image, tagline, description, ingredients, booking form info / modal etc.

    GB blocks are able to pull text, URL, image, number, so I think pulling price, image, tagline, description, ingredients is not an issue.

    Not sure about booking form info/modal, what field type would they be?

    #2357008
    Troy

    I only saw dynamic content and dynamic image. Is there an generateblocks update that I missed? im using the current GPP. How do I pull just normal text from ACF? The dynamic image block allowed me to just enter the meta field name, which I had hoped would be similar for any text based acf, but I never saw that capability. If this is the case, then perhaps I dont need to hand code a CPT template.

    #2357032
    Fernando
    Customer Support

    Hi Troy,

    There’s already release candidates for upcoming updates for GenerateBlocks and GenerateBlocks Pro.

    With the current version however, you should be able to pull normal text from ACF. You’ll need to use a GB Headline Block, and enable Dynamic data. Then, set the source to Post Meta, and the field name to the field name you set in your custom field. Reference: https://docs.generateblocks.com/article/headline-overview/#dynamic-data

    #2363187
    Troy

    Thanks Fernando, I tried to cobble together some of what I needed and it was straight-forward for the most part.

    Normally I’d suffer through any struggles or questions, but since I have this thread open…

    I can’t verify whether or not it’s possible to pull in values from an ACF checkbox field (if its specified as an array or not in ACF). Is my best choice for this to PHP old school shortcode?

    When I setup a dynamic GB Headline (or any dynamic block I believe), there are 2 areas which contain the dynamic field options – the 1st area is in the floating block menu and the second area is in the block sidebar. They don’t seem to mirror each other as far as the and it seems as though I need to complete both areas for a dynamic block to work. Is this accurate? At first I assumed it was just helpful UI redundancy or that I was just painfully blind to something.

    I notice when I choose Post Meta as a content source, it removes the ability to customize the text that appears in the block . In some instances I’m able to change the text to reflect what the field or value is for, purely for organizational purposes. Post Meta seems to lock the text. The page then just displays numerous blocks containing the text = Meta value, which can get confusing.

    I understand…the devs are trying to keep up with Gutenberg and ahead of the curve as they roll out all this new functionality. It’s not going to be absolutely perfect on release. Still…it’s awesome.

    Thanks again…

    Troy

    #2363251
    Ying
    Staff
    Customer Support

    I can’t verify whether or not it’s possible to pull in values from an ACF checkbox field

    I don’t think the headline block can pull the more complicated field types yet.
    Shortcode might not work in query loop block, it’s a WP issue.
    You can refer to this topic: https://generatepress.com/forums/topic/query-loop-wp-recipe-maker/#post-2362380

    there are 2 areas which contain the dynamic field options – the 1st area is in the floating block menu and the second area is in the block sidebar.

    The floating option is only available for GP premium users in the block element, and the sidebar options if for all GB users, no matter what theme they are using. You can use either of them.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.