• Resolved londontechy

    (@londontechy)


    Hi there,

    I am using your plugin on my site http://www.boolerang.co.uk. it is great, so thanks.

    I have a site wide description, and am adding custom descriptions for the pages where it is useful. However, for one of the pages I wish to add a custom description to, the custom description is not being recognised. Instead, it is just using the general, site-wide description. The custom title is also not being pulled in.

    The specific page is located at http://www.boolerang.co.uk/jobs

    Might deleting/reinstalling the plugin help? Deactivating/reactivating didn’t solve the issue. Your guidance will be much appreciated.

    Thanks,

    Ed

    https://wordpress.org/plugins/add-meta-tags/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author George Notaras

    (@gnotaras)

    @londontechy

    Hi Ed,

    Most probably this is happening because the plugin does not retrieve the correct post object for that page. The plugin uses WP API’s get_queried_object() function to retrieve the relevant post object, so there is no bug involved. What happens is that in case of this specific page the object returned by that API function is not the correct one.

    One possible solution would be to figure out a way to retrieve the correct object programmatically and then pass it to Add-Meta-Tags with the following snippet:

    function my_jobs_page_post_object(){
        // Here get the ID of the correct post object for that page
        // And use it to get the relevant post object and return it.
        return get_post($jobs_page_id);
    }
    add_filter('amt_get_queried_object', 'my_jobs_page_post_object');

    If something like that is not possible, then I’m afraid you will have to manually filter and edit the metadata on that page. Please, feel free to ask for more help about that, if needed.

    May I ask how is that page generated? Do you use a plugin or a specific page template?

    Kind Regards,
    George

    Plugin Author George Notaras

    (@gnotaras)

    Hey Ed,

    From what I see you have found another plugin that works with your page. So, I’m going to close this topic.

    Kind Regards,
    George

    Plugin Author George Notaras

    (@gnotaras)

    BTW, I installed WP Job Manager and the custom description and custom title work as expected and out of the box with Add-Meta-Tags on the jobs page. Also, I did some research about WP-Job-Manager and it turns out it uses normal WordPress custom post types, so it should work with AMT without any special configuration.

    Not sure though what is wrong with your page and I’m really out of ideas.

    George

    Thread Starter londontechy

    (@londontechy)

    Hi George,

    Very sorry for the lack of response, been so hectic recently!

    I did install Yoast SEO, but just found it overwhelmingly heavy and excessive, so I’m back with yours! I missed it too bad, plus I still couldn’t solve the meta issue with that! It’s so strange, the custom title and description works for every other page!

    So in answer to your question: It is generated using a shortcode [jobs]. I can find out the ID of the page if that will help? Your previous response was a little beyond me!

    Thanks,

    Ed

    Plugin Author George Notaras

    (@gnotaras)

    Hi Ed,

    No problem for the lack of reply and also absolutely no problem for using another plugin.

    I installed WP Job Manager and let it create its pages, but I could not replicate the issue. The custom title and description worked as expected on the jobs page.

    Kind Regards,
    George

    PS: Indeed, my previous response was a little confusing. It was based on another case I had in mind (AnsPress plugin) and thought we had to deal with the same issue here as well. I was wrong about that.

    Plugin Author George Notaras

    (@gnotaras)

    I also created an alternative page, added the [jobs] shortcode and the custom title/description also worked on this alternative jobs page. I’m really out of ideas about this..

    Thread Starter londontechy

    (@londontechy)

    I also received this comment from WP Job Manager, which may be important:

    This one however ‘Jobs Archive | Boolerang”., is a post type archive. There is a special section in Yoast SEO to change this.

    Plugin Author George Notaras

    (@gnotaras)

    In this case the page is not generated by the [jobs] shortcode, but it is the job post type’s archive. In this case, there is no post object specific for the archive, but the post object that is returned on this page is AFAIK the post object of the first post (job) listed in the archive.

    In this case, you can use the following to set a custom description for the post type archive:

    function amt_my_custom_post_type_archive_description( $default ) {
        return 'This is my custom post type archive description';
    }
    add_filter('amt_generic_description_posttype_POSTTYPESLUG_archive', 'amt_my_custom_post_type_archive_description');

    The POSTTYPESLUG must be replaced by the slug of the job post type.

    For the title, you can use WordPress’ document_title_parts filter hook to filter the title and set it as you see fit. Please also see this: https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/

    Alternatively, you can enable the Advanced title management’ feature in the add-meta-tags settings and customize the title of the jobs archive using a template: http://www.codetrax.org/projects/wp-add-meta-tags/wiki/Advanced_Title_Management You will need templates like the following:

    // Custom Post Type Archives
    'archive_posttype_POSTTYPESLUG'        => '#entity_title# Archive | #site_name#'
    'archive_posttype_POSTTYPESLUG_paged'  => '#entity_title# Archive | Page #page# | #site_name#'

    Hope this helps with your experimentation.

    For more specific help, please provide the exact details about how the jobs page is generated, because currently the information is not very clear.

    Due to lack of free time it might a while to get back to you. Please check all the above customization possibilities and see which better fits your needs.

    Kind Regards,

    George

    Plugin Author George Notaras

    (@gnotaras)

    This one however ‘Jobs Archive | Boolerang”., is a post type archive.

    By the way, your page is not titled ‘Jobs Archive’, but ‘Jobs’, which makes me think that this is not the post type’s archive, but a job listing generated by the [jobs] shortcode. Then again, I am out of ideas why the page’s custom title and description do not show up. This should not be happening, which makes me think that some special customization takes place.

    My recommendation is this:

    1. Create a new Page
    2. Enter the title you want
    3. Add [jobs] as the content
    4. Add custom description
    5. Publish and check if everything works as expected.
    6. Then check back the original ‘jobs’ page to see what might be different with it.

    I’m afraid there is nothing more I can do or think about this issue.

    Best Regards,
    George

    Thread Starter londontechy

    (@londontechy)

    Hi George.

    Ok so, I’ve realised that whenever the URL is x/jobs this is a post archive.

    I would just create a new page and use X/roles, but unfortunately there are too many hard-coded links dotted around that would fail.

    My response from the author did suggest there was a section to change SEO information for post archives in Yoast SEO. Is this possible in AMT?

    Thanks,

    Ed

    Plugin Author George Notaras

    (@gnotaras)

    Hi Ed,

    Please let me understand this. You keep mentioning the section of the web interface of another plugin and I am confused about what exactly you are looking for. A web interface for this type of customization? AMT does not have one and there are no plans to implement one. Instead, it is possible to programmatically change the generic descriptions AMT adds to archives as I’ve explained above.

    I did some testing but I cannot configure WP-Job-Manager to return the jobs archive under the /jobs/ path. Please provide me with step-by-step instructions so I can replicate it.

    The necessary code to customize the description and also the title of the archive (only if ‘Advanced Title Management’ has been enabled in the AMT settings) is the following:

    function amt_jobs_archive_description( $default ) {
        return 'This is my custom description of the jobs archive!';
    }
    add_filter('amt_generic_description_posttype_job_listing_archive', 'amt_jobs_archive_description');
    
    // Title templates for the title element
    function amt_titles_custom_title_element_templates_for_jobs_archive($templates) {
        $templates['archive_posttype_job_listing'] = '#entity_title# Archive | #site_name#';
        $templates['archive_posttype_job_listing_paged'] = '#entity_title# Archive | Page #page# | #site_name#';
        return $templates;
    }
    add_filter('amt_titles_title_element_templates', 'amt_titles_custom_title_element_templates_for_jobs_archive');
    
    // Title templates for the metadata
    function amt_titles_custom_metadata_title_templates_for_jobs_archive($templates) {
        $templates['archive_posttype_job_listing'] = '#entity_title# Archive | #site_name#';
        $templates['archive_posttype_job_listing_paged'] = '#entity_title# Archive | Page #page# | #site_name#';
        return $templates;
    }
    add_filter('amt_titles_metadata_title_templates', 'amt_titles_custom_metadata_title_templates_for_jobs_archive');

    If ‘Advanced Title Management’ has not been enabled in the AMT settings, then AMT has nothing to do with the titles of archives. You will have to customize the title of the jobs archive using the default filter hooks of WordPress as I explained in a previous message above.

    Please let me know if the above code snippet does the job. Otherwise please provide me with instructions to replicate your setup.

    That’s the best I can do for this issue. πŸ™‚

    Best Regards,
    George

    Plugin Author George Notaras

    (@gnotaras)

    In the snippet above, POSTTYPESLUG has been replaced with job_listing as this seems to be the custom post type for jobs in WP Job Manager.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Can't Add Description/Title to Specific Page’ is closed to new replies.