Forum Replies Created

  • Appreciated.

  • Not sure why but I deleted the two datepicker fields, recreated them and now have a working date.

  • I tried adding this to query a custom post type and it gives an odd timestamp 01 January 1970:

    $date = get_field('fromdate', false, false);
    // convert it to a time
    $time = strtotime($date);
    if ( get_query_var('paged') ) $paged = get_query_var('paged');  
    if ( get_query_var('page') ) $paged = get_query_var('page');
    $query = new WP_Query( array( 'post_type' => 'events', 'posts_per_page' => 20,  'order' => 'ASC' ) ); 
    if ( $query->have_posts() ) :
            while ( $query->have_posts() ) : $query->the_post(); ?> 
    <div class='events-title'>
    <span class="day"><?php echo date('d', $time); ?></span>
    <span class="month"><?php echo date('F', $time); ?></span>
    <span class="year"><?php echo date('Y', $time); ?></span>
       <?php endwhile; wp_reset_postdata();
    else : ?>
            <p>There are no events at the moment</p>
    <?php endif;?>

    The dateformat is set up to return Ymd.


  • Thank-you. That worked if I set the return value for the image field to a url.

    Is their a way to use the responsive elements in wordpress core to create smaller versions of the image.

    Again thanks for your help.


  • This works for echoing out the image field but the css is not working as the width and height are being added to the inline style:

    <div class="c-1 hero bg-image" style="background-image: url('<img width=" 1024"="" height="256" src="" alt="drama-holding" srcset=" 1024w, 300w, 768w" sizes="(max-width: 1024px) 100vw, 1024px">');">
      <div class="center-wrapper">
        <div class="center">
          <h1 class="cheddar">Drama</h1>

    Using your example above. Do I need to set this line to something else:

    <div class="c-1 hero bg-image style="background-image: url('<?php echo wp_get_attachment_image( $hero, $size ); ?>');">



  • I tried the above change but the url is not been shown at all – the title works?

    $back = get_field('bg_image');
    $size = 'full';
    if( $back ) { ?>
    <div class="bg-image" style="background-image: url('<?php echo $back['sizes']['full'];?>');">
      <div class="center-wrapper">
         <h1><?php the_title(); ?></h1>
    <?php } ?>
Viewing 7 posts - 1 through 7 (of 7 total)