Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1490024

    I’ve watched the video on how to add a custom template to a new custom post type (in this case Portfolio Item). However, I would like to set up my child theme so that each Portfolio Item, when created, will already have this custom layout set up. I’ve looked throughout the settings and I cannot find a place to set my custom layout for ALL instances of a custom post type. Can you help me? Thank you in advance for any assistance.

    #1490091

    Hey milkrow,

    Thank you for the inquiry.

    There is no built-in option for this by default. You’ll need to edit each portfolio entry manually, switch to the Advanced Layout Builder and add the custom element template. There is a workaround, but it requires manually adding a code to your functions.php file and adjust it according to your requirements.

    https://kriesi.at/support/topic/importing-lots-of-data-to-scf-custom-posts-all-having-same-template/#post-1473195

    Best regards,
    Ismael

    #1490141

    Thank you for the reply. I will try this and let you know how it goes. Since the Portfolio custom post type is already part of the theme, it would be very helpful to your users to have a way to implement custom layouts for all posts of that type. It could be a setting in the advanced area, such as the one you provide to register new CPTs for using ALB. For new CPTs that aren’t. original to the theme, I understand that would be a “different” animal. I hope you’ll consider that for future releases.

    #1490157

    Hi,

    Thank you for the update.

    We’ll forward your request to our channel. Let us know if the function works.

    Best regards,
    Ismael

    #1490214
    This reply has been marked as private.
    #1490228

    Hi,

    Thank you for the update.

    but when I created a new “portfolio”, the custom layout did not exist in ALB.

    You need to create all of your portfolio items first before running the function. The function will look for all items in the same post type, switch the builder to ALB by creating all the necessary post meta information or custom fields, and then apply your selected custom layout. After running it once, you can delete the code.

    It’s also possible to connect it to a custom button so that you can run it manually when needed, but that would require additional modifications beyond the scope of support.

    Let us know if you need more info.

    Best regards,
    Ismael

    #1490257

    Ah, that wasn’t clear. I was seeking a solution such that the custom layout would be a template used for each time a new post is created. But this may work…allow me to test this to be used the way you’ve described and I’ll circle back.

    Thansk Ismael!

    KC

    #1490264

    Hi,

    You could wire this function to a save_post hook, automatically assigning the custom layout whenever a new portfolio item is created. Please refer to this documentation for more info.

    https://developer.wordpress.org/reference/hooks/save_post/

    Best regards,
    Ismael

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