[Support request] Article CreativeWork schema

Home Forums Support [Support request] Article CreativeWork schema

Home Forums Support Article CreativeWork schema

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #2367402
    Butch Pornebo

    GP has “WP Show Post” article tags that declares via microdata as CreativeWork schema.

    How do I add “@id” property to the microdata so that I can refer back to my WebPage json/ld the I am using.

    The WebPage json/ld has a property of @id = https://postURL/#webpage

    Essential I want the same @id of https://postURL/#webpage into the CreativeWork so that it “links” together with the Webpage schema instead of just floating with no connection.

    Schema Visualization screenshot
    https://postimg.cc/SYC6r6Gg

    #2368460
    Fernando
    Customer Support

    Hi Butch,

    We’ll need a workaround. Try adding the PHP:

    Try this:

    add_filter( 'wpsp_settings', function($settings){
      if(394283 == (int) $settings['list_id']){
        $settings[ 'itemtype' ] .= '" ' . '@id ="' . get_permalink() . '/#webpage"';
      } 
      return $settings; 
    });

    Replace 394283 with the WPSP list.

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    #2369047
    Butch Pornebo

    Replace 394283 with the WPSP list.

    Please elaborate.

    What do you mean “WPSP list”?

    Where do I get this info?

    #2369166
    Ying
    Staff
    Customer Support

    Replace 394283 with the WPSP list ID that you want this to work.

    You can find it at dashboard > WP show posts, all the WP show posts lists have their own unique IDs.

    #2369168
    Butch Pornebo

    Additional information that might unravel how to properly link this microdata to the json/ld @id of the webpage schema type.

    https://www.semrush.com/webinars/schema-markup-as-a-tactic-for-aeo/

    “There are lots of separate ways to use it. And you’ll hear it called @id for JSON-LD, but for anyone that uses microdata, it’s the item id. ”

    https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemid

    “An itemid attribute can only be specified for an element that has both itemscope and itemtype attributes.”

    #2369208
    Butch Pornebo

    I have multiple WPSP list that I want to incorporate this.

    What would be code change to make it to work for multiple WPSP list?

    #2369243
    Butch Pornebo

    Sorry BUT the original suggested workaround did not work.

    Here is the generated result:

    <article class=" wp-show-posts-single wpsp-clearfix post-1926 post type-post status-publish format-standard has-post-thumbnail category-kitchen-cabinets tag-featured" 
    itemtype="http://schema.org/CreativeWork" 
    @id="https://exploreyourkitchen.com/should-i-paint-my-kitchen-cabinets/#webpage" "="" 
    itemscope="">

    I think the @id needs to be itemid. Please see my previous reply.

    also, do you see the “=”” after #webpage right before the itemscope?

    Where that come from?

    Here is the code snippet I used:

    add_filter( 'wpsp_settings', function($settings){
      if(1207 == (int) $settings['list_id']){
        $settings[ 'itemtype' ] .= '" ' . '@id ="' . get_permalink() . '#webpage"';
      } 
      return $settings; 
    });
    #2369334
    Fernando
    Customer Support

    How about something like this?:

    add_filter( 'wpsp_settings', function($settings){
    
       $settings[ 'itemtype' ] .= '" itemid="' . $settings['list_id'];
      
      return $settings; 
    });

    This should add itemid with the unique list_id of the post.

    #2369484
    Butch Pornebo

    I don’t think that will work because I still need the url/#webpage as the itemid

    #2369489
    Butch Pornebo

    what do you think of this tho?

    add_filter( 'wpsp_settings', function($settings){
      if(1207 == (int) $settings['list_id']){
        $settings[ 'itemid' ] = '"' . get_permalink() . '#webpage"';
      } 
      return $settings; 
    });
    #2369494
    Fernando
    Customer Support

    I see. For reference, can you manually provide a sample of your ideal itemid attribute for two articles?

    For instance, itemid="https://exploreyourkitchen.com/should-i-paint-my-kitchen-cabinets/#webpage"? Will the URL be consistent for all articles?

    #2370049
    Butch Pornebo

    For ALL post,

    itemid="https://url-of-a-specific-post/#webpage"

    So, you think this will. right?

    add_filter( 'wpsp_settings', function($settings){
      if(1207 == (int) $settings['list_id']){
        $settings[ 'itemid' ] = '"' . get_permalink() . '#webpage"';
      } 
      return $settings; 
    });
    #2370499
    Fernando
    Customer Support

    I see. If it’s the specific URL of each post, it wouldn’t be possible to inject it to that tag in WP Show Posts through that filter.

    It would be possible if you use GenerateBlocks Query Loop Block.

    Side note: WP Show Posts was merged with GenerateBlocks. Relevant article: https://wpshowposts.com/weve-made-the-decision-to-merge-wp-show-posts-with-generateblocks/

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.