
and for checking if the error in next template
add this
<?php echo 'event exists<br/>';tribe_get_template_part('month/single', 'event') ?>

No I don’t need that dump. I just was interested in information about the var is not NULL when you calling page first time =)
Now try to dump your user field
<?php $lookforuser = get_field('mustjoin'); var_dump($lookforuser);var_dump(strpos($lookforuser, $user_login));?>

thats strange that you not see your events without refreshing
try to dump your var
global $user_login; var_dump($day['events']);
or maybe you have some javascripts that works with you data? and you placed them in wrong place

can you post a link to your project?

wp-includes/meta.php LINE 765
if ( 'NOT EXISTS' == $meta_compare ) {
$join[$i] = "LEFT JOIN $meta_table";
$join[$i] .= $i ? " AS $alias" : '';
$join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column AND $alias.meta_key = '$meta_key')";
$where[$k] = ' ' . $alias . '.' . $meta_id_column . ' IS NULL';
continue;
}

checking for NULL value in meta_queries is:
$args = array(
‘numberposts’ => -1,
‘post_type’ => ‘post’,
‘meta_query’ => array(
‘relation’ => ‘OR’,
array(
‘key’ => ‘regulation’,
‘compare’ => ‘NOT EXISTS‘
)
)
)
it is key word for SQL IS NULL

Yep your statement better =) You are welcome =)

you can add custom post type where wp will create posts when you create taxonomies and than create template for this post type but its a very long way =)))
function taxpostcreate( $a,$b,$c )
{
$post = array(
'post_name' => 'term'.$b,
'post_title' => 'term'.$b,
'post_status' => 'publish',
'post_type' => 'terms_scrapyard',
'post_excerpt' => $b,
);
wp_insert_post( $post, $wp_error );
return $a;
}
add_filter('created_term', 'taxpostcreate', 10, 3);
something like that

But we can upgrade your code =))
<?php
global $current_user;
get_currentuserinfo();
if (in_array(explode(' ',get_field('mustjoin')),$current_user->user_login)) { ?>
<?php while ($day['events']->have_posts()) : $day['events']->the_post() ?>
<?php tribe_get_template_part('month/single', 'event') ?>
<?php endwhile; ?>
<?php } ?>

I guess thats because you are using simple text field for your userlist. But my code was written for UserSelect ACF field
That returns an array of user objects

maybe you already set the field to return just post_id instead of post object? so wp showing current post titles and links
(copyed your code to my site with relationship field and all works fine)

try to return just post ID

also you can load all post into page and then sort em using jQuery using datepicker as sorting data provider for example

I’m not really sure what you trying to do, so just offering methods

my code was just for example, you can add event listener onchange to your datepicker so when it will change pass to url with get parameter and modify the WP_Query object acording the request

You have to change $new_side_bar = get_field(‘ACFSideBarField‘)
ACFSideBarField to your custom-sidebar-name-field slug.
And thats all
Every time when wordpress will try to call function get_sidebar() it will check existance of the field ACFSideBarField in curent post and if find will change the name of sidebar for loading.
Sorry for my english )) I speak russian most of time =)
P.S. that code block was for functions.php of your template. Just place it for example at the end of file

add_filter( 'posts_where', 'creator_posts' );
function creator_posts( $where ){
global $wpdb, $pagenow, $current_user;
if ( is_admin() && $pagenow=='edit.php' && $current_user->user_login != 'admin') {
$where .= "AND (".$wpdb->posts.".post_author = '".$current_user->ID."' )";
}
return $where;
}
you can also add any other statements to IF block for example

<style type="text/css">
.acf-map {
width: 100%;
height: 400px;
border: #ccc solid 1px;
margin: 20px 0;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript">
(function($) {
function render_map( $el ) {
var $markers = $el.find('.marker');
var args = {
zoom : 16,
center : new google.maps.LatLng(0, 0),
mapTypeId : google.maps.MapTypeId.ROADMAP,
scrollwheel: false
};
var map = new google.maps.Map( $el[0], args);
map.markers = [];
$markers.each(function(){
add_marker( $(this), map );
});
center_map( map );
}
function add_marker( $marker, map ) {
var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') );
var marker = new google.maps.Marker({
position : latlng,
map : map
});
map.markers.push( marker );
if( $marker.html() )
{
var infowindow = new google.maps.InfoWindow({
content : $marker.html()
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open( map, marker );
});
}
}
function center_map( map ) {
var bounds = new google.maps.LatLngBounds();
$.each( map.markers, function( i, marker ){
var latlng = new google.maps.LatLng( marker.position.lat(), marker.position.lng() );
bounds.extend( latlng );
});
if( map.markers.length == 1 )
{
map.setCenter( bounds.getCenter() );
map.setZoom( 16 );
}
else
{
map.fitBounds( bounds );
}
}
$(document).ready(function(){
$('.acf-map').each(function(){
render_map( $(this) );
});
});
})(jQuery);
</script>
<div class="acf-map"></div>
Line 16
var args = {
zoom : 16,
center : new google.maps.LatLng(0, 0),
mapTypeId : google.maps.MapTypeId.ROADMAP,
scrollwheel: false
};
or declare map globaly
after
<script type="text/javascript">
add var map and change var map = new google.maps.Map( $el[0], args); to map = new google.maps.Map( $el[0], args);
then you can call map.setOptions({'scrollwheel':false}); or any other options change

function my_func_filter($args, $field, $post){
$args['post_parent'] = $post->ID;
return $args;
}
add_filter('acf/fields/relationship/query/name=YourACFFieldSlug', my_func_filter, 10,3);
try this

I guess you can create pages with individual templates with WP_Query custom loop inside for your taxonomies ( {template_dir}/page-{pageID}.php )

$unique_non_blank_values = $wpdb->get_results( "SELECT DISTINCT meta_value FROM ".$wpdb->postmeta." WHERE meta_key = 'YourMetaKey' AND meta_value <>'' ORDER BY meta_value DESC");
maybe this way?


I tried many ways and stoped on deleting all files except
acf.pot
acf-uk.mo
acf-uk.po
from
wp-content/plugins/advanced-custom-fields/lang/

function remove_acf_menu(){
global $current_user;
if ($current_user->user_login!='admin'){
remove_menu_page( 'edit.php?post_type=acf' );
}
}
add_action( 'admin_menu', 'remove_acf_menu', 100 );

http://codex.wordpress.org/Class_Reference/WP_Meta_Query
if (isset($_GET['month'])):
$args = array(
'post_type' => 'any',
'meta_query' => array(
array(
'key' => 'YourAcfDateFieldKey',
'value' => $_GET['month'],
'compare' => 'LIKE'
)
)
);
$myposts = get_posts($args);
endif;
try something like that
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.