chrisblues
Forum Replies Created
-
Thanks for your reply! Yea, that’s the tough part, to let WP know, what to do with that query-string.
We’re finally making progress over at stackexchange! So I have in functions.php:
// Adding the id var so that WP recognizes it function SH_insert_query_vars( $vars ) { array_push( $vars, 'objekt_id' ); return $vars; } add_filter( 'query_vars', 'SH_insert_query_vars' ); // define rewrite rule function SH_objekt_id_rewrite_tag_rule() { add_rewrite_rule( '^objects/details/([^/]*)/?', 'index.php?page_id=860&objekt_id=$matches[1]', 'top' ); } add_action( 'init', 'SH_objekt_id_rewrite_tag_rule' );
Cudos to @butlerblog for bringing me on the right track!
Cheers!
By the way, this question is also listed on stackexchange: wordpress.stackexchange.com
I’m still unclear, how this works. So I marked this thread as unresolved. Thanks for the heads-up!
My temporary solution was to unhide the field “company_name” by removing it from the function I found in functions.php, so that the users could fill in that field by themselves. Not very satisfying but at least it works! :o)
All the methods above seem to either remove the form-fields from the plugin’s admin page, or the last attempt in my last post would seem to do something unexpected, well it does nothing. I couldn’t find where that would fit in the processing of WPJM. I have the feeling, that
$fields['company']['company_name']['value'] = 'Foo Bar';
would insert the value at saving time, though it never worked actually.
Would it be possible to inject some value at display time? When it is rendered to the website visitors?One thing, that seems odd is the leading underscores at all the fields keys. Is that right?
And wouldn’t this function be a good place to inject the company name? Sth like this:
function remove_job_form_fields($fields) { //unset( $fields['_job_location'] ); unset( $fields['_application'] ); //unset( $fields['_company_name'] ); $fields['_company_name'] = "Foo Bar"; unset( $fields['_company_website'] ); unset( $fields['_company_tagline'] ); unset( $fields['_company_twitter'] ); unset( $fields['_company_logo'] ); unset( $fields['_company_video'] ); unset( $fields['_filled'] ); unset( $fields['_featured'] ); unset( $fields['_job_author'] ); return $fields; } add_filter('job_manager_job_listing_data_fields', 'remove_job_form_fields');
Though on the snippets page, the arrays seem to be much deeper:
$fields['company']['company_logo']['value'] = 'full_url_to_the_logo';
So maybe that would translate to something like:
$fields['company']['company_name']['value'] = 'Foo Bar';
Thanks for following up on this!
I found this in functions.php:
function remove_job_form_fields($fields) { //unset( $fields['_job_location'] ); unset( $fields['_application'] ); unset( $fields['_company_name'] ); unset( $fields['_company_website'] ); unset( $fields['_company_tagline'] ); unset( $fields['_company_twitter'] ); unset( $fields['_company_logo'] ); unset( $fields['_company_video'] ); unset( $fields['_filled'] ); unset( $fields['_featured'] ); unset( $fields['_job_author'] ); return $fields; } add_filter('job_manager_job_listing_data_fields', 'remove_job_form_fields');
This seems to be, what I was looking for. There are a few questions arising:
Why would anyone do that? I mean, might there be some technical reason I’m not aware of?
If I injected these variables some place with some hard-coded value (like company_name wouldn’t change anyway), where would be a good place for that?
Thanks for all your help!
Best regards
chrisDear Richard,
For the moment I’m busy with other things, so I have set this one aside for the time being. I have reinstalled WPJM to no avail (I copied the files by hand/ftp to the server).
Switching default themes was out of the question. There is no sandbox for me to play with. But I’ll be coming back to this, as soon as time allows.
————————–
I’m not quite sure, Job Tags is already installed. I have proposed it for installation, but I don’t see it listed in the WP installed plugins page. So I guess it’s not active yet.
And no, I haven’t contacted you guys via email / ticket service. The only question I have posed so far is here.
Thanks for asking anyway.
May life be good to you people! ??
Well I’m getting desperate! I just tried that, to see if that file even gets loaded at all. And it seems it doesn’t. No var_dump() or print_r() shows up in the page. Either the variables are empty, which would result in an empty pre block (which isn’t there), or this file is not being read at all…
And a scan of the wordpress installation revealed no other file with that name (like a theme override).
I just checked the server, there’s only this one file in the installation by the name of job-submit.php :
wp-content/plugins/wp-job-manager/templates/job-submit.phpOk. So I think, we’re getting somewhere. I’ve just added a
<pre><?php print_r($company_fields, true); ?></pre>
to wp-content/plugins/wp-job-manager/templates/job-submit.php .
It seems, this file doesn’t get loaded! It never shows any pre sections. Where could I look for other instances?
Here’s the file in its entirety:
<?php /** * Content for job submission (<code>[submit_job_form]</code>) 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.32.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } global $job_manager; ?> <h1>$company_fields</h1><pre><?php print_r($company_fields, true); ?></pre> <form action="<?php echo esc_url( $action ); ?>" 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="?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' ); ?> <?php foreach ( $job_fields as $key => $field ) : ?> <fieldset class="fieldset-<?php echo esc_attr( $key ); ?>"> <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'] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label> <div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>"> <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', array( '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 ); ?>"> <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'] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label> <div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>"> <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', array( '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 ); ?>" /> <span class="spinner" style="background-image: url(<?php echo esc_url( includes_url( 'images/spinner.gif' ) ); ?>);"></span> </p> <?php else : ?> <?php do_action( 'submit_job_form_disabled' ); ?> <?php endif; ?> </form>
- This reply was modified 5 years, 6 months ago by chrisblues.
- This reply was modified 5 years, 6 months ago by chrisblues.
- This reply was modified 5 years, 6 months ago by chrisblues.
Well, I never touched the templates in wp-content/plugins/wp-job-manager/templates.
Also there are no overrides in wp-content/themes.Which template exactly are we looking for?
I have ‘Advanced custom fields’ but no ‘WP Job Manager Field Editor’. As far as I can tell, I only have the 2 before mentioned addons related to WPJM.
- Job Tags
- Google Indexing API for WP Job Manager
If I have removed the fields, I certainly am not aware how! Actually I really have done nothing special up onto here. I have some jobs in the list (these were added by some other department), and I added the WP_shortCode [jobs] and [jobs location=”foo”]. That’s about it!
Only thing is, I updated the WPJM plugin before adding the Google addon.
I have been fiddling with that Google API thing, but after a first glance, I decided to wait with that until everything else runs smoothly.
It’s really funny, since all the other fields get some values assigned, just the company name is missing. And yet, most of the fields in the admin interface are not showing up.
I’m not sure, I understand you correctly. I see nothing in the web-console of Firefox. Did you mean that? In WP I can’t find no console.
Which template do you mean? The one in the admin page? I never touched that.
Where are all your job fields?
Yeah, that’s the question. Maybe that’s related to the wp-job-manager addons I have installed? That’s:
- Job Tags
- Google Indexing API for WP Job Manager
- This reply was modified 5 years, 6 months ago by chrisblues.
- This reply was modified 5 years, 6 months ago by chrisblues.
Ah, that explains that. Thanks Richard, now I know that I’m not blind! In my instance, this field and some more are missing! See: here
How could that have happened?