This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 3 days, 9 hours ago.

  • Creator
    Topic
  • #11595

    dhuy
    Participant

    Hi,
    I’ve created a CPT for pricing tables and I want to show it in a page using the post field.
    Currently, I’m stuck at how to get the CPT id to display the pricing table.

    $table = isset( $pricing['pricing_table_id'] ) ? $pricing['pricing_table_id'] : '';
                      if( $table ) {
                        setup_postdata( $GLOBALS['post'] =& $table );
                        $plans = rwmb_meta( 'plan' );
                        if( ! empty( $plans ) ) {
                          foreach ($plans as $plan) {
                            $name = isset( $plan['plan_name'] ) ? $plan['plan_name'] : '';
                            echo $name;
                          }
                        }
                        wp_reset_postdata();
                      }
Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #11604

    Anh Tran
    Keymaster

    Hi Huy,

    Do you mean getting the post object or getting the items in the pricing table?

    Can you also share the code of the meta box?

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.