Not sure what the function parameter is supposed to do but in your link it should probably read echo(getitinarylink());
, i. e. you want to echo the returned result of the function call. You might not even need the $the_link
parameter in your function declaration, you only need it if you want to pass something to the function.
Wow, something in your post broke the forum layout. š®
What about the $product_id variable? Is that necessary? If so then itās probably also necessary on the sub fields. What happens if you do the_sub_field(āprijsā,$product_id);
PHP is parsed on the server; what is sent back to the browser is plain text/HTML, so you canāt inspect PHP with your browser.
Your code looks correct on first sight. What happens if you do <?php print_r($hero); ?>
after the get_field line? Does anything come up?
I have no experience with BeaverBuilder and ACF shortcodes but it sounds like you donāt want a repeater field in the first place. A repeater is for adding multiple items to a single post. It sounds like you want just one testimonial with each post, so you just need a regular text field associated with the post type.
Perhaps the guide on querying posts by custom fields is of help?
Itās not very clear what the whole set-up is. So, you have a custom post type and a custom field called āangebot_1ā is shown for all posts of this post type? Or do you have 18 custom fields where each custom field is shown in one of the 18 custom post entries? This sounds overly complicated.
Please enlighten me/us.
Check out the documentation for get_field()
, specifically the section titled āGet a value from different objectsā. You should be able to get the value from a field assigned to a category by passing the category ID as second parameter:
$color = get_field( 'my_field', $category[0]->cat_id );
ā¦
echo($color);
Perhaps update_field()
will be something for you?
You need to make the fields empty and save the page first before removing the fields completely, otherwise there will still be something in the database that triggers the have_rows
condition.
Please show some code and possibly an image of your field set-up.
Is the value saved properly? What does print_r(get_field('website'));
return?
You canāt put PHP inside a JS file unless the JS file itself is parsed as PHP, which it isnāt. The easiest way would probably be to add the JS with PHP inline to the document header, possibly using the wp_head action hook (Iām not very experienced with action hooks, thatās just what I would assume is approrpiate).
This has nothing to do with ACF, wp_nav_menu()
is a native WP function, and according to the documentation, menu_id
must be a string; however, an ID cannot have multiple comma separated values.
Likewise, container
must be a string consisting of the (single) element name with which you want to wrap the whole menu. What you have there doesnāt make any sense.
And also likewise menu_class
must be a string that contains class names as they would be put in the HTML, i. e. space separated, not comma separated. And these class names would be put on the <ul>
that forms the menu list, as explained in the documentation, not on any single list item or whatever else is inside.
What exactly are you trying to do?
I have no experience with TablePress but the image looks like you are adding a table within the Gutenberg editor. You canāt put plain PHP into the editor. What you need is a repeater field with the respective fields in each row, and then you would construct a table from the output.
It sounds like you would actually want a custom post type for that. Is there anything that would speak against that?
Am I missing something?
Yes, the options page option. š
What is the HTML output? Sounds more like something that should be done with HTML/CSS rather than PHP/content.
Sounds like you need a post object or relationship field and retrieve the value from the returned array/object? We would probably need more context.
We need more info. What does your field setup and template code look like?
Please donāt cross-post, youāre just wasting the time of people and clutter the forum. Iāve posted an answer at https://support.advancedcustomfields.com/forums/topic/how-to-get-taxonomies-loop-in-single-post/
This isnāt an issue that can be discussed here because itās a third-party plugin. You should raise the question on the pluginās support page.
That said, the field is still working alright for me, so the error must be somewhere else. Perhaps some corrupted files after an upgrade? Try re-uploading/reinstalling and see what happens. Also, look whether the error console says anything.
Oh, and I also support the feature request for a native OSM field. š
If you want to retrieve the terms for the current post you probably want get_the_terms()
(inside the post loop) rather than get_terms()
.
Sounds like the image field isnāt empty then. What is output if you do var_dump($view_on_wall)
or print_r($view_on_wall)
?
According to the documentation, looping over a group field is similar to looping over a repeater field, so it should also be possible to use a foreach loop, as explained at https://www.advancedcustomfields.com/resources/repeater/
This: $filament->term_id;
doesnāt seem to make any sense. There is no $filament
variable (you probably mean filament_checked_values
?) and before you can get a term ID you need to get the terms associated with a post.
But other than that, if your $filament_checked_values
contains an array or object, you should get a dropdown list alright.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.