Home Forums Front-end Issues get page link query not working Reply To: get page link query not working

  • solved my self just changed the field type to relation ship and return post id in and array of the page and then used this code just it case its useful to anyone

    // get id of current page and store it in $pageid variable
    global $post;
    $pageid= $post->ID;
    //query arguments
        'post_type' => 'features'
    //set up query with arguments input
      $query = new WP_Query( $args );
    // run loop
      if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>
        $pagelink= get_field('pagelink');
        // get_field(pagelink) returns page id selected in the pagelink field as array with 0 as the key and the page id number as the value, then we store it in pagelink variable
    if($test[0] === $pageid){
    //if the field pagelink is the same as pageid of current page then
                if (get_field('alignment') === 'left' ) {
                 else if(get_field('alignment') === 'right' ) {
      <?php endwhile; endif; wp_reset_postdata(); ?>