Support

Account

Home Forums General Issues Page_id – more parametrs

Helping

Page_id – more parametrs

  • Hello 🙂
    is possibility to use more than one page_id?
    I have code
    <?php

    $podpis = ‘title’;
    $ptab = array();
    $count = 0;
    $post_objects = get_field(‘projekt’);

    if( $post_objects ): ?>

      <?php foreach( $post_objects as $post_object): ?>

      $ptab[$count++] = $post_object->ID;

      <?php endforeach; ?>

      <?php endif;

      $ptabres=rtrim(implode(‘,’, $ptab), ‘,’);
      print_r($ptabres); //shows correct
      $grid = new avia_post_grid(array( ‘linking’ => ”,
      ‘columns’ => ‘2’,
      ‘contents’ => $podpis,
      ‘sort’ => ‘no’,
      ‘paginate’ => ‘yes’,
      ‘set_breadcrumb’ => false,
      ));
      $query = array(
      ‘page_id’ => $ptabres,
      ‘post_type’ => ‘any’,
      );

      query_posts($query);

      $grid->use_global_query();?>
      <?php echo $grid->html()?>`

      This script displays only one portfolio element. I picked up few portfolio posts.
      Is any possibility to use more ‘page_ids’ parameters?

  • Hi @szopja,

    Thanks for the post.

    Yes it is certainly possible, you will only need to pass a global post id parameter so that the get_field() will obtain the post_id of the current post.

    The post-id will be found using $post->ID

    I hope this helps.

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

The topic ‘Page_id – more parametrs’ is closed to new replies.