Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1367351

    Hi,
    I needed to create new post types for our website, which I did. But when I create a new post type, the Avia Builder does not show as it does with posts and pages.
    Can you tell me how to do that?
    Thanks

    #1367370

    Hey Ressources_Formation,

    Thank you for the inquiry.

    You have to add the custom post type in the list of supported post types by the Advance Layout Builder. Please check the documentation below for more info.

    // https://kriesi.at/documentation/enfold/intro-to-layout-builder/#alb-for-any-post-type

    There should be at least one taxonomy (category, tag or a custom one) in the post type.

    Best regards,
    Ismael

    #1367431

    Hi, Ismael
    Thanks for your message and your help.
    I read your documentation on the subject and am now faced with several problems.
    – I downloader the enfold child theme… but it damaged my whole lay out, causing bugs too. I came back to normal after half an hour work;
    – I can add the recommended snippet codes… but where exactly in the functions.php file? That file is quite dense and has 858 lines, I want to be sure of the exact location where I will paste the code without damaging this vital file.
    – If I understand the documentation properly, I need to paste 2 series of code:
    > first, the necessary code as I am not using a child theme :
    if(isset($avia_config[‘use_child_theme_functions_only’])) return;
    > then, the code used to display my custom post types:
    function avf_alb_supported_post_types_mod( array $supported_post_types )
    {
    $supported_post_types[] = ‘YOUR CUSTOM POST NAME’;
    $supported_post_types[] = ‘YOUR CUSTOM POST NAME’;
    return $supported_post_types;
    }
    add_filter(‘avf_alb_supported_post_types’, ‘avf_alb_supported_post_types_mod’, 10, 1);

    – The documentation also says a third series of code should be added for layout metaboxes (see below)… What are they? And again, where should I paste in the functions.php file?
    function avf_metabox_layout_post_types_mod( array $supported_post_types )
    {
    $supported_post_types[] = ‘YOUR CUSTOM POST TYPE’;
    return $supported_post_types;
    }
    add_filter(‘avf_metabox_layout_post_types’, ‘avf_metabox_layout_post_types_mod’, 10, 1);

    – last but not least: ‘YOUR CUSTOM POST TYPE’ should be replaced by what, the slug of my custom post type I guess?

    Thanks for your help, have a nice day

    #1367510

    Hi,

    Thank you for the update.

    I downloaded the enfold child theme… but it damaged my whole lay out, causing bugs too. I came back to normal after half an hour work;

    After activating the child theme, you have to import the parent theme options to retain the existing layout or settings. Please check the documentation below for more info about the child theme.

    // https://kriesi.at/documentation/enfold/child-theme/

    Once the child theme is activated and parent theme options are imported, edit the functions.php file and place the avf_alb_supported_post_types filter, and make sure to replace the placeholders with the actual name of the new post type.

    function avf_alb_supported_post_types_mod( array $supported_post_types )
    {
      $supported_post_types[] = 'MAKE-SURE-TO-REPLACE-THIS-WITH-THE-ACTUAL-CUSTOM-POST-TYPE';
      return $supported_post_types;
    }
    add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1);
    

    The avf_metabox_layout_post_types filter will just enable the Layout metabox for the post type, where you can adjust the settings for the header, sidebar, etc.

    If you want to place the filter directly in the parent theme’s function.php file, try to put the filters or changes at the very bottom of the file.

    Best regards,
    Ismael

    #1367588

    Hi, Ismael
    Thanks for your anwsers, things are slightly improving… but are still not fully functionnal.

    I installed the child theme and inserted the necessary code in the functions.php file. The custom post type can be displayed but only with its title and icon image. The advanced custom fields do not display at all… What is missing?

    Thanks in advance for your answer… I’m sure we are almost there!
    Take care

    #1367621

    Hi, again
    While I was waiting for your answer, I tried to investigate a bit more to find the solution to my “advanced fieds not displaying” problem.
    I found out that to display these advanced custom fields, I needed to insert more code in the single.php file. This is the code:
    <div class=”infos-service”>

    • Collectivités : <?php the_field(‘collectivites’); ?>
    • Adresse : <?php the_field(‘adresse’); ?>
    • Téléphone : <?php the_field(‘telephone’); ?>
    • Courriel : <?php the_field(‘courriel’); ?>
    • Services et prestations : <?php the_field(‘services-et-prestations’); ?>
    • Missions autres que documentaires : <?php the_field(missions-autres-que-documentaires’); ?>
    • Rattachement hiérarchique : <?php the_field(‘rattachement-hierarchique’); ?>
    • Nombre de personnes dans le service : <?php the_field(‘nombre-de-personnes-dans-le-service’); ?>
    • Logiciel documentaire utilisé : <?php the_field(‘logiciel-documentaire-utilise’); ?>

    </div>

    I now have 2 questions:
    – I’m supposed to insert these lines in the single.php file but there is no such file in the Enfold Child Theme larger file. Should I insert these code lines in the regular Enfold file?
    – if so, my documentation (https://kinsta.com/blog/advanced-custom-fields/#display) tells me I should paste below the entry-content section… which does not exist in the Enfold single.php file. I’m pasting the whole file below, could you tell me where I need to paste the new code lines? Thanks in advance!

    <?php
    if( ! defined( ‘ABSPATH’ ) ) { die(); }

    global $avia_config;

    /*
    * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    */
    get_header();

    $title = __(‘Blog – Latest News’, ‘avia_framework’); //default blog title
    $t_link = home_url(‘/’);
    $t_sub = ”;

    if( avia_get_option( ‘frontpage’ ) && $new = avia_get_option( ‘blogpage’ ) )
    {
    $title = get_the_title( $new ); //if the blog is attached to a page use this title
    $t_link = get_permalink( $new );
    $t_sub = avia_post_meta( $new, ‘subttenitle’ );
    }

    if( get_post_meta( get_the_ID(), ‘header’, true ) != ‘no’ )
    {
    echo avia_title( array( ‘heading’ => ‘strong’, ‘title’ => $title, ‘link’ => $t_link, ‘subtitle’ => $t_sub ) );
    }

    do_action( ‘ava_after_main_title’ );

    ?>

    <div class=’container_wrap container_wrap_first main_color <?php avia_layout_class( ‘main’ ); ?>’>

    <div class=’container template-blog template-single-blog ‘>

    <main class=’content units <?php avia_layout_class( ‘content’ ); ?> <?php echo avia_blog_class_string(); ?>’ <?php avia_markup_helper(array(‘context’ => ‘content’,’post_type’=>’post’));?>>

    <?php
    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-index.php and that will be used instead.
    *
    */
    get_template_part( ‘includes/loop’, ‘index’ );

    $blog_disabled = ( avia_get_option(‘disable_blog’) == ‘disable_blog’ ) ? true : false;

    if( ! $blog_disabled )
    {
    //show related posts based on tags if there are any
    get_template_part( ‘includes/related-posts’ );

    //wordpress function that loads the comments template “comments.php”
    comments_template();
    }
    ?>

    <!–end content–>
    </main>

    <?php
    $avia_config[‘currently_viewing’] = ‘blog’;
    //get the sidebar
    get_sidebar();

    ?>

    </div><!–end container–>

    </div><!– close default .container_wrap element –>

    <?php
    get_footer();

    #1367663

    Hi,

    Glad to know that you managed to include the custom fields in template. Please let us know if you have more questions bout the theme.

    Have a nice day.

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Avia Page Builder and Custom Post type’ is closed to new replies.