Tagged: x
-
AuthorPosts
-
March 3, 2017 at 10:12 am #1393439
LyserParticipantHello,
i’ve tried ACF who semms very interesting tool and i’ve followed what’s written here for displaying fields but i dunno why it doesn’t work :Here’s what i have done for the x-child path of single.php and the added line for display text area field in it :

the text area field is correctly created :

but the text doesn’t appears int frontend : here
I’m sure it’s a little thing of nothing at all who go wrong but i don’t find it
March 3, 2017 at 10:15 am #1393442
LyserParticipantThis reply has been marked as private.March 3, 2017 at 1:17 pm #1393654
LyserParticipantok i finaly found my mistake (path error)
3 questions
1) Why the added fields are not in the white background in the frontpage ? How to put them in it ?
http://www.lyser.fr/testwp/2017/03/02/bonjour-tout-le-mondehere’s the code :
<?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', get_post_format() ); ?> <p><?php the_field('texte'); ?></p> <p>Évenement : <?php the_field('evenement'); ?></p> <p>Type de défi : <?php the_field('type_de_defi'); ?></p> <p>Donjon : <?php the_field('donjon'); ?></p> <p>Épreuve : <?php the_field('epreuve'); ?></p> <p>Difficulté : <?php the_field('difficulte'); ?></p> <p>Date et heure : <?php the_field('date_et_heure'); ?></p> <p>Nombre de groupes : <?php the_field('nombre_de_groupes'); ?></p> <p>Taille du groupe : <?php the_field('taille_du_groupe'); ?></p> <?php x_get_view( 'global', '_comments-template' ); ?> <?php endwhile; ?> </div> <?php if ( $fullwidth != 'on' ) : ?> <?php get_sidebar(); ?> <?php endif; ?> </div> <?php get_footer(); ?>2) You can see that each field is displayed on the frontpage, when you choose the first select field for exemple pve, all the other select fields (pvp) shouldn’t be displayed ! How can i do that ?
3) How can i put all the select fields in one line instead of a column ? And the text is still above the select fields but i put it in last position in the acf fields groups, why ? in fact i would like to have the same position of fields i made in the backoffice (fields up and text down).
March 3, 2017 at 8:49 pm #1394042
RadModeratorHi there,
1. It’s because they are below this line
<?php x_get_view( 'integrity', 'content', get_post_format() ); ?>If you wish to add them on the white box (entry-wrap), then you’ll have to edit each template for each post format. Eg. content.php, content-video.php, content-audio.php, etc.
2. What do you mean? Your code includes all the fields, hence, it should display them. Please provide some clarification 🙂
3. Don’t add them within
<p></p>and they will be inline.Thanks!
March 4, 2017 at 4:52 am #1394290
LyserParticipant1) ok thx, i have changed the code to content.php, now the fields are in the white background.
2) Ok here’s some clarification : In the first select field, you can choose bewteen pve and pvp (pve has more select fields displayed than pvp in the backoffice), if i choose pvp, the select fields of pve are still displayed in the frontpage (you can see by yourself with the log infos i gave you upper), that is not correct, if i choose pvp, the pve fields shouldn’t be displayed in the frontpage.
3) ok thx (i imagine it’s ok to put some <td>, <tr> and </span> in a php file to organise things ?)
March 4, 2017 at 8:08 pm #1394748
RadModeratorHi there,
2. Ah, I thought you’re referring to blog front page. You have to create your own condition. Example,
<?php $evenement = get_field( 'evenement' ); ?> <p>Évenement : <?php echo $evenement; ?></p> <?php if ($evenement=='PVP') :?> <p>Date et heure : <?php the_field('date_et_heure'); ?></p> <?php endif;?> <?php if ($evenement=='PVE') :?> <p>Date et heure : <?php the_field('date_et_heure'); ?></p> <?php endif;?>You’ll have to add those lines to their proper condition group.
3. Yes it’s okay, just as long as they are formatted correctly.
Hope this helps.
March 5, 2017 at 5:50 am #1394981
LyserParticipantPerfect, thx a lot 🙂
March 5, 2017 at 9:53 am #1395127
ChristianModeratorYou’re welcome.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1393439 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
