fbpx
Celebrate International Yoga Day with us and get a flat 20 to 30% discount on products. Offer valid till 24 June. Use code: INTYoga24
How can we help?

How to show Ticket Price

WP Event Manager Add ons Tutorials explains you, How to show ticket price field to the frontend.

Show ticket price at events listing

  1. Open your theme function.php file
  2. Create a function to append a new field to the events section.
  3. Add the following code for getting event ticket price:
    function get_custom_event_ticket_price( ) {
        global $post;
        if ( $post->post_type !== 'event_listing' )
            return;
        return apply_filters( 'display_custom_event_ticket_price', $post->_event_ticket_price, $post );
    }
    
  4. Add the following code for displaying event ticket price:
    function display_custom_event_ticket_price( $before = '', $after = '', $echo = true, $post = null ) {
    
        $event_ticket_price = get_custom_event_ticket_price( $post );
    
        if ( strlen( $event_ticket_price ) == 0 )
            return;
            
        $event_ticket_price = esc_attr( strip_tags( $event_ticket_price ) );
    
        $event_ticket_price = $before . $event_ticket_price . $after;
    
        if ( $echo )
            echo $event_ticket_price;
        else
            return $event_ticket_price;
    }
    
  5. Open your theme content-event_listing.php file and echo event ticket price.
    printf( __( 'Ticket Price: %s', 'wp-event-manager' ), get_custom_event_ticket_price() );
    

Fields added using the above code will be show to the event ticket price automatically. There is two layout available box layout and line layout so add your above code where you want to show ticket price or you can add in both layout.

How To Show Ticket Price
Ashok Dudhat

Our team constantly explores ways that technology can help us reinvent industries. We want to change the world by creating great products that transform industries. We Dream It, We Make It.

Quick Links
Close
Close