@acf-support Did this get any further?
Super, thanks James!
I’ve managed to do a little further reading and found this (http://www.advancedcustomfields.com/resources/querying-relationship-fields/) which is close to what we need but it would be nice to rather manage this from the Option page instead of having a new Custom Post Type just for towns because there will be additional information elements we want to share across sections of the backend, not just towns.
@Hube2 thanks for the feedback. My apologies, I should have been a little more clear.
Is it possible to do this in the backend of ACFs? Essentially what we’re trying to build is a lookup field for multiple parts of the backed of WordPress when a user logs in. So what we have is this…
– User is created as a Dealer.
– Dealer’s town is selected from dropdown menu created from Options Page.
– Dealer is saved as new user.
– Dealer then has ability to load new secondhand products.
– Product is loaded and is able to select a dropdown of where that secondhand product is being sold .i.e. a different town populated from the Options Page.
When building out the Dealers Field Group, one of the fields is a dropdown menu. The value of these dropdown menus should not be set in the settings of the Field Group I am setting up but rather draw its values from the Options Page.
We will be doing this again in the SecondHand Field Group where that dropdown’s values need to be pulled from the Options page so that we do not have to duplicate this and it is only ever managed from one point, the Options Page.
Hope this makes sense?
Thank you.
Thanks Elliot.
If there is any way that the documentation part of the site were made a wiki, I would be happy to contribute examples and videos.
I did thanks Elliot.
It’d still great to see some more examples. I’ve tried finding some on YouTube but there aren’t that many examples.
Thanks Elliot, someone else helped me with some additional work so I was able to see how he used it for the problem I was having and see the massive potential of it. Just would love to see more examples.
Thanks again.
Managed to solve this like this:
<?php
$distributor = get_field('distributors'); ?>
<select>
<option value=""></option>
<?php foreach ($distributor as $key => $value) {
echo "<option name='' id=''>" . $distributor[$key] . "</option>";
} ?>
</select>
Good man, thanks so much Elliot. It helps when you use the right search terms. I would never have thought to use Archive as a “Search Engine” term when I normally google something like
http://site:advancedcustomfields.com search engine
Thanks for this much appreciate!
Solution if anyone is look for it, managed to figure it out.
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'is_featured_product',
)
)
);
?>
<?php $loop = new WP_Query( $args ); ?>
<div class="nav subnav">
<ul id="menu-top-ten-product-menu" class="menu">
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li>
<a href="<?php the_field('product_logo'); ?>">
<img src="<?php the_field('product_logo'); ?>" alt="">
</a>
</li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>
</div>
I misunderstood the post below and still in need of some help with this please.
Thanks guys. I managed to get a little further with this from this great article I found about dynamically populating select field’s choice in Advanced Custom Fields
Hi Elliot. Thanks for this.
I realise my next question is not related to this one but, let me take a step back and first ask, how do I generate the select html tag based on the ACF selection I have created?
Based on all my findings, I will document all the results in this post on How to create a search engine using Advanced Custom Fields in the hope that it might help someone else understand this.
Cheers
My goal here is to create a form that:
My logic would tell me that the first thing I need to do is create a front end form that will dynamically create a dropdown menu as well as an input field so this is where I begin.
How to create a front end form That documentation is how to create a form to “allow you to create a front end form to edit a page / post.”
Solution:
if(get_sub_field('company_name')) {
echo '<strong>Company name:</strong>';
echo '<p>' . the_sub_field('company_name') . '</p>';
}
Thanks Elliot.
Second time I run into a scenario where I need this so I will look into it now 😉
Cheers
Not just XML but CSV too please Elliot.
Thanks Elliot that works like a charm and I understand the logic behind it now.
Many thanks.
Can you mark yours as the answer instead of mine 😉
I’ve tried now to set each other sub fields to true and ran the code again but all of them return false which tells me something else must be wrong here?
Is there a reason you want to have people add posts from the front-end? Seems a little dangerous.
This plugin does what you want to do but also allows you to control what is published at the end of the day.
http://wordpress.org/plugins/frontend-uploader/
Finally managed to find the problem!
In the group the Return Value needs to be File URL rather than File Object which is the default setting under the File Field Type options.
Many thanks Elliot
Right, so what I have done is created a blank WP site. Added ACF, and in my theme page added <a href="<?php the_field('gallery_file'); ?>" >Download File</a>
where “gallery_file” is the name of the test field.
This has worked 100% as expected when a refreshed the page so now I am trying to figure out what I have done wrong with my other project.
Is it possible that by setting the “wp-content/uploads” to use a different folder by using define( 'UPLOADS', ''.'files' );
I have effectively changed all the paths on a permanent basis and if that is the case, how do I undo this so that it points back to “wp-content/uploads”
@elliot I have removed my comments about the images. Please delete them and yours if you feel it waters down the main topic. Thanks
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.