Creating short code for search form

You are returning the shortcode content as a big string, your function get_job_listing_categories is not properly being called. Also i would recommend use PHP output buffering which is great for WordPress shortcodes. Try below code: function jobsform_function($atts) { ob_start(); ?> <form class=”home-job-search” method=”GET” action=”https://website.com/jobs/jobs/”> <div class=”home-keywords”> <input type=”text” id=”search_keywords” name=”search_keywords” placeholder=”Enter Keywords” /> </div> <div … Read more

A mandatory agreement form to access another page?

I would use a shortcode for this. Wrap the content you want behind the “terms_required” shortcode, if the user hasn’t agreed to the terms, show them the form. The form would submit to a custom rewrite rule (url endpoint) that validates the form and sets a cookie if everything checks out. Let’s start by wrapping … Read more

Remove field in the form : only works for “url”, not for “email”?

This works fine for me: <?php add_filter(‘comment_form_default_fields’, ‘wpse53687_filter_fields’); /** * Unsets the email field from the comment form. */ function wpse53687_filter_fields($fields) { if(isset($fields[’email’])) unset($fields[’email’]); return $fields; } One reason that it could be failing on your theme is that args were passed into comment_form. Specifically, the theme author passed in a fields key into the … Read more

Saving frontend form data in wordpress

Also, how are you processing your image upload? That function only sets the enctype. By adding the following beneath your call to wp_insert_post you will be able to process your image upload, if (!function_exists(‘wp_generate_attachment_metadata’)){ require_once(ABSPATH . “wp-admin” . ‘/includes/image.php’); require_once(ABSPATH . “wp-admin” . ‘/includes/file.php’); require_once(ABSPATH . “wp-admin” . ‘/includes/media.php’); } if ($_FILES) { foreach ($_FILES … Read more

Make editor required for post from frontend

You can add a filter to the editor html add_filter( ‘the_editor’, ‘add_required_attribute_to_wp_editor’, 10, 1 ); function add_required_attribute_to_wp_editor( $editor ) { $editor = str_replace( ‘<textarea’, ‘<textarea required=”required”‘, $editor ); return $editor; }

What form element names break wordpress?

You should definitely avoid the public WordPress query vars: attachment attachment_id author author_name cat category_name comments_popup day error feed hour hour m minute monthnum name p page_id paged pagename post_parent post_type preview second static subpost subpost_id tag tag_id tb w year There’s also this list of reserved terms, inexplicably located on the register_taxonomy page, with … Read more

Grab values from the query string to fill in hidden fields in ninja forms [closed]

It looks like you can use the ninja_forms_display_init action to populate a field. To get the job ID from the URL you mentioned above you can use the $_GET array. Adapting the code from that documentation page, something like this should achieve what you’re looking for: function wpse_158000_populate_field($form_id) { global $ninja_forms_loading; $job_id_field = 3; //put … Read more

How dynamically change wp_mail behaviour, sending html or plain text based on conditions?

Here’s an (untested) PHPMailer example to check for e.g. the subject and the content type: function mailer_config( PHPMailer $mailer ) { if( ‘Subject #1’ === $mailer->Subject && ‘text/html’ !== $mailer->ContentType ) { $mailer->IsHTML( true ); } } other options would be to e.g. check the $mailer->From or $mailer->FromName, or some other conditions, depending on your … Read more