You can make your post type hierarchical or create ‘fake’ sub pages. Those are your options I guess.
After some testing, I think this will do the trick.
if ( isset( $_POST[ 'acf' ][ 'field_5a0de683a21cf' ] ) ) {
$tour_dates = get_field( 'sd_tour_schedule', $post_id );
if ( $tour_dates ) {
foreach ( $tour_dates as $key => $row ) {
$column_id[ $key ] = $row[ 'from' ];
}
array_multisort( $column_id, SORT_NUMERIC, $tour_dates );
$key = 0;
foreach ( $tour_dates as $key => $tour_info ) {
if ( is_array( $tour_info ) && count( $tour_info ) > 0 ) {
foreach( $tour_info as $column => $value ) {
if ( 'city' != $column ) {
$value = date( 'Ymd', (int) $value );
}
update_post_meta( $post_id, 'sd_tour_schedule_' . $key . '_' . $column, $value );
}
}
$key++;
}
}
}
I’m not experiencing this on 5.6.9
This is my meta query.
$query->set( 'meta_query', array(
'tour_clause' => array(
'key' => 'sd_tour_schedule_%_until',
'value' => date( 'Ymd' ),
'compare' => '>'
),
'move_up_clause' => array(
'key' => 'sd_move_item_up_timestamp',
'compare' => 'EXISTS'
),
));
$query->set( 'orderby', array( 'tour_clause' => 'ASC', 'move_up_clause' => 'DESC' ) );
And the filter which is called.
function sd_tour_city_filter( $where ) {
global $wpdb;
$where = str_replace(
"meta_key = 'sd_tour_schedule_%",
"meta_key LIKE 'sd_tour_schedule_%",
$wpdb->remove_placeholder_escape( $where )
);
return $where;
}
It returns the output but sorts by the row numbers/index. Hence why the order needs to be correct in the back-end and that’s why the order has to be ‘re-stored’ after saving a post. I disabled the ordering of repeaters on the front-end so users can’t change this. I don’t want them to think about this.
Anyone ?
Yes it will work in the back-end. Please check the links. It has all the info.
Glad to hear. Can you mark the topic here (and on SO 🙂 ) as resolved then ?
As I mentioned on SO, I made an error in the code above. It should not be get_permalink, but get_term_link.
According to your code $term_link is set outside of the example and after that not changed anymore, so it makes sense it stays the same.
If the site disappears, you made an error somewhere. It’s better to find the error than to redo everything.
I want to help you but your English is not optimal so it’s hard to understand at some points.
If you have a field for taxonomy, it returns should return either an object or a taxonomy id. So if you echo $row[‘term_link’] it will not be a link, but an object or an ID.
So instead of $row[‘term_link’] it should be get_permalink($row[‘term’]) (to create a link out of the returned value).
“I left without filling the taxonomy, of course nothing will appear, but the content with the images of the gallery appears normally.”
If you leave out the taxonomy selector, the rest should still show since they’re not depending on each other (as far as I can see in your code).
I think it would be a lot easier if I could look at (all) your code. If you’re online, contact me through my website, maybe I can help you out. Might go faster than this.
I understand that the link of the first actor appears for all. That sounds to me like the link/value is set outside the foreach and doesn’t get changed anymore.
If I understand the problem correctly, your links are not generated correctly.
I don’t see anything in your code that defines $term_link. This needs to be ‘defined’ for each single row so where you have $term_link, I think it should have something like get_term_link( $term_id|object ).
I am sorry…. but I (still) don’t understand your problem.
I’m sorry, but your problem is not really clear to me. Can you explain a bit more ?
General note: If you change the theme, your templates (file) names might also change. If you assigned an ACF group to a page template, the group won’t show anymore but any previously stored values remain stored and if the front-end doesn’t change they will still be shown.
If I understand it correctly, only the link in the first item is correct ?
By the looks of it, the first instance in the loop gets the value from $term_link. Every item after it copies the link from the first instance, since it’s not ‘overridden’.
I don’t know how your repeater is setup, but instead of $term_link I expect you would either use something like $row[‘term_link’] since it’s part of the repeater.
Sorry that I can’t bring you a ‘definitive solution’.
Medium is a WordPress default size.
The fallback is indeed the full size, if the appropriate file does not exist/is not available.
But there might be (not sure) ACF filters in play which can manipulate this.
Did you get it to work ?
You could use a repeater for this.
I think you should look into your filters/plugins because I just checked a post with a gallery on my site and it does NOT show the full image with me.
It does show the medium size images, shown as a resized image (max 148 high).
Maybe post templates is also a good idea to look into.
I didn’t know this myself until a few days ago….
All the code you need is there.
If deinstalling the pixel plugin works, you should look into the code of the plugin 😉
If dropdowns are not showing I would look into javascript errors in your console because it sounds like jquery or so being blocked/not loaded.
KISS = Keep It Stupid Simple
That’s the way I would go 🙂
Why would you store the post id and the archived id ? Don’t you only need to filter which offers need to be excluded ?
I don’t see that (the user meta becoming big) as a problem right now. It’s just an array of ids.
A button is also an option. The function will almost be the same then.
You could maybe also store the info in a transient but I’m not sure if transients are meant to be used for this, although technically I don’t see a limitation.
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.