How to show Ticket Price

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:
  1. function get_custom_event_ticket_price( ) {
  2.     global $post;
  3.     if ( $post->post_type !== 'event_listing' )
  4.         return;
  5.     return apply_filters( 'display_custom_event_ticket_price', $post->_event_ticket_price, $post );
  6. }
  1. Add the following code for displaying event ticket price:
  1. function display_custom_event_ticket_price( $before = '', $after = '', $echo = true, $post = null ) {
  2.     $event_ticket_price = get_custom_event_ticket_price( $post );
  3.     if ( strlen( $event_ticket_price ) == 0 )
  4.         return;             
  5. $event_ticket_price = esc_attr( strip_tags( $event_ticket_price ) ); 
  6.     $event_ticket_price = $before . $event_ticket_price . $after;
  7.     if ( $echo )
  8.         echo $event_ticket_price;
  9.     else
  10.         return $event_ticket_price;
  11. }
  1. Open your theme content-event_listing.php file and echo event ticket price.
  1. 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.


    • Related Articles

    • List of all the default template and fields given in core and Premium Add-ons

      The default templates offered by WP Event Manager are mentioned below. The default fields & default template available in the core plugin are as follows: WP-Event-Manager Account-signin.php Content-event_listing.php Content-no-events-found.php ...
    • Editing The Registration Form Fields

      In WP Event Manager, you can easily edit the Registration form value along with other form field details using the Filter event_registration_form_fields. The Filter allows you to change the field label, value and other attributes. In the following ...
    • Add custom field in Search filter

      It is possible for the users of WP Event Manager to add new filters to the event search form. In this guide we will show you how you can do it. Creating a custom event search filter WP Event Manager’s [Events] shortcode shows a search filter on the ...
    • Hide and Add column from the Event Dashboard

      An event dashboard displays all the details related to a specific event. A user can easily access the dashboard after logging into his or her account on WP Event Manager. The event dashboard column can be seen directly in the home page. A user can ...
    • How to allow organizers to add images in the description box

      How to allow organizers to add images in the description box on the submit event page? In order to allow the organizers to add images while submitting the event in the description box, from the frontend, you need to add the below-mentioned code in ...