Combine two forms from different plugins in Wordpress

Viewed 21

I want to combine two forms from two different plugins namely : Wp job manager (Plugin A) and Afj Company Listings (plugin B). plugin A has a form called job-submit.php (located in: public_html/wp-content/plugins/wp-job-manager/templates) which would like to combine with another form from Plugin B called company_listings-submit.php (located in: public_html/wp-content/plugins/afj-company-listings/templates).

What I have done is to add get method in the job-submit.php but didnt work:

get_afj_company_listings_template( 'company_listings-submit.php' )

  1. job-submit.php

/**

  • Content for job submission ([submit_job_form]) shortcode.
  • This template can be overridden by copying it to yourtheme/job_manager/job-submit.php.
  • @see https://wpjobmanager.com/document/template-overrides/
  • @author Automattic
  • @package wp-job-manager
  • @category Template
  • @version 1.34.3 */

if ( ! defined( 'ABSPATH' ) ) {

exit; // Exit if accessed directly.

}

global $job_manager;

?>

" method="post" id="submit-job-form" class="job-manager-form" enctype="multipart/form-data">
<?php

if ( isset( $resume_edit ) && $resume_edit ) {

    printf( '<p><strong>' . esc_html__( "You are editing an existing job. %s", 'wp-job-manager' ) . '</strong></p>', '<a href="?job_manager_form=submit-job&new=1&key=' . esc_attr( $resume_edit ) . '">' . esc_html__( 'Create A New Job', 'wp-job-manager' ) . '</a>' );
}

?>

<?php do_action( 'submit_job_form_start' ); ?>

<?php if ( apply_filters( 'submit_job_form_show_signin', true ) ) : ?>

    <?php get_job_manager_template( 'account-signin.php' ); ?>

<?php endif; ?>

<?php if ( job_manager_user_can_post_job() || job_manager_user_can_edit_job( $job_id ) ) : ?>

    

    <!-- Job Information Fields -->

    <?php do_action( 'submit_job_form_job_fields_start' ); ?>

     <!-- MY OWN CODE HERE-----afj-company-listings/templates/company_listings-submit.php wp-content/plugins/wp-job-manager/templates-->

     <?php get_job_manager_template( 'company_listings-submit.php' ); ?>

    <?php foreach ( $job_fields as $key => $field ) : ?>

        <fieldset class="fieldset-<?php echo esc_attr( $key ); ?> fieldset-type-<?php echo esc_attr( $field['type'] ); ?>">


            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_kses_post(

$field['label'] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label',

$field['required'] ? '' : ' ' . __( '(optional)', 'wp-job-manager' ) . '', $field )

); ?> ">

                <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-

field.php', [ 'key' => $key, 'field' => $field ] ); ?>

            </div>

        </fieldset>

    <?php endforeach; ?>

    <?php do_action( 'submit_job_form_job_fields_end' ); ?>

    <!-- Company Information Fields -->

    <?php if ( $company_fields ) : ?>

        <h2><?php esc_html_e( 'Company Details', 'wp-job-manager' ); ?></h2>

        <?php do_action( 'submit_job_form_company_fields_start' ); ?>

        <?php foreach ( $company_fields as $key => $field ) : ?>

            <fieldset class="fieldset-<?php echo esc_attr( $key ); ?> fieldset-type-<?php echo esc_attr( $field['type'] ); ?>">

                <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_kses_post( 

$field['label'] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label', $field['required'] ? '' : ' ' . __( '(optional)', 'wp-job-manager' ) . '', $field ) ); ?> ">

                    <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', [ 'key' => $key, 'field' => $field ] ); ?>

                </div>

            </fieldset>

        <?php endforeach; ?>

        <?php do_action( 'submit_job_form_company_fields_end' ); ?>

    <?php endif; ?>

    <?php do_action( 'submit_job_form_end' ); ?>

    <p>
        <input type="hidden" name="job_manager_form" value="<?php echo esc_attr( $form ); ?>" />
        <input type="hidden" name="job_id" value="<?php echo esc_attr( $job_id ); ?>" />

        <input type="hidden" name="step" value="<?php echo esc_attr( $step ); ?>" />

        <input type="submit" name="submit_job" class="button" value="<?php echo esc_attr( 

$submit_button_text ); ?>" />

        <?php

        if ( isset( $can_continue_later ) && $can_continue_later ) {

            echo '<input type="submit" name="save_draft" class="button secondary save_draft" 

value="' . esc_attr__( 'Save Draft', 'wp-job-manager' ) . '" formnovalidate />';

        }

        ?>

        <span class="spinner" style="background-image: url(<?php echo esc_url( includes_url(

'images/spinner.gif' ) ); ?>);">

    </p>

<?php else : ?>

    <?php do_action( 'submit_job_form_disabled' ); ?>

<?php endif; ?>
  1. company_listings-submit.php
" method="post" id="submit-company-form" class="job-manager-form" enctype="multipart/form-data">
<?php do_action( 'submit_company_form_start' ); ?>

<?php if ( apply_filters( 'submit_company_form_show_signin', true ) ) : ?>

    <?php get_job_manager_template( 'account-signin.php', array( 'class' => $class ), 'afj-company-listings', COMPANY_LISTINGS_PLUGIN_DIR . '/templates/' ); ?>

<?php endif; ?>

<?php if ( company_listings_user_can_post_company() ) : ?>

    <!-- Company Fields -->

    <?php do_action( 'submit_company_form_company_fields_start' ); ?>

    <?php foreach ( $company_fields as $key => $field ) : ?>

        <fieldset class="fieldset-<?php esc_attr_e( $key ); ?>">

            <label for="<?php esc_attr_e( $key ); ?>"><?php echo $field['label'] . apply_filters( 'submit_company_form_required_label', $field['required'] ? '' : ' <small>' . __( '(optional)', 'afj-company-listings' ) . '</small>', $field ); ?></label>

            <div class="field">

                <?php $class->get_field_template( $key, $field ); ?>

            </div>

        </fieldset>

    <?php endforeach; ?>

    <?php do_action( 'submit_company_form_company_fields_end' ); ?>

    <p>
        <?php wp_nonce_field( 'submit_form_posted' ); ?>

        <input type="hidden" name="company_listings_form" value="<?php echo $form; ?>" />

        <input type="hidden" name="company_id" value="<?php echo esc_attr( $company_id ); ?>" />
        <input type="hidden" name="job_id" value="<?php echo esc_attr( $job_id ); ?>" />

        <input type="hidden" name="step" value="<?php echo esc_attr( $step ); ?>" />

        <input type="submit" name="submit_company" class="button" value="<?php esc_attr_e( $submit_button_text ); ?>" />

    </p>

<?php else : ?>

    <?php do_action( 'submit_company_form_disabled' ); ?>

<?php endif; ?>

<?php do_action( 'submit_company_form_end' ); ?>
0 Answers
Related