Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1366265

    Dear support,
    I am trying to get ALB work with a custom post type – events – and I have added the following code, according to this page – https://kriesi.at/documentation/enfold/intro-to-layout-builder/#alb-for-any-post-type

    <?php
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    function avf_alb_supported_post_types_mod( array $supported_post_types )
    {
      $supported_post_types[] = 'events';
      return $supported_post_types;
    }
    add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1);
    
    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
    // END ENQUEUE PARENT ACTION

    But I don’t see the events post type when I add the Blog post Element to a page.
    Am I trying something impossible here?

    Please feel free to have a look – it is a test install.

    Is there any way I can use ALB to edit an Event single page or Archive page?

    Best,

    Chrilles

    #1366299

    you have to pay attention to get the correct post type – is it events or event ( events manager plugin ) or tribe-events ( The Events Calendar Plugin ) etc.

    #1366301

    Hi,

    Thank you for the inquiry.

    As @Guenni007 mentioned above, you have to make sure that the appropriate post_type is added in the supported list. Please provide the login details in the private field if you require more assistance.

    Best regards,
    Ismael

    #1366305

    try this in addition : ( if it is events manager ) :
    ( on tribe events you had to change that array from event to tribe-events )

    function enable_boxes_on_events($boxes) {
    $boxes[] = array( 'title' =>__('Avia Layout Builder','avia_framework' ), 'id'=>'avia_builder', 'page'=>array('event'), 'context'=>'normal', 'expandable'=>true );
    $boxes[] = array( 'title' =>__('Layout','avia_framework' ), 'id'=>'layout', 'page'=>array('event'), 'context'=>'side', 'priority'=>'low');
      return $boxes;
    }
    add_filter('avf_builder_boxes','enable_boxes_on_events');

    and if you like to show events you have to choose on top: show from a taxonomy – and then events-categories ( don’t know it is on tribe events )
    (sorry screenshot is on german language)

    #1366335

    Hi,

    Thanks for helping out @guenni007 :-)

    Best regards,
    Rikard

    #1366375

    Thanks a lot, @Guenni007!

    I will try that, but first some questions.

    Do I have to/should I remove my old code (shown above) from the functions.php file?
    Does it matter, where in the functions.php file I insert your code?
    And, I am using Events Manager – but it looks like the template is page.php – see image here?

    I have tried to insert your code and removed mine, but now I don’t get access to the ALB editor when I open a page/post.
    Any ideas?

    Ricard, please feel free to log in via the link in the private content section.

    Best,

    Chrilles

    #1366411

    sorry i could not see private content as participant.
    i use on some installations events manager – and the post-type for it is : event
    not events

    Did you work with a child-theme or only parent theme ?
    If you work with parent theme only – the very beginning of functions.php seems for me not the best position.

    I would recommend to insert it in between the comment and the last line:
    there is a comment :

    /*
     *  register custom functions that are not related to the framework but necessary for the theme to run
     */
    
    require_once( 'functions-enfold.php' );

    i think your snippet is for using the alb editor on single events ( i do not use it with events – because content is set in the plugin itself )
    you have to use both snippets.

    #1366673

    Hi,

    Thank you for the update.

    We added the same filter in the functions.php file and adjusted the name of the post type from events to event. We also edited one of the events and added a test category, which can be selected later on in the Blog Posts element. (see private field)

    Best regards,
    Ismael

    #1366845

    OMG :-) – Thank you Guenni007, Rikard and Ismael. This is SO good. Your assistance is really appreciated.

    Not that I understand everything yet, but I am trying hard to be more knowledgeable about CPTs.

    If anyone else should be interested – here is how the function.php – for the child site looks now

    This code is working for the Events Manager by Marcus Sykes.

    <?php
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    function avf_alb_supported_post_types_mod( array $supported_post_types )
    {
      $supported_post_types[] = 'event';
      return $supported_post_types;
    }
    add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1);
    
    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
    // END ENQUEUE PARENT ACTION

    I used the Theme Editor plugin to edit the functions.php file – just because it is easy (but I do also have FTP access)

    Best,

    Chrilles

    #1366863

    Hi,

    Great, I’m glad that you got it working, and thanks for sharing your code :-)

    Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1366910

    Rikard, Ismael, et al

    We really need better guides for CPTs in general. I know you have some helpful steps, but unless I am missing it somewhere, there is very little regarding showing metadata in a way that makes it easy for non-hard-core programmers. There is a ton for Elementor, Beaver Builder, etc., but beyond a couple really limited examples, there is nothing like your other guides.

    Someone once offered to build a guide for Enfold, but was all-but shot down that it was not needed. These posts keep coming up because it IS NEEDED. Guenni is Awesome and jumps in to help constantly, but people have to dive into the forums to find any help. If someone could create a comprehensive guide for these two areas, it would do SO MUCH service to this Enfold community.

    Please.

    #1366913

    @Jason E, I absolutely agree 👍 That would be so nice.

    #1366994

    Hi,

    Thanks for your input, we’ll look at writing some more in depth documentation.

    Best regards,
    Rikard

    #1367085

    Hi,

    We have updated – https://kriesi.at/documentation/enfold/intro-to-layout-builder/#alb-for-any-post-type and added a screenshot to make it easier to find CPT name and a new “Displaying Metadata of your Custom Post Type” section right below it to point out how metadata could be displayed in CPTs :)

    Regards,
    Yigit

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