• Resolved pawprintexample

    (@pawprintexample)


    Hey Mike!

    Got everything to work and I entirely forgot that the updates would wipe some settings clean!

    I went ahead and updated the mail subject in the wp-job-manager-template.php, is it possible to copy this file and alter it so it overrides the original and I can keep my changes?

    If not, can you loan me your expertise on getting the Apply Emails to dynamically fill using the job-application.php file?
    Right now my code is –

    <?php if ( $apply = get_the_job_application_method() ) :
    	wp_enqueue_script( 'wp-job-manager-job-application' );
    	?>
    
    <br/>
    
    	<div class="application">
    		<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . get_post_meta( $post->ID, '_job_jobid', true ); ?> &body=Greetings%21%0A%0AThank%20you%20so%20much%20for%20your%20interest%20in%20working%20with%20Digital%20Staffing%21%0APlease%20attach%20your%20resume%20and%20contact%20information%20to%20this%20email%20before%20you%20send%20it%20so%20we%20know%20a%20little%20bit%20about%20you%21%0A%0AFeel%20free%20to%20replace%20this%20text%20with%20a%20cover%20letter%20or%20message%20to%20the%20recruiter%21%0A%0AThank%20you%20again%21%0A%0ADigital%20Staffing%0A%0A" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    
    		<div class="application_details">
    			<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . rawurlencode( $apply->subject ); ?>" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    		</div>
    	</div>
    <br/>
    
    <?php endif; ?>

    Which is working quite fantastically minus of course my subject line being not what I wanted!

    Thank you!!!

    https://ww.wp.xz.cn/plugins/wp-job-manager/

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

    (@mikejolley)

    Yes; move that template file into your theme. See https://wpjobmanager.com/document/template-overrides/

    You can also change the subject without editing templates: https://wpjobmanager.com/document/tutorial-changing-default-email-application-subject-line/

    Thread Starter pawprintexample

    (@pawprintexample)

    You sir, are my Hero!

    Thank you so much!

    Thread Starter pawprintexample

    (@pawprintexample)

    I’m finding that using the filter doesnt allow you to put in get_post_meta for my custom JOB ID filter or call the Job Title

    I’m looking at the first method but it’s all greek… hmmm

    Thread Starter pawprintexample

    (@pawprintexample)

    Oh dear, looks as if I’ve gotten myself in a pickle!

    I have the Apply button code in two different templates and the filter is only applying itself to one and wiping out the other..

    I am by no means a master coder but feel i can work my way around a piece of code pretty well..

    ive never heard of “Using a localisation file and translating the string”, i’m going to look into that for sure – just so i’m clear, wp-job-manager-template.php located in the root plugin folder cannot be written over by copying it to my theme folder?
    This is how I edited the subject in the first place :/

    Thread Starter pawprintexample

    (@pawprintexample)

    Im so sorry for the many messages i feel stupid, i think the first method is just for the language…

    Thread Starter pawprintexample

    (@pawprintexample)

    In the wp-job-manager-template.php, i want to utilize this function:

    /**
     * get_the_job_application_method function.
     *
     * @access public
     * @param mixed $post (default: null)
     * @return object
     */
    function get_the_job_application_method( $post = null ) {
    	$post = get_post( $post );
    	if ( $post->post_type !== 'job_listing' )
    		return;
    
    	$method = new stdClass();
    	$apply  = $post->_application;
    
    	if ( empty( $apply ) )
    		return false;
    
    	if ( strstr( $apply, '@' ) && is_email( $apply ) ) {
    		$method->type      = 'email';
    		$method->raw_email = $apply;
    		$method->email     = antispambot( $apply );
    		$method->subject   = apply_filters( 'job_manager_application_email_subject', sprintf( __( 'New Resume Submittal for %s / "%s"', 'wp-job-manager' ), $post->_job_jobid, $post->post_title ) );
    	} else {
    		if ( strpos( $apply, 'http' ) !== 0 )
    			$apply = 'http://' . $apply;
    		$method->type = 'url';
    		$method->url  = $apply;
    	}
    
    	return apply_filters( 'the_job_application_method', $method, $post );
    }

    The above filter provides me a subject similar to:
    New Resume Submittal for CUSTOM_JOB_ID / “JOB_TITLE”

    I really want to take PHP classes to learn how to do this on my own (is that what I need? PHP classes??)

    I have the application code in two different places, content-single-job-listing.php, and job-application.php, both in my theme folder copied from the plugin folder – they work perfectly!

    <div class="application">
    		<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . get_post_meta( $post->ID, '_job_jobid', true ); ?> &body=Greetings%21%0A%0AThank%20you%20so%20much%20for%20your%20interest%20in%20working%20with%20Digital%20Staffing%21%0APlease%20attach%20your%20resume%20and%20contact%20information%20to%20this%20email%20before%20you%20send%20it%20so%20we%20know%20a%20little%20bit%20about%20you%21%0A%0AFeel%20free%20to%20replace%20this%20text%20with%20a%20cover%20letter%20or%20message%20to%20the%20recruiter%21%0A%0AThank%20you%20again%21%0A%0ADigital%20Staffing%0A%0A" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    
    		<div class="application_details">
    			<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . rawurlencode( $apply->subject ); ?>" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    		</div>
    	</div>

    I need to get that function to apply for both if i copy it short of having to overwrite the updated file with the entire custom wp-job-manager-template.php

    I thank you so much for any help you can provide!!

    Plugin Author Mike Jolley

    (@mikejolley)

    Just so I understand, you want to change get_the_job_application_method() so you can modify the subject to include your custom job ID and title?

    I don’t think you need to. Your second template change where you’ve manually changed the subject and added body is enough. By doing this, the subject in get_the_job_application_method() isn’t used – as long as that code/file is in your theme it should be safe from updates to the plugin.

    Thread Starter pawprintexample

    (@pawprintexample)

    Okay so I copied the wp-job-manager-template.php to my theme folder but the changes didnt seem to stick – can we only overwrite files in the templates folder?

    I think i see what you mean, here is where i’m stuck, in my job-application.php template file, i have the subject pulling from the original template file – how do I alter the subject in the template file to reflect the changes I need? The filter doesnt allow me to dynamically fill anything :/

    ( 'New Resume Submittal for %s / "%s"', 'wp-job-manager' ), $post->_job_jobid, $post->post_title ) )

    would produce

    New Resume Submittal from Job ID 1234 / Testing Job Title

    Thank you thank you thank you again!! Here is the code I have in my template file:

    <div class="application2">
    		<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . rawurlencode( $apply->subject ); ?> &body=Greetings%21%0A%0AThank%20you%20so%20much%20for%20your%20interest%20in%20working%20with%20Digital%20Staffing%21%0APlease%20attach%20your%20resume%20and%20contact%20information%20to%20this%20email%20before%20you%20send%20it%20so%20we%20know%20a%20little%20bit%20about%20you%21%0A%0AFeel%20free%20to%20replace%20this%20text%20with%20a%20cover%20letter%20or%20message%20to%20the%20recruiter%21%0A%0AThank%20you%20again%21%0A%0ADigital%20Staffing%0A%0A" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    
    		<div class="application_details">
    			<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . rawurlencode( $apply->subject ); ?>" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    		</div>
    	</div>
    Plugin Author Mike Jolley

    (@mikejolley)

    No, don’t copy that file across – as I said above, your changes to job-application.php are enough. So copy job-application.php across, and change the subject/body again. Your previous snippet has it modified, whilst your latest snippet does not.

    Leave get_the_job_application_method() and wp-job-manager-template.php alone for now.

    Thread Starter pawprintexample

    (@pawprintexample)

    The first is from the template I shouldn’t be editing

    Just need to figure out how to edit the right file

    Plugin Author Mike Jolley

    (@mikejolley)

    This one you posted earlier:

    <div class="application">
    		<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . get_post_meta( $post->ID, '_job_jobid', true ); ?> &body=Greetings%21%0A%0AThank%20you%20so%20much%20for%20your%20interest%20in%20working%20with%20Digital%20Staffing%21%0APlease%20attach%20your%20resume%20and%20contact%20information%20to%20this%20email%20before%20you%20send%20it%20so%20we%20know%20a%20little%20bit%20about%20you%21%0A%0AFeel%20free%20to%20replace%20this%20text%20with%20a%20cover%20letter%20or%20message%20to%20the%20recruiter%21%0A%0AThank%20you%20again%21%0A%0ADigital%20Staffing%0A%0A" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    
    		<div class="application_details">
    			<?php if ( $apply->type == 'email' ) : ?>
    				<a href="mailto:<?php echo $apply->email . '?subject=' . rawurlencode( $apply->subject ); ?>" class="jbapplybutton" target="_blank">Apply via Email!</a>
    			<?php endif; ?>
    		</div>
    	</div>

    Is from a template file (job-application.php) so thats fine to edit, via your theme. Move it to yourtheme/wp-job-manager/ and edit away.

    Thread Starter pawprintexample

    (@pawprintexample)

    That one pulls the subject from the main template file I just need to figure out how to edit the code to get the right subject string.

    Thread Starter pawprintexample

    (@pawprintexample)

    I know it’s get post meta something then the title is echo post I think

    Plugin Author Mike Jolley

    (@mikejolley)

    Ok.

    I think it needs to be something like:

    <a href="mailto:<?php echo $apply->email; ?>?subject=<?php printf( "New Resume Submittal for %s / "%s", get_post_meta( $post->ID, '_job_jobid', true ), $post->post_title  ); ?>&body.....

    That gives you the subject you want.

    Thread Starter pawprintexample

    (@pawprintexample)

    You never cease to amaze me mike thank you!

Viewing 15 replies - 1 through 15 (of 21 total)

The topic ‘Editing wp-job-manager-template.php’ is closed to new replies.