Support » Plugin: Schema & Structured Data for WP & AMP » CPT issue with ‘name field’

  • Thanks for your cool plugin.

    I might need a hard-coded fix

    For some reason I cannot figure out, for a custom post type when using schema type localbusiness the name field will not get generated into the code.

    google testing tool flags name field as missing.

    I have tried manually, using modify “title”, and advanced custom field – none will show it

    regular post types display fine

    troubleshooting has taken not hours, not days, but we’re into weeks of hit and miss …. finding the reason seems impossible.

    I am so desperate I’d like to hard code using a functions.php snippet or some other method to force the name field to use post_title

    is that possible? and what might that snippet be…

    THANKS

Viewing 8 replies - 1 through 8 (of 8 total)
  • just to clarify — this is the Business Name field

    I would be happy to edit the plugin php file (and just edit each update) if a functions.php snippet would be too complicated

    I looked at output.php and output_post_specific.php but I’m sort of at a loss as to what to edit

    THANKS

    Plugin Support Sanjeev Kumar

    (@sanjeevsetu)

    Hi there!

    Thank you for using our plugin.

    We have tested it again for you on custom post type and regular post. We found that it is working fine. Can you please know us, How are you creating custom post type, Using any plugin or registering your own post type?

    thanks for replying

    it is a directory plugin – directories pro. I’m not creating the CPT

    there’s a conflict somehow/someway. this isn’t the only plugin that directory plugin causes problems with – but its a good plugin

    impossible to get directories pro author to do anything

    my solution is to hard code using post_title or a ACF field would be even better but need to circumvent the regular process — it will solve my problem completely. I looked at output.php and I just don’t know enough PHP to figure out how to write a function or simply edit plugin php files

    would really appreciate how to do that, thanks

    wasanajones

    (@wasanajones)

    still holding out hope on a trick snippet to hard code using post_title or a custom field

    thanks

    Plugin Support Sanjeev Kumar

    (@sanjeevsetu)

    Hi there!

    Ok, There are two options which you can do to meet your requirments.

    1. You can use our filter like this and can modify output for local business

    add_filter(‘saswp_modify_local_business_schema_output’, ‘saswp_local_business_modification’)

    function saswp_local_business_modification($input1) {
    // here modify the array as per your need
    return $input1;
    }

    2. This is the function named which output localbusiness schema inside output/functions.php (saswp_local_business_schema_markup).
    Here, you can hardcode

    Hope this helps you.

    wasanajones

    (@wasanajones)

    Hi –

    thanks for the hints but I really don’t know what to do with that regarding how to force name field to use either post_title or a custom field

    output.php has a line that looks like this
    $business_name = get_post_meta($schema_post_id, 'saswp_business_name', true);

    which seems like something like that would be what to change, but I just don’t know what/how/where

    regards

    Ahmed Kaludi

    (@ahmedkaludi)

    can you try to test that url and share the results of that testing page?

    wasanajones

    (@wasanajones)

    @ahmedkaludi not sure what you mean.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘CPT issue with ‘name field’’ is closed to new replies.