Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1393439
    Lyser
    Participant

    Hello,
    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 :
    single.php

    the text area field is correctly created :
    single.php

    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

    #1393442
    Lyser
    Participant
    This reply has been marked as private.
    #1393654
    Lyser
    Participant

    ok 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-monde

    here’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>&Eacute;venement : <?php the_field('evenement'); ?></p>
            <p>Type de d&eacute;fi : <?php the_field('type_de_defi'); ?></p>
            <p>Donjon : <?php the_field('donjon'); ?></p>
            <p>&Eacute;preuve : <?php the_field('epreuve'); ?></p>
            <p>Difficult&eacute; : <?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).

    #1394042
    Rad
    Moderator

    Hi 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!

    #1394290
    Lyser
    Participant

    1) 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 ?)

    #1394748
    Rad
    Moderator

    Hi 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>&Eacute;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.

    #1394981
    Lyser
    Participant

    Perfect, thx a lot 🙂

    #1395127
    Christian
    Moderator

    You’re welcome.

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