Tagged: x
-
AuthorPosts
-
November 21, 2016 at 5:47 am #1265244
SandraParticipantHi 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(); ?>
November 21, 2016 at 6:02 am #1265262
LelyModeratorHello 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.
November 21, 2016 at 6:26 am #1265294
SandraParticipantHello Lely,
Thanks. Worked perfectly.
Have a nice day,
Sandra
November 21, 2016 at 6:55 am #1265318
Paul RModeratorYou’re welcome! 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1265244 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
