I suggest adding the title via PHP and then hiding it with CSS and then when the div has class ‘selected-item’ display the title.
<div class='slider-item'>
<?php the_sub_field('image'); ?>
<?php if(get_sub_field('title')){ ?>
<div class='title'><?php the_sub_field('title'); ?></div>
<?php } ?>
</div>
Than in the css you can have
.slider-item .title{display:none;}
.item-selected .title{display:block;}
Or something along those lines. Hope this helps.
Do you want to select all posts with the selected date from the form?
If so you can use something like this:
https://support.advancedcustomfields.com/forums/topic/order-by-subfield-values/
You can rework it for a meta_query like this:
'meta_query' => array(
array(
'key' => 'other_information_%_date',
'compare' => 'LIKE',
'value' => $rep_date,
'type' => 'DATE' //May not be necessary
)
Hope that helps, or if you got another solution I would love to see it 😀
Hi Rafaromo,
You could use this
$args = array (
'post_type' => 'YourPostType',
'meta_query' => array(
array(
'key' => 'start_date',
'compare' => '=',
'value' => $TheDateYouAreLookingFor,
)
),
);
// get posts
$posts = get_posts($args);
I got this from the ACF guide: https://www.advancedcustomfields.com/resources/date-picker/
The can also be used with the regular WP Query. The date you are looking for needs to be in the same format as the custom field date that is saved to the database.
Hope this helps,
Neasa
Hi John,
Cheers for the help, I didn’t realise acf have a form. I solved it another way, by using ajax.
<?php
// This allows our page to have wordpress knowledge
define('WP_USE_THEMES', false);
require_once('../../../wp-load.php');
$userid = $_REQUEST['userid'];
$email = $_REQUEST['email'];
$username = $_REQUEST['username'];
$pageid = $_REQUEST['pageid'];
$attendFB = $_REQUEST['attendFB'];
$update_field = new WP_Query('showposts=1&post_type=tribe_events&orderby=date&order=ASC&p='.$pageid );
while ($update_field->have_posts()) : $update_field->the_post();
the_title();
//get attending rows
if( have_rows('attending') ){
$gallery = get_field( 'attending' );
} else {
$gallery = array();
}
// add to existing array
$gallery[] = array(
'user_id' => $userid,
'name' => $username,
'email' => $email
);
// save new array
update_field("field_identifier", $gallery, get_the_ID());
endwhile; wp_reset_query();
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.