have you tried “term object” instad if “term ID” in the ACF field?
i had a problem once when the name was too long, maybe try something like “fdhder_img”. i don’t really think that helps but in one case something like this solved the problem for me.
or try
<?php echo get_field('featured_header_image'); ?>
or
<?php echo get_field('fdhder_img'); ?>
I think i have to do a user query like this:
– getting all users
– check if the user IDs are equal to an ID in the custom field entrys added to the page
– than drop the ones whos ID is not in
EDIT: this is the solution. So simple that I could not get it π
<?php
//get the users
$ids = get_field('personen_intern', false, false);
//include them in the query
$args = array(
'include' => $ids,
);
?>
thanks jonathan, i need the args for later … . something like:
$args = array (
'order' => 'ASC',
'orderby' => $sortit,
'meta_key' => 'hide_user',
'meta_value' => 'visible'
);
in my case it is line 1518 and yes, this works β awesome. would be really nice if this could be fixed in a future release! thanks a lot john you are awesome!
hello jonathan,
i found out i have to echo the title, it’s that easy *gg
<?php
$values = $user->user_faecher;
if (!empty($values)) {
foreach($values as $value) {
if($value != end($values)){
echo get_the_title( $value );
} else {
echo get_the_title( $value );
}
}
}
?>
thanks anyway for your effort!
okay, awesome that you found this out! a hack would really help me! and thanks for informing the developer, i hope this problem can be fixed.
hello,
here is a pastebin of the page template: http://pastebin.com/20BeMiVc
this page has a user_query and “user_faecher” is a ACF relationship field that lists all wordpress pages on the user pages. the user choses some pages and the title of the pages should appear in the query on each user listing.
field option:
user page:
frontend – the result are the IDs of the chosen fields, but i need the names (in this case “Biologie” + “Physik”):
when i use this code it’s the same result.
With this code the error is gone:
<?php
$values = $user->user_faecher;
if (!empty($values)) {
foreach($values as $value) {
if($value != end($values)){
echo $value;
} else {
echo $value;
}
}
}
?>
but i have still only the IDs … i need the names π .
“user_faecher” is the name of the ACF relationship field.
hello john,
the template is in the theme folder like
wp-content/themes/mytheme/page-fach.php
not in a subfolder, it’s on the same level as the functions.php. i am making this theme from scratch.
maybe “_wp_page_template” doesn’t work with newer version sof wordpress? other arguments like e.g. “page_id” are working.
ah yes you’re right i was just trying everything like a monkey. when i write “=” i get “(no title())”
I made it with a “Walker”
class Walker_ACF extends Walker_Page {
function start_el(&$output, $page, $depth, $args, $current_page) {
// get ACf field
$acfclass = get_field('nav_verlinken', $page->ID);
$output .= $indent . '<li class="' . $css_class . ' ' . $acfclass . "_verlinkt" . '"><a>ID) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
}
}
wanted to use “walker_nav_menu_start_el” but couldn’t get it running.
Thanks a lot john, now i will sleep better π
When i use your code i get an error. This is my code:
<?php if( have_rows('info_boxen_anlegen', 'option') ) :
// loop through the rows of data
while ( have_rows('info_boxen_anlegen', 'option') ) : the_row(); ?>
<?php if( get_row_layout() == 'normale_info_box' ): ?>
<?php the_sub_field("ib_normal_uberschrift"); ?>
<?php endif; endwhile; endif ?>
This shows all my info-boxes. But i only want to show (in this case) the one with the chosen page:
In short: I just want to show this info-box on the page “Γber uns”, nowhere else.
Thanks, i found the “acfsave_post” page, too but did not understand a thing. I will try to empty the tables on save, i don’t want to put ghost data in the DB …
I make it with a post-type query now, this works.
Hmmm, i have no search field i just want to show the users with the checked taxonomy field “bananas” on the page “bananas”. For this i show a taxonomy field (ACF) on every user page where the users see all categories listet. i have posts who are in the category “bananas” and i have a page with the title “bananas”. Andon this page i want to list all users who have checked the tyxonomy (category) “bananas” on their profile page.
Yes i want to search users with a specific value. get it to work with normal custom fields but not with the taxonomy field used on users pages.
Thanks! Any idea how to do the same with a USER query??
okay did it with “str_replace”, just forgot that i used it some months ago, too:
// display a sub field values
echo '<div role="tabpanel" class="tab-pane" id="'.str_replace(' ', '', get_sub_field("tab_titel")).'">'; the_sub_field('tab_inhalt');
echo '</div>';
here is a plugin for this:
https://github.com/reyhoun/acf-rgba-color
but i’ll use the PHP function like 61pixels mentioned rather than using a plugin.
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.