Hey @kru-x
I would look into https://www.advancedcustomfields.com/resources/acf-load_field/. Just print_r($field); exit;
in your function, and that’ll show you all the data that’s in the object.
You should be able to use wp_get_current_user()
to get the current User’s id (https://codex.wordpress.org/wp_get_current_user)
Let me know if that helps (i haven’t tested this, just trying to give you a start).
Phil
does this help: https://support.advancedcustomfields.com/forums/topic/order-by-subfield-values/
seems like you can do subnested orderbys now: https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/
(i didn’t know about this until now – very exciting!)
Phil
Hi @dotcircle
I would add some hot JS action onto the link. When the user clicks that link, you could use wp AJAX api (https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_(action)) to fire off an email to your client.
This isn’t really an ACF specific question – so if you have any further questions, I would try asking it on a WordPress forum. You may get better/faster help!
Phil
You should be able to find what you need here: https://www.advancedcustomfields.com/resources/#filters
You could even get fancy and only show the last four digits in the admin field: https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/
Here’s an example on Hashing/Unhashing: https://andrewho.nl/encrypt-decrypt-strings-php-easy-way/
Phil
@macreixa what does your WP_Query
look like?
Hi @arctica112
I’m not fully understanding what you’re after – and this forum is really for this sort of topic (this is more of a general PHP question) BUT I think you just need to do something like this:
$amount = count(get_sub_field('table_forms')
this will give you the total number of items in your repeater. Then you can check that number to determine how many columns you’ll be needing.
Phil
Hi @kru-x
you should be able to achieve that with one of these filters: https://www.advancedcustomfields.com/resources/#filters
Phil
@vanduzled you can use this function to get the object: https://www.advancedcustomfields.com/resources/get_field_object/ That should contain the text you seek.
Hi @precies
You can try this function to filter out the output: https://www.advancedcustomfields.com/resources/acf-render_field/
This will allow you to replace the youtube.com string with the youtube-nocookie.com string. If you haven’t done that before, just look up “string replace php”
Phil
@dotwongdotcom perfect, then you just need to detect if both months are the same, or if they’re different.
You can find out how to turn a date value into a PHP Date object here: https://www.advancedcustomfields.com/resources/date-picker/
Use that to wire up your logic to figure out if the months are the same or different.
Phil
hi @louiswalch
I’m afraid i would need a lot more data to help test this, but I would recommend installing a fresh copy of WP locally and copying these fields over one by one to see if you’re still having the issue.
Here is a helpful resource that ACF provides for debugging: https://www.advancedcustomfields.com/resources/debug/
Phil
hi @signelazer
If you’re setting it on a custom post type, you’ll need to use this function wp_set_object_terms
instead. https://wordpress.stackexchange.com/questions/114576/wp-set-post-terms-not-work
Also, term_exists
sends back the ID, so you don’t need to do $term_id->term_id
, just $term_id
would work as found here: https://codex.wordpress.org/Function_Reference/term_exists
I found this by searching “wp_set_post_terms not working” and it was in the top 3 links (at least for my results). When trying to debug a situation, try searching for what’s wrong and you’ll find that usually a lot of other people have struggled with the same issue.
Here’s some a resource (provided by ACF) for debugging: https://www.advancedcustomfields.com/resources/debug/
Let us know if this helps or if the problem persists!
Phil
Hi @ricky709
Can you show us how you have the ACF fields set up, and how you’re pulling the info in your template?
If you haven’t, I would recommend reading over the get_field
documentation here – especially the part about pulling data for a term:
info about taxonmies => https://www.advancedcustomfields.com/resources/taxonomy/
help with debugging => https://www.advancedcustomfields.com/resources/debug/
search for other articles => https://www.advancedcustomfields.com/resources/
Phil
Hi @herrfischer
You would just need to set up different args
for each map.
I think this will help you get started: https://stackoverflow.com/questions/4074520/how-to-display-multiple-google-maps-per-page-with-api-v3
You could def. do this with ACF & WP, but I would think you would be better to use a third party system that specializes in this. Something like Intercom would probably suite you better.
You could tap into the API https://www.intercom.com/api if you need to sync with your WP install.
Phil
@simonpointer try setting WP_DEBUG
to 1
or true
in your wp-config.php file. That will show you where errors are happening.
Just from a quick look, towards the end of your code you have a }
right before your endwhile;
. If you look above, you have foreach():
, so either change that to foreach(){
or change that }
to endforeach
. I hope this helps.
Phil
@mysticalghoul is this an ACF specific question? It seems like this is more of a WordPress question. I would try asking it here: https://wordpress.stackexchange.com/
i think the have_rows('services_managers', $term_id)
doesn’t seem correct. try passing the whole $term
object and see if that fixes it. if not, then just don’t setup the post data.
if you alread have the $post object, then you ahve the title $post->post_title
and the id $post->ID
.
https://codex.wordpress.org/Class_Reference/WP_Post
i thought it needed a $post_id
, but you’re fetching fields from a term not a post. You can find your solution here: https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
Basically you’re not passing the proper value to the second parameter.
you would need to put that code in the on ready event. your JS probably doesn’t know about those elements yet, so it can’t bind on to anything.
You can filter those out this way: https://www.advancedcustomfields.com/resources/acf-fields-taxonomy-wp_list_categories/
So the next thing to do is to listen for a change on the checkbox and then show the div you just hid. Then you’ll either need to fetch the children of those selected, or, if possible, hide the checkboxes.
If there’s a way to customize the HTML that ACF spits out on that form, then you could add a class or data attribute with the id of its parent (this is on the County stuff).
I don’t see a filter for adjusting that HTML, but you could try formatting it via this: https://www.advancedcustomfields.com/resources/acf-render_field/
Basically you’d hijack the HTML it outputs with your own.
hey @mische7 i’m sorry I missed your message yesterday – you may need to listen into the ACF JS hook found here: https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/
`
acf.add_action(‘ready’, function( $el ){
// $el will be equivalent to $(‘body’)
});
`
I would imagine that the ACF Form fires some JS to prep any special fields.
Phil
Hi @miked89
Just a hunch, but it could be that when you set up the new post data, it overrides the $id of the $post_object = get_sub_field('service_manager_name');
. I would store your $post_id as a variable before your while loop and then use that to set the get_sub_field('service_manager_name', $post_id)
Phil
It always is 😐
Anytime!
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.