I determined it is some sort of theme error. I disabled the theme and ACF works fine. I am getting this error message when I attempt to add a new field:
Uncaught TypeError: Cannot read property 'outerHTML' of undefinedinput.min.js:1 $.fn.outerHTMLfield-group.min.js:1 acf.field_group.update_field_metafield-group.min.js:1 acf.field_group.wipe_fieldfield-group.min.js:1 acf.field_group.add_fieldfield-group.min.js:1 (anonymous function)jquery.min.js:3 m.event.dispatchjquery.min.js:3 r.handle
Also, I have the same theme running locally and ACF still works there. Has anyone ever seen something like this? Have any debugging tips?
Borrachuzo!
http://blogs.rediff.com/videosxxxgratis/
http://pg.webring.com/members/blog/xxxanuncios/
http://videosxxx.kinja.com/
http://videosxxx.kinja.com/claudia-mi-caliente-madurita-1682495838
http://videosxxx.kinja.com/cepillando-a-mi-profe-1682495591
http://videosxxx.kinja.com/lo-que-paso-en-mi-oficina-1682495368
http://blogs.siliconindia.com/xxxvideos/
http://trampoo.roon.io/
Hi @nicmare,
This is something you can hack using the acf/fields/relationship/query
filter. This filter will allow you to modify the $args array used to query the posts. For instance, should you want to query only posts which have featured image set, then you could use the following code:
add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);
function my_relationship_query( $args, $field, $post ){
$args['meta_query'] = array(
'key' => '_thumbnail_id',
'compare' => 'EXISTS'
);
return $args;
}
For more info on this, have a look at
Hi @nicmare,
Have you tried using the acf/fields/relationship/result
filter to add the link to the post on the text that displays for each post.
The code is simple, it should be as follows:
add_filter('acf/fields/relationship/result', 'my_relationship_result', 10, 4);
function my_relationship_result( $result, $object, $field, $post ) {
$link = '<a href="'.get_permalink($object->ID).'"">Link text</a>';
$result = $result . ' ' . $link;
return $result;
}
Have a look at acf/fields/relationship/query for more information.
Are you using the update_field()
function to set the value when you populate the custom fields during import?
If so, are you using the field_key
value such as:
$field_key = "field_5039a99716d1d";
$value = "some new string";
update_field( $field_key, $value );
Full docs: http://www.advancedcustomfields.com/resources/update_field/#finding-the%20field%20key
Any news to this? I still have to use the last version of ACF 4 for all installs that are using (m)qtranslate. Maybe it has something to do with the newly introduced “Visual/Text” tabs that I saw you mention somewhere?
For anyone with the same issue I managed to get this working by altering my code as below:
<?php
$images = get_field('images_test_field');
if( $images ): ?>
<ul>
<?php foreach( $images as $image ): ?>
<?php $photographer_name = get_field('photographer_name', $image['id']); ?>
<li>
<a href="<?php echo $image['url']; ?>" rel="lightbox">
<img src="<?php echo $image['sizes']['soldier-additional-photo']; ?>" alt="<?php echo $image['alt']; ?>" />
</a>
<p><?php echo $image['alt']; ?></p>
<p><?php echo $image['caption']; ?></p>
<p><?php echo $photographer_name; ?></p>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
You’ll want to wrap a check around the field value, something like:
<?php
$term_id = get_queried_object_id($current_category);
if ( $val = get_field('field_name', 'category_' . $term_id) ) {
// do stuff here if field is not empty
}
?>
Maybe something like:
<?php if( have_rows('modules') ): ?>
<?php $menu_items = ''; ?>
<?php while ( have_rows('modules') ) : the_row();
if( get_row_layout() == 'photo' ):
$menu_items .= '<li><img src="' . get_sub_field('photo') . '" alt="' . get_sub_field('menu_name') . '"><li>';
elseif( get_row_layout() == 'text' ):
$menu_items .= '<li>' . get_sub_field('menu_name') . ' ' . get_sub_field('text') . '</li>';
<?php endif; endwhile; ?>
<ul>
<?php echo $menu_items; ?>
</ul>
<?php endif; // end modules has rows ?>
I’m having the same error with a repeater field on ordinary page. Problem has come now when I have update my WordPress to 4.1 and Advanced Custom Fields PRO 5.1.7.1.
Edit: I had a conditional tag right above the repeater fields and when I removed this, the repeater started working again. That’s a quick fix but far from good if you really want to use the conditional tag or tab before repeater.
This looks to be more a question about editing TinyMCE, the editor that powers the WordPress WYSIWYG.
There are a number of plugins that can do what you need, here is one as a starting point:
https://wordpress.org/plugins/tinymce-advanced/
I concur with the first request. List view is very helpful for a client managing her own site, since it reveals the image metadata and could prompt adding it where it’s missing.
List view would be even better if the meta fields (Title, Alternate Text, Caption and Description, and any programmed custom fields like ‘Photographer’) could be edited in place next to their images.
Tarheeldev, I wonder if your second request might best be met by using a Repeater fieldset instead of the Gallery, adding separate text fields for your custom title and caption.
Does this work:
<div class="postinner-h1">
<h1><?php echo single_cat_title(); ?> günstig online kaufen!</h1>
<?php
$term = get_queried_object();
if ( $term ):
?>
<p><?php echo get_field( 'short_description', $term->taxonomy . '_' . $term->term_id ); ?>
<?php endif; ?>
</div></div>
I’ve got the same request… That can not be done without plugin ?
I’m looking for a simple ajax image uploader that works in frontend without WP Uploader.
What can I do ?
it need to be in these part
<div class="postinner-h1">
<h1><?php echo single_cat_title(); ?> günstig online kaufen!</h1>
</div></div>
yep, its a custom theme and this is the part where i have to add the short_description custom field
<?php global $post, $swp_bread_status_blog, $swp_postmeta_status_blog,$swp_colsidemasonrywidth,$swp_colnosidemasonrywidth,$swp_colsidemasonrywidth_tablet, $swp_colnosidemasonrywidth_tablet, $swp_colspan, $swp_colspanmeta, $swp_leadingposts, $swp_leadingcolspan, $swp_post_wordlimit_blog, $swp_responsive; ?>
<?php dynamic_sidebar('sidebar-7'); ?>
<div class="post nocolsidepost"><div class="posttop"></div><div class="postinner-h1">
<h1><?php echo single_cat_title(); ?> günstig online kaufen!</h1>
</div></div>
<div id="masonthis">
<?php $swp_count=1; ?>
<div role="main" itemprop="mainContentOfPage">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php get_ts_colspan(); if ($swp_count <= $swp_leadingposts) {$swp_colspan = $swp_leadingcolspan;} else if ($swp_colspanmeta != "" ) {$swp_colspan = $swp_colspanmeta;} else {$swp_colspan = 1;} ?>
<?php get_theme_div( 'post', 'top', $sidebar, $cols ); ?>
<?php $wpaztemplate = get_post_meta($post->ID, 'wpaztemplate', true);
if ($wpaztemplate=="No Template" || $wpaztemplate=="") {
if ($swp_post_wordlimit_blog!='0'){ $teaser = true; } else { $teaser = false; } ?>
<article role="article" itemscope itemtype="http://schema.org/Article">
<?php get_theme_piece ( 'posttitle' ); ?>
<?php if ( $swp_postmeta_status_blog=="Show"){ get_theme_piece( 'postinfo' ); } ?>
<?php get_theme_piece( 'featuredimage' ); ?>
<div itemprop="articleBody"><?php if ($teaser){ echo teaser($swp_post_wordlimit_blog); } else { the_content(''); } ?></div>
<div class="clear"></div>
<?php get_theme_piece( 'postinfotwo', '', $swp_postmeta_status_blog, $teaser ); ?>
</article>
<?php } else {
$wpaz_word_count = get_theme_mod( 'wpaz_word_count_side', '250'); if ($wpaz_word_count!='' && $wpaz_word_count!=0){ $teaser = true; } else { $teaser = false; } ?>
<section role="article" itemscope itemtype="http://schema.org/Product">
<?php get_theme_piece ( 'posttitle' ); ?>
<?php get_custom_theme_piece( 'featuredimage', 'productblog', $sidebar, $swp_colspan ); ?>
<div class="proddesc" itemprop="description"><?php if ($teaser){ echo teaser($wpaz_word_count); } else { the_content(''); } ?></div>
<?php $wpaz_showstars = get_theme_mod( 'wpaz_showstars', 'No'); if ($wpaz_showstars=="Yes"){ ?><div class="reviewscorewrap"><?php get_custom_theme_piece( 'reviewscore' ); ?></div><?php } ?>
<?php get_custom_theme_piece( 'product-box', 'small' ); ?>
<div class="clear"></div>
</section>
<?php } ?>
<?php get_theme_div( 'post', 'bottom' ); ?>
<?php $swp_count++; endwhile; else: ?>
<?php get_theme_piece( '404content' ); ?>
<?php endif; ?>
</div>
</div>
<?php if ($cols == 'col') { ?>
<script type="text/javascript"><!--
jQuery(window).load(function(){
<?php if (!$swp_responsive) { ?>
jQuery('#masonthis').masonry({
columnWidth: <?php echo ${"swp_col".$sidebar."masonrywidth"}; ?>,
itemSelector: '.post'
});
<?php } else { ?>
fw = jQuery('.fullscreen').width();
if (fw > 960){
jQuery('#masonthis').masonry({
columnWidth: <?php echo ${"swp_col".$sidebar."masonrywidth"}; ?>,
itemSelector: '.post'
});
} else if (fw < 960 && fw > 751){
jQuery('#masonthis').masonry({
columnWidth: <?php echo ${"swp_col".$sidebar."masonrywidth_tablet"}; ?>,
itemSelector: '.post'
});
}
<?php } ?>
});
--></script>
<?php } ?>
<div class="clear"></div>
<?php get_theme_piece( 'blogtitle', '', $sidebar, 'nocol' ); ?>
<?php dynamic_sidebar('sidebar-8'); ?>
In your sample $lien
contains the <br>
in the string, whereas $lien2
only contains the link string and not the <br>
.
If you do this it should return true:
$lien = get_field('fieldName');
echo $lien.'<br/>';
$lien2 = 'http://link.com';
echo $lien2.'<br/>';
if($lien2==$lien):
echo "same";
else:
echo "not same";
endif;
This was solved by ACF Support. Here is the code if anyone is interested:
<?php
$rows = get_field('blog_style_gallery');
$row_count = count($rows);
$i=1;
?>
<?php
echo "Slide: ". $i." of ".$row_count." Rows";
$i++;
?>
This was solved by ACF Support.
Here is the code if anyone is interested:
<?php
$chckbox_value = get_sub_field('blog_style_gallery_options');
if( $chckbox_value && in_array( 'border', get_sub_field('blog_style_gallery_options') ) )
{
echo "border test";
}
?>
After more Googling around, I found this:
I already had something similar in my functions.php, but it obviously wasn’t quite right. This is the correct code:
//Include CPT In Categories Pages
function namespace_add_custom_types( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$post_types = get_post_types( '', 'names' );
$query->set( 'post_type', $post_types);
return $query;
}
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types');
Still, respect for the help ractoon!
Is $category
formatted like: "{$term->taxonomy}_{$term->term_id}"
? Getting field values from taxonomy fields is a little funky, full docs at: http://www.advancedcustomfields.com/resources/how-to-get-values-from-a-taxonomy-term/
Oh, you’ll probably want to put the query for the attached posts inside the loop and pass the ID. Maybe something like:
<?php
$loop = new WP_Query( array( 'post_type' => 'clients', 'posts_per_page' => 10 ) );
?>
<?php if($loop->have_posts()) : ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="postbox-container postbox">
<h3><?php the_title(); ?></h3>
<?php
$ids = get_field('attach_to_client', $loop->ID);
$query = new WP_Query(array(
'post_type' => array('research', 'project_brief','persona','task_models', 'user_stories', 'style_guide'),
'posts_per_page' => -1,
'post__in' => $ids,
'post_status' => 'any',
'orderby' => 'modified',
));
?>
<?php if ($query->have_posts()) : ?>
<ul>
<?php
while($query->have_posts()) :
$query->the_post();
?>
<li><?php the_title(); ?></li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<p>Oops, there are no posts.</p>
<?php endif; ?>
</div>
<?php endwhile; endif; wp_reset_query(); ?>
Is the checkbox just a true/false
field? If so it would be:
<?php
if ( get_sub_field('blog_style_gallery_options') ) {
echo "border";
}
?>
Would probably include something like this in your loop:
<?php if( have_rows('repeater_field_name') ): ?>
<?php
$slides = get_field('repeater_field_name');
$total_slides = count($slides);
$current_slide = 1;
?>
<ul class="slides">
<?php while( have_rows('repeater_field_name') ): the_row(); ?>
<li class="slide">
<?php $image = get_sub_field('image'); ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
<span class="count"><?php echo $current_slide++; ?> of <?php echo $total_slides; ?></span>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
ractoon, thanks for your help! That code led me in the right direction. I did end up having to use 2 queries.
First I checked for department heads:
<?php //Get the Department Head First ?>
<?php
$args = array(
'numberposts' => -1,
'post_type' => 'staff',
'meta_key' => 'dir-department-head',
'meta_value' => 'yes'
);
query_posts($args);
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (in_array("Administration", (array) get_field('dir-department')) AND ('yes' == get_field('dir-department-head'))): ?>
Formatting fields, etc.
<?php endif; ?>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
Then, a separate query for the rest of the employees, excluding the “yes” answers in the department head field by pulling only those entries who left the field blank:
<?php // Get Other Deparment Employees ?>
<?php
$args = array(
'post_type' => 'staff',
'posts_per_page' => -1,
'meta_key' => 'dir-last-name',
'orderby' => 'meta_value',
'order' => 'ASC'
);
query_posts($args);
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (in_array("Administration", (array) get_field('dir-department')) AND ('' == get_field('dir-department-head'))): ?>
Formatting fields, etc.
<?php endif; ?>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
Thanks for leading me in the right direction!
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.