fbpx

How can we help?

Changing the priority of field for event submission form

Changing the priority of field like country field for events

WP Event Manager tutorial shows how to edit fields based on the Editing Event Submission Form Fields doc and then output it on a single event listing.

Changing the priority of field for the frontend’s event submission form

Open up your theme functions.php field and create a function to append a new field to the events section. First hook it in:

<?php
    add_filter( 'submit_event_form_fields', 'frontend_add_country_field' );
?>

Then write the function:

<?php
  
  function frontend_add_country_field( $fields ) {
  $fields['event']['event_country'] = array(
    'label'       => __( 'Country ($)', 'event_manager' ),
    'type'        => 'text',
    'required'    => true,
    'priority'    => 2 ,
    'placeholder' => 'e.g. germmany'
  );
  return $fields;
}

?>

This change the priority of field for an event field priority of the frontend events form that has the label “Country”, is required, priority has 2.

Changing the field’s priority of the the backend’s event submission form

Again in theme functions.php, hook in your custom function:

<?php
     add_filter( 'event_manager_event_listing_data_fields', 'admin_add_country_field' );
?>

Then write your custom function:

<?php

function admin_add_country_field( $fields ) {
  $fields['_event_country'] = array(
    'label'       => __( 'Country ($)', 'event_manager' ),
    'type'        => 'text',
    'placeholder' => 'e.g. germmany',
    'priority'    => 2 ,
    'description' => ''
  );
  return $fields;
}

?>
Was this article helpful?
How can we improve this article?