Tagged: x
-
AuthorPosts
-
March 4, 2017 at 9:12 am #1394431
LyserParticipantHello,
I would like to know how to do (if it’s possible to do that with ACF) :Having a field in frontend that user could fill themselves with their names and having their names displayed on the same page after.
(It would be for a inscription page for a event)
March 5, 2017 at 12:32 am #1394812
RadModeratorHi there,
Thanks for posting in.
Same as you did on your other thread, you’ll have to edit the main template. Example, the wp-index.php if it’s blog page, and content-page.php if it’s a page.
Then follow this https://www.advancedcustomfields.com/resources/create-a-front-end-form/
And then, you’ll have to wrap your code within is_front_page() condition to make sure it’s displayed in home page only, those templates can be used anywhere. Example:
<?php if( is_front_page() ) :?> <?php acf_form_head(); ?> ..... <?php acf_form(); ?> ..... <?php endif; ?>Hope this helps.
March 5, 2017 at 9:54 am #1395128
LyserParticipantOk thx, i don’t know why all the fields are now displayed in front page, and i should have precised something : There will be a max number of people who can register for a event, that number is precised by the “places” field and each time a player enter his name, (Each names are displayed next to others) that number must decrease by one. When number 0 is reached, the entering name field should deasepear.
1) How to create a link between the decreasing by 1 place field and the entering name field (And make it no display when 0 is reached) ?
2) You can see that all fields are now displayed, only the entering name should be displayed in frontend, not the others who should be visible only in backoffice for admin.
3) Is it possible to automatically add a different type of featured image in relation to what is chosen in the destination select field ? (it’s for making the things easier for the future admin instead choosing each time the right featured image among enormously), could this work for catégory too ?
the result : http://www.lyser.fr/testwp/
my buggy code :
<?php // ============================================================================= // VIEWS/INTEGRITY/CONTENT.PHP // ----------------------------------------------------------------------------- // Standard post output for Integrity. // ============================================================================= ?> <?php acf_form_head(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-featured"> <?php x_featured_image(); ?> </div> <div class="entry-wrap"> <?php x_get_view( 'integrity', '_content', 'post-header' ); ?> <br/> <?php // ============================================================================= // Code for fields in backoffice ?> <?php $evenement = get_field( 'evenement' ); ?> <span style="color:#edeeb5; font-weight:700">Évenement :</span> <?php echo $evenement; ?><br/> <?php if ($evenement=='PVP') :?> <span style="color:#edeeb5; font-weight:700">Date et heure :</span> <?php the_field('date_et_heure'); ?><br/> <span style="color:#edeeb5; font-weight:700">Places disponibles :</span> <?php the_field('places'); ?><br/> <?php endif;?> <?php if ($evenement=='PVE') :?> <span style="color:#edeeb5; font-weight:700">Destination :</span> <?php the_field('destination'); ?><br/> <span style="color:#edeeb5; font-weight:700">Date et heure :</span> <?php the_field('date_et_heure'); ?><br/> <span style="color:#edeeb5; font-weight:700">Places disponibles :</span> <?php the_field('places'); ?><br/> <?php endif;?> <?php // Code for fields in backoffice END // =============================================================================?> <?php // ============================================================================= // Code for name field dispalyed in frontend ?> <?php if( is_front_page() ) :?> <?php acf_form_head(); ?> <p>Noms des participants :</span> <?php the_field('nom'); ?></p> <?php acf_form(); ?> <?php endif; ?> <?php // Code for name field dispalyed in frontend END // =============================================================================?> <?php x_get_view( 'global', '_content' ); ?> </div> <?php x_get_view( 'integrity', '_content', 'post-footer' ); ?> </article>March 5, 2017 at 9:55 am #1395129
LyserParticipantThis reply has been marked as private.March 5, 2017 at 8:57 pm #1395619
RadModeratorHi there,
1. I’m not sure if I understand it correctly, would you mind providing mote details 🙂
2. Maybe it’s not possible through name? ACF is for custom fields and each custom field is attached to POST ID. Perhaps what you need is really the actual form submission. It will only display and update the post meta of current post (custom fields). Updating it will overwrite the previous data since it doesn’t add like new entry. How about event plugin?
3. It’s not possible, just like custom field, everything on that post is attached to POST ID which is unique.
Thanks!
March 6, 2017 at 5:33 pm #1396923
LyserParticipantOkay perhaps ACF is not the right addon for what i need, thx for you help anyway.
March 7, 2017 at 1:31 am #1397315
Paul RModeratorYou’re welcome! 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1394431 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
