• Resolved chrisblues

    (@chrisblues)


    Hi there!

    I hope I’ve hit the right forum for this. My apologies if not!

    WP job manager : Version 1.32.3
    running on WordPress 5.1.1 (I know it should be updated, but I’m not in charge of that)

    I’m trying to get the Google Jobs right. The google console complains about the field hiringOrganisation.name being empty. And looking at the generated output, it’s true! Here’s what WP-Job-Manager puts out: (I shortened it to the relevant section)

    "hiringOrganization":
        {
            "@type":"Organization",
            "name":""
        },

    You can see the full output at the bottom of the HTML of the linked page.

    Since it will never change all over the page, I thought, maybe I can just set this property somewhere. But haven’t had much success finding the right spot.

    Where can I set that variable? The plugin’s settings page doesn’t show any fields, that might be related. The job’s settings also have no corresponding field.

    I guess I’m missing the obvious here, since I seem to be the first to stumble upon that…

    Other than that, the plugin runs nicely and does, what it’s supposed to. :o)

    Well, thanks in advance for any pointers you people may have!

    Cheers
    chris

    The page I need help with: [log in to see the link]

Viewing 13 replies - 16 through 28 (of 28 total)
  • And the <pre> won′t work the way you′vem added it, cause it need to be placed inside the <? php

    • This reply was modified 5 years, 6 months ago by braehler.
    Thread Starter chrisblues

    (@chrisblues)

    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).

    Switch temporary to a default theme and have a look if the fields come back. Otherwise, get a fresh copy of the wpjm from github and install it again. bet do this on a staging site

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Job Tags

    If you have our Job Tags add-on, you can get support from us via email as well:

    https://wpjobmanager.com/support/

    In fact, I believe you may have contacted us already? Can you let me know if you have or not, and what ticket number you have if so?

    Thread Starter chrisblues

    (@chrisblues)

    Dear 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! ??

    Yeah sounds like your theme or custom code is removing fields, check the functions.php file in your main theme, basically it uses company name as mentioned previously:

    https://github.com/Automattic/WP-Job-Manager/blob/master/wp-job-manager-template.php#L390

    Plugin Contributor Richard Archambault

    (@richardmtl)

    @tripflex yup, that’s basically what I said 2 weeks ago ??

    Thanks for confirming and the additional advice!

    Thread Starter chrisblues

    (@chrisblues)

    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
    chris

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi Chris!

    That’s exactly what would do it, indeed!

    Why would anyone do that? I mean, might there be some technical reason I’m not aware of?

    Hmm, the only thing I can think of is that the theme author was intending the theme to be used for something other than companies submitting jobs? That kind of makes sense, because it appears that the jobs are all for the same organization, right? That’s about all I can come up with!

    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?

    Have a look at this snippet, which shows how to set a default value for a field:

    https://wpjobmanager.com/customization-snippets/#prefillcomplogo

    Thread Starter chrisblues

    (@chrisblues)

    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';

    Plugin Contributor Richard Archambault

    (@richardmtl)

    I’m marking this thread as Resolved as it’s been more than a month since the last reply. If you still need help, please do reply again and mark the thread as Unresolved!

    Thread Starter chrisblues

    (@chrisblues)

    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?

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi Chris,

    To be frank, I don’t know what it is you are asking for anymore. The original issue was being caused by your theme, I think we’re in agreement about that. And now you say that things work since you edited the functions.php file in your theme. So, I’m not sure what you’re asking for anymore, sorry!

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘How to set a field for google scraping: “hiringOrganisation.name”’ is closed to new replies.