Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Jolley

    (@mikejolley)

    Can you give an example of the different types needed and the ‘why’? I don’t think its possible but I’d like to understand why you need it. Perhaps if you have different types of listings you could use a multisite.

    Thread Starter olafnekeman

    (@olafnekeman)

    my site is for two different types of employers so it would be nice to have different forms for the employers.
    What I’m trying to do now is:
    create a second template file called ‘job-submit2’ in my theme folder and show that template through a new shortcode. In the template file I’ll make the modifications to the form.
    is that the right way to go?

    Evert

    (@fourleafed)

    Hi Olaf,

    I think you are on the right way. I am not sure if you also have created two different userroles for the employers but you may want to do this. With the page template below you only need one page to display the two submit forms. Saves you an extra link on your site and has some SEO improvements.

    The code below first checks the userrole of the user and than conditionally displays the shortcode for form1 or form2. This can be extend with more or other forms. We are using it on our clients sites to show the employer or the candidate dashboards. This is a quick modification of the code. You may find a typo (or two) 😉

    Please notice that I have also added the userrole ‘administrator’ in the function, so site admins will always see both the form. You may want to adjust it to your needs.

    <?php
    /*
    Template Name: Submit Job Form
    Author: FourLeafed - Evert Semeijn
    */
    ?>
    
      <?php get_header(); ?>
    
      <div id="content">
        <div id="inner-content" class="row clearfix">
          <div class="large-8 medium-8 columns clearfix" role="main">
    
            <?php if ( function_exists('yoast_breadcrumb') ) {
              yoast_breadcrumb('<ul class="breadcrumbs"><li>','</li></ul>');
            } ?>
    
            <div id="main">
              <?php
              /* check if user is logged in */
              if ( is_user_logged_in() ) { 
    
                /* switch from capabilities to userroles */
                global $current_user;
                $user_roles = $current_user->roles;
                $user_role = array_shift($user_roles);
    
                if ( in_array( $user_role, array(  'administrator' , 'employer1' ))) { // userrole is employer1
                  echo do_shortcode( '[submit_job_form]' ); // or some other shortcode
                } elseif (in_array($user_role, array( 'administrator' , 'employer2'))) { // userrole is employer2
                  echo do_shortcode( '[submit_job_form]' ); // or some other shortcode
                } else {
                  echo '<a href="<?php echo wp_login_url(); ?>" title="Login">Login</a>';
                }
              }
              ?>
            </div>
          </div>
    
          <?php get_sidebar('submit'); ?>
        </div>
      </div>
    
    <?php get_footer(); ?>
    Thread Starter olafnekeman

    (@olafnekeman)

    thank you for your response.

    One last question: Where do I put this?

    Evert

    (@fourleafed)

    @olafnekeman the final code must be added as a new file in the root folder of your (child)theme. For instance call it ‘tpl-job-dashboard.php’.

    Next create the page and select the ‘Submit Job Form’ template (right hand side).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘multiple job forms’ is closed to new replies.