Support

Account

Forum Replies Created

  • Hi !
    I have a same bug !
    if I delete % it does not work either.
    what would be the good issue
    thx

    $date = DateTime::createFromFormat(‘Ymd’, get_field(‘date’));
    $args = array(
    ‘post_type’ => ‘programmation’,
    ‘posts_per_page’ => 1,
    ‘order’ => ‘ASC’,
    ‘orderby’ => ‘meta_value’,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘dates_%_date’,
    ‘value’ => date(‘Ymd’),
    ‘compare’ => ‘>=’,
    )
    )
    );
    //var_dump($args);
    $query = new WP_Query( $args );

  • Sorry,
    The true solution

    <?php 
    	$posts = get_field('sidebar_widget');
    			$args = array(
    			'post_type' => 'sidebar-widget',
    			'name'=> ($posts->post_name), //get the value in array
    			);
    			$query = new WP_Query( $args );
    
    			// The Loop
    			?>													
    			<?php if($query->have_posts()) : ?>
    				<?php while($query->have_posts()) : ?>
    				<?php $query->the_post(); ?>
    					<?php include('widget/content-sidebar-widget.php'); ?>
    				<?php endwhile; ?>
    				<?php wp_reset_postdata(); ?>
    			<?php endif; ?>
    			
    
  • Hi !
    I find this solution with query !
    This code work perfectly.

    ` $sidebar = get_field(‘sidebar-widget’);
    $args = array(
    ‘post_type’ => ‘sidebar-widget’,
    ‘page_id’ => $sidebar
    );
    $query = new WP_Query( $args );
    // The Loop
    ?>
    <?php if($query->have_posts()) : ?>
    <?php while($query->have_posts()) : ?>
    <?php $query->the_post(); ?>
    <?php include(‘widget/content-sidebar-widget.php’); ?>
    <?php endwhile; ?>
    <?php wp_reset_postdata(); ?>
    <?php endif; ?>`

Viewing 4 posts - 1 through 4 (of 4 total)