Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1265244
    Sandra
    Participant

    Hi there,

    Thanks to this post, I managed to set up custom posts https://community.theme.co/forums/topic/using-cornerstone-to-create-custom-post-type-page-template/ :). I am not a coder, so it was a little struggle, but that’s alright.

    Now on this post https://pmetools.ch/archives/realisations/ciip, I would like to display the content of checkboxes (for instance the name of partners). I did find this resource https://www.advancedcustomfields.com/resources/checkbox/ but didn’t know how to integrate the it in my code.

    Thanks a lot and please find below the content of my wp-single-realisations.php and attached my custom post backend

    Sandra

    <?php

    // =============================================================================
    // VIEWS/RENEW/WP-SINGLE-REALISATIONS.PHP
    // —————————————————————————–
    // Single post output for Integrity.
    // =============================================================================

    $fullwidth = get_post_meta( get_the_ID(), ‘_x_post_layout’, true );
    $domaine = get_field(‘domaine’);

    ?>
    <?php get_header(); ?>

    <div class=”x-container max width offset”>
    <div class=”<?php x_main_content_class(); ?>” role=”main”>

    <?php while ( have_posts() ) : the_post(); ?>
    <?php x_get_view( ‘integrity’, ‘content-realisations’, get_post_format() ); ?>
    <?php x_get_view( ‘global’, ‘_comments-template’ ); ?>
    <?php echo do_shortcode(‘
    [cs_content][cs_section parallax=”false” style=”margin: 0px 0px;padding: 0px 0px;”]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px;”][cs_column type=”1/1″ style=”padding: 0px;”][cs_text]<h1>’.get_post_meta( get_the_ID() , ‘titre’, true ).'</h1>[/cs_text][/cs_column][/cs_row]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px;”][cs_column type=”1/1″ style=”padding: 0px;”][cs_text]<h3>La situation :</h3>’.get_post_meta( get_the_ID() , ‘situation’, true ).'[/cs_text][/cs_column][/cs_row]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px;”][cs_column type=”1/1″ style=”padding: 0px;”][cs_text]<h3>Comment ça s’est passé :</h3>’.get_post_meta( get_the_ID() , ‘comment’, true ).'[/cs_text][/cs_column][/cs_row]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px;”][cs_column type=”1/1″ style=”padding: 0px;”][cs_text]<h3>L’impact :</h3>’.get_post_meta( get_the_ID() , ‘impact’, true ).'[/cs_text][/cs_column][/cs_row]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px 0px;”]
    [cs_column type=”1/1″ style=”padding: 0px;”][cs_text]’.get_post_meta( get_the_ID() , ‘partenaire’, true ).'[/cs_text][/cs_column][/cs_row]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px;”][cs_column type=”1/1″ style=”padding: 0px;”][cs_text]’.get_post_meta( get_the_ID() , ‘secteur’, true ).'[/cs_text][/cs_column][/cs_row]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px 0px;”][cs_column type=”1/1″ style=”padding: 0px;”][cs_text]
    XXX[/cs_text][/cs_column][/cs_row]
    [cs_row inner_container=”true” style=”margin: 0px 0px;padding: 0px 0px;”][cs_column type=”1/1″ style=”padding: 0px;”][cs_text]’.get_post_meta( get_the_ID() , ‘date_update’, true ).'[/cs_text][/cs_column][/cs_row]
    [/cs_section][/cs_content]
    ‘); ?>
    <?php endwhile; ?>

    </div>

    <?php if ( $fullwidth != ‘on’ ) : ?>
    <?php get_sidebar(); ?>
    <?php endif; ?>

    </div>

    <?php get_footer(); ?>

    #1265262
    Lely
    Moderator

    Hello Sandra,

    We can add the the sample code depending on where you want it to appear. For example, we can add this:
    <p>Colors: <?php the_field('colors'); ?></p>
    after this line:
    <?php endwhile; ?>

    Just use the custom field you have added instead of colors.

    Hope this helps.

    #1265294
    Sandra
    Participant

    Hello Lely,

    Thanks. Worked perfectly.

    Have a nice day,

    Sandra

    #1265318
    Paul R
    Moderator

    You’re welcome! 🙂

  • <script> jQuery(function($){ $("#no-reply-1265244 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>