There has historically been a scaling issue when it comes to many of the relationship type fields. ACF is working within what is provided by WP. The taxonomy filter on the relationship field must get all of the taxonomies and then all of the terms in each taxonomy in order to sort them for the filter. This is also effected by the post types that can be filtered or the post type setting when filtering. This can be improved by limiting the post types and the taxonomies that appear in the filter. With a taxonomy with many terms in it has been reported that the request time out and showing no results. It may be necessary to limit the post types and not allow filtering by taxonomy on extremely large sites.
For more on this you should probably contact the developer here https://www.advancedcustomfields.com/contact/
You can have multiple load points.
You can only have one save point, although it is possible to manipulate the save point during the saving of specific field groups using a combination of filters ‘acf/update_field_group’ and ‘acf/settings/save_json’
ACF loads JSON versions of field groups first. It then loads field groups from the DB for any field groups that do not have a JSON file based on group key.
The only reason that fields registered in PHP would not override JSON is if the group key of your group added in PHP matches an already existing group key. Group keys and field keys in php loaded groups must be unique and not match group keys or field keys that exist in other field groups.
You may not be able to. A checkbox field is stored as an array. You should direct your question to the developer of the plugin you’re using to display custom fields and how to deal with fields that are stored as arrays.
@rupsnn Thank טou but I do not want to embed a map with a particular location but to embed an entire map of a route prepared in Google. Their export looks like this:
<iframe src = "https://www.google.com/maps/d/embed?mid=1mpP1w_0CTOvPKQOGZT5oVQSRBJPbsex9" width = "640" height = "480"> </iframe>
All of your issues look to me like there is a php error during AJAX requests that is causing the request to fail “The response is not a valid JSON response.” The first step is to turn on debugging and error logging, check your error log and clear up any php errors and warnings if there are any.
This is the code embedded in the page:
[acf_repeater field="file_listcovid2" sub_fields="thumbnail,description,file_upload,file_type"]
<table style="width:100%">
<tr>
<th>Thumbnail</th>
<th>Description</th>
<th>Download Link</th>
<th>File type</th>
</tr>
<tr>
<td><img src="%thumbnail%"/></td>
<td>%description%</td>
<td>
<a href="%file_upload%">Download file</a>
</td>
<td>%file_type%</td>
</tr>
</table>
[/acf_repeater]
It should put out a table that has a thumbnail and a download link like the attached image, but instead it will put out a table that has no working thumbnail repeater field. When you check the source code in the Chrome Inspector while looking at the messed up field, it shows the beginning of the output is “img src= unknown” which tells me it cannot properly get the link to the image for some reason. When I check the console for the working, correct code that is on the dev site currently, it shows this:
<img src="https://this-is-redacted.com/wp-content/uploads/2020/07/Covid-list-thumb.jpg">
Another odd thing is that on non-working pages with multiple tables using repeater fields setup via an Options page, all of the fields with thumbnails will say “img src= “unknown” and then the Download File link will share the same PDF- for all the tables on the page. Something programmatic seems to be off, but it’s very hard to track it down.
I also wanted to throw in- this works on a dev site we made it on, but failed to work upon putting the site in Multisite. We did make sure only the plugins and themes used by the dev were enabled, and verified all other site functionality and other ACF Pro functionality works. All other ACF and Options Page functions on other multisites work.
It’s not specifically for generatepress; this is the code:
function my_acf_repeater($atts, $content='') {
extract(shortcode_atts(array(
"field" => null,
"sub_fields" => null,
"post_id" => null
), $atts));
if (empty($field) || empty($sub_fields)) {
// silently fail? is that the best option? idk
return "";
}
$sub_fields = explode(",", $sub_fields);
$_finalContent = '';
if( have_rows($field, option) ):
while ( have_rows($field, option) ) : the_row();
$_tmp = $content;
foreach ($sub_fields as $sub) {
$subValue = get_sub_field(trim($sub));
$_tmp = str_replace("%$sub%", $subValue, $_tmp);
}
$_finalContent .= do_shortcode( $_tmp );
endwhile;
else :
$_finalContent = "<center><h2>There is nothing to see here right now!</h2><br><p>Please check back soon</p></center>";
endif;
return $_finalContent;
}
add_shortcode("acf_repeater", "my_acf_repeater");
thank you for accepting me in your prestigious forum . it is a delight for me to be there with you and i shall be able to find myself with diverse news about the topic that are raising in this forum .
i wanted to describe myself, my friend is mike , i have been publishing all the items debated in the forum for a great life . i had not had the opportunities to creating an identity , but due to the interesting history you display online , i decide to do do and post an invited to be received by you .
for me it has been a real enriching experience to be in this forum , it has provided me the chance to have small discussions with peers who are additionally interested in this kind of topic . it has given opens the gates for me to hear different ideas and opinion .
i will further be happy to supply you with all the necessary material in the forum , such that you could have a report and there is a net , and that both you and i can use all the topics that may be share .
i have been very attentive to this forum , that is so , yet again i give you what grateful i am for had accepted my request to the forum . i shall leave you my profile address and some pages there i met interesting news .
i am a person who pays to researcher and reading about this topic , besides it is important for me to share this knowledge with members and families . i miss the welcome that they giving to new member to the forum .
i hope more boards like this will be creation , so that everyone has accessibility to this important information . i have therefore created the area available to other people such that they may create an account and be accepted in this forum .
i say goodbye , be placing the need to shares any data about this forum , i wil be constantly active to be continually update . twice , it is a pleasure to be part of this forum , see you later !
Dear Colleagues,
I came across the neccessity of the same feature.
I’ve Property CPT which has a repeater field Proximity2Metro. Inside that repeater are subfields Minutes and Station. Minutes field contains how much minutes does it take to get to/from the corresponding metro station to/from the property.
Let’s say I’ve the following
property 1:
station1 – 3 minutes
station2 – 5 minutes
property 2:
station3 – 4 minutes
station4 – 6 minutes
Then I need to filter properties by the minimum number of minutes. For example, I need all the properties with no more than 3 minutes from metro.
For now I have to add filtering inside while-have-posts loop, which is not very efficient. It should be accomplished via wp_query args.
Figured I’d add something to help people out who want to add a row to a flexible content field that’s inside of another flexible content field.
acf.addAction( 'append', function( $el ) {
if ( $( $el ).hasClass( 'layout' ) && $( $el ).is( '[data-layout="level1_layout_name_here"]' ) ) {
var nestedFlexField = acf.getField( $( '.acf-field[data-name="NESTED_FLEX_FIELD_NAME"]', $el ) );
nestedFlexField.add( {
layout: 'level2_layout_name_here'
} );
}
} );
Hi,
i did it with jquery:
$(document).ajaxComplete(function() {
$('.acf-notice p').each(function() {
var text = $(this).text();
$(this).text(text.replace('OLD ERROR MESSAGE', 'NEW ERROR MESAGE'));
});
});
For example in your jquery-js with:
$(document).ajaxComplete(function() {
$('.acf-notice p').each(function() {
var text = $(this).text();
$(this).text(text.replace('Wert ist erforderlich = OLD MESSAGE', 'Bitte ausfüllen = NEW MESSAGE'));
});
});
I made this filter:
<?php
$args = [
'post_type' => 'project',
'post_status' => 'publish',
];
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) { $loop->the_post();
$video = get_field('embed_1', get_the_ID());
print $video;
}
wp_reset_postdata();
?>
But now I would like to be able to add other custom fields like embed_1, embed_2 and embed_3 to this.
How can I do it?
Hey, did you ever get an answer on this? I’m trying to forced text input fields to 100% width in the admin with a media query, and nothing I’m doing will work.
You can wrap the entire inner function in an if statement to avoid running any code if the field value is not empty.
if ( empty( $value ) ) :
// contents of {yl_create_unique_id_acf_field} function.
endif;
Now
charecter field
not display how to fix it.
Thank you.
<?php if( have_rows('cast') ):
$tax = 'celebrity_cat';
$types = get_terms( array(
'order' => 'des',
)
);
foreach($types as $type) {
$term_link = get_term_link( $type );
$person_name = get_field('celebrity_name');
$image = get_field('celebrity_avatar', 'celebrity_cat_' . $type->term_id . '' );
$charecter = get_field('charecter');
if ( has_term( $type->term_id, 'celebrity_cat')) {
?>
<div class="slider">
<article id="post-<?php the_ID(); ?>" <?php post_class('content-item -card'); ?>>
<?php
echo '<div class="pic">';
echo '<a href="' . esc_url( $term_link ) . '">';
echo '<img width="350" height="184" src="' . $image['url'] . '" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" ';
echo '</a>';
echo '</div>';
echo '<div class="info">';
echo '<header class="entry-header">';
echo '<h3 class="entry-title">';
echo '<a href="' . esc_url( $term_link ) . '">';
echo '<span>'. $type->name . '</span>';
echo '</a>';
echo '</h3>';
?>
<?php echo $celebrity_name; ?>
<?php
echo '</header">';
echo '</div>';
//break;
?>
</article>
</div>
<?php } } ?>
<?php endif; ?>
Muchas gracias por tu trabajo.
Ha el problema ha quedado resuelto.
Ya convenci al admin para que utilize categorias diferentes en cada subasta.
Aunque estas categorias tengan el mismo nombre, si cambiamos el slug funcionara correctamente.
Ya que despues de todo el trabajo que me continuaba mostrando categorias que tenian post de otras subastas. Eso se produce, supongo, por que la funcion get_terms me trae todos los terminos que no estan vacios, sin considerar a que subasta pertenecen.
SALUDOS y muchas gracias por tu trabajo.
Do all of these post types have a unique ACF field name (meta_key) that exists for these post types but does not exist for the other post types that you do not want to show?
if the answer is yes
$args = array(
'post_type' => 'any',
'meta_query' =>
array(
'key' => 'field_name',
'compare' => 'EXISTS'
)
)
);
$my_query = new WP_Query($args);
$products = get_field('products_in_this_auction', false false);
$categories = get_terms('type_produc', 'orderby=count&order=DESC&hide_empty=1');
foreach( $categories as $category ):
?>
<h3 class="title_pru"><?php echo $category->name; // Prints the cat/taxonomy group title ?></h3>
<?php
$posts = get_posts(array(
'post__in' => $products,
'post_type' => 'myproduct',
'taxonomy' => $category->taxonomy,
'term' => $category->slug,
'nopaging' => true,
));
foreach($posts as $post):
setup_postdata($post);
?>
<div id="post-<?php the_ID(); ?>">
<?php the_title( sprintf( '<p class="title_pru"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></p>' ); ?>
</div><!-- #post-## -->
<?php endforeach; ?>
<?php endforeach; ?>
Nevermind found a fix myself 🙂
I think the main reason was related to the fact that the “return format” was set to “Image URL” instead of “Image Array”.
After I changed that in my WordPress backend I now use the following code in my template and it gives me the alt tag and title tag of the image:
<?php
$image = get_sub_field('inside_the_customer_imgs');
printf( '<img src="%s" alt="%s" title="%s" />', $image['url'], $image['alt'], $image['title'] );
?>
Hi,
Thank you very much for your help.
I have been able to solve a large part of the problem.
Thank you very much for responding so promptly.
The only problem with this solution is that WordPress shows me Taxonomies that have posts from other auctions.
While WordPress does not show empty taxonomies thanks to the ‘hide_empty’ rule hide_empty => true
, it does show taxonomies that have a custom post type but belong to another auction.
Do you have any idea what I should change in the code below so that it only shows the taxonomies that are associated with the products of this auction?
Greetings and thank you very much for your help.
My code:
$products = get_field('products_in_this_auction', false, false);
$categories = get_terms( 'type_produc', array(
'orderby' => 'count',
'order'=>'DESC',
'hide_empty' => true
) );
foreach( $categories as $category ):
?>
<h3 class="title_pru"><?php echo $category->name; ?></h3>
<?php
$query = get_posts(array(
'post__in' => $products,
'post_type' => 'myproduct',
'taxonomy' => $category->taxonomy,
'term' => $category->slug,
'nopaging' => true,
));
foreach($query as $post):
setup_postdata($post);
?>
<div id="post-<?php the_ID(); ?>">
<?php the_title( sprintf( '<p class="title_pru"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></p>' ); ?>
</div><!-- #post-## -->
<?php endforeach; ?>
<?php endforeach; ?>
I don’t know why the image are not posted
reupload > https://ibb.co/cQr4k2P
I tried the function you created @jonathan, this is how I used to display the image:
<img src="<?php the_sub_field('inside_the_customer_imgs'); ?>">
This is you function, to which I also added the title field:
function get_image_with_alt_and_title ($imagefield, $postID, $imagesize = 'full'){
$imageID = get_field($imagefield, $postID);
$image = wp_get_attachment_image_src( $imageID, $imagesize );
$alt_text = get_post_meta($imageID , '_wp_attachment_image_alt', true);
$title_text = get_the_title($imageID);
return '<img src="' . $image[0] . '" alt="' . $alt_text . '" title="' . $title_text . '" />';
}
And this is how I call the function in my template:
<?php echo get_image_with_alt_and_title('inside_the_customer_imgs', get_the_ID(), 'thumbnail'); ?>
but somehow when I run this on my page I get the following output:
<img src="" alt="" title="THE TITLE OF THE PAGE WHERE THE IMAGE IS ON">
If I change the get_field to get_sub_field in the function the output becomes completely empty:
<img src="" alt="" title="">
Any idea what I could be doing wrong here? I know it has been ages since this request originally came, but Google led me here 🙂
Did you find the solution for this?
I am trying a similar thing, I added color to every category and want to use those colors for numerous items (every category has unique color), but like in your case Elementor doesen’t display colors from the category.
I was dealing with the same problem recently and found out this was because of not loading WP ‘dashicons’ font in frontend. Is it supposed to load by default?
Anyway, you can try this:
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}
It would be nicer if acf would load such icons from it’s css as inline svg for example.
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.