• Resolved rapuolas

    (@rapuolas)


    I have a website page with list of Items(posts).
    List of Items
    I would like to have Item order ID. I wrote those numbers with {$iterator->counter}, but I would like to have real order ID and use it for inside post write order ID, in the circle.
    Order ID inside Post
    One post would have few categories and different order ID.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    Hey @rapuolas,

    apologies for such a late reply, but for some reason I don’t get the notifications any more from this plugin support threads. I need to raise this with the WP plugin gods.

    I saw your wiki page on the github and added answers there too.

    The manual index order is stored in the custom table: wp_reorder_post_rel
    You can pull the posts by matching the term id for which you want to get the order by matching it to the field category_id and selecting the post_id column. This will return an array of post ids index (zero based) on the same order you sorted them in.

    Thread Starter rapuolas

    (@rapuolas)

    Thank you for your respond.

    I am trying to do as you said.
    For now i got taxonomies.
    Categories

    Found a code that should do the half of the job, but can not get the index, could you help me with this?

       add_action( 'wp_footer', 'getOrderID' );
    
       function getOrderID() {
    
          $custom_terms = get_terms('ait-items');
          foreach($custom_terms as $custom_term) {
           // var_dump($custom_term);
    
            wp_reset_query();
            $args = array('post_type' => 'ait-item',
              'tax_query' => array(
                array(
                   'taxonomy' => 'ait-items',
                   'field' => 'slug',
                   'terms' => $custom_term->slug,
                   ),
                ),
              );
    
            $loop = new WP_Query($args);
    
            if($loop->have_posts()) {
             echo '<h2>'.$custom_term->id.'</h2>';
    
             while($loop->have_posts()) : $loop->the_post();
             echo '<a href="'.get_permalink().'">'.get_the_title().'</a>';
             endwhile;
          }
       }
    
    Thread Starter rapuolas

    (@rapuolas)

    Thanks for help, lock The post 😀

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Order ID inside Post’ is closed to new replies.