[Resolved] How to implement json-ld and microdata.

Home Forums Support [Resolved] How to implement json-ld and microdata.

Home Forums Support How to implement json-ld and microdata.

  • This topic has 15 replies, 2 voices, and was last updated 4 years ago by Tom.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
  • #832988
    Gustavo E.

    Hello how are you friends?
    First congratulate them for the very optimized theme I am very happy with it, I was making its guides, I read all the content of GP, and even the video in VIMEO. They have done it!
    I am with some doubts regarding the subject, the truth that I like a lot, but there are some things that I can not understand.
    – How they apply the MicroData, MetaData and everything related to schema and json-ld.
    – In which part it would be necessary to add it. HEAD of the Home, Head of the pages, Bodies …
    – The post as they should be associated in relation to this already named.
    – I do not know which formats to use I’m dizzy HELP! : d
    I know THAT it may sound like a rookie, but I see that Generate Press has Elementor and it confuses me enough where to include these structures and in what form.
    Thank you very much. Greetings from Argentina.
    PS: I am using translator

    GeneratePress 2.2.2
    GP Premium 1.7.8
    Lead Developer
    Lead Developer

    Hi there,

    Glad you’re enjoying GP!

    GP adds basic microdata by default. The microdata we add is pretty broad, so it applies to most websites.

    If you want to add more specific/complex microdata/JSON-LD, I suggest using a plugin like this: https://wordpress.org/plugins/wp-structuring-markup/

    You can then turn off the default microdata like this:

    add_filter( 'generate_schema_type', '__return_false' );

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

    Let me know if you need more info ๐Ÿ™‚

    Gustavo E.

    Thank you very much Tom!
    Well that step of PHP I did, reading through the forum some articles.

    My main question is to know if I can use the Hooks to apply the Json-Ld, in the part where the Scripts are added.

    I mean making specific hooks for each page and entry. Will it be possible?

    And how should I apply them? Because using that Plugin is very customizable, I’m going to try to see how it works. Because it is a page of sport and training.

    Lead Developer
    Lead Developer

    You can definitely do that if you know enough about JSON-LD. I would place it in the wp_footer hook using the Hook Element: https://docs.generatepress.com/article/hooks-element-overview/

    Then you can use the Display Rules to apply the JSON-LD to specific pages/posts/post types etc..

    Gustavo E.

    Well then Tom! thank you very much …

    In a while I will be applying tests. then there is no limit to HOOKS?

    Could I do them with as many pages as I want, which does not influence the speed of response?

    I have a problem also in question about the menu of the mobile.

    My logo is centered, above the text MENU,
    I will upload a screen if necessary.
    The site I still have it in maintenance while I learn to use well the Theme Gp

    Lead Developer
    Lead Developer

    If you add hundreds of hooks, it could affect your performance. We’re working on some caching ideas to prevent that in the future.

    Where would you want your logo to appear?

    Gustavo E.

    Thanks tom ! I am very active with this but I really want to leave a page that is very pleasant for the user.

    So how should the code issue Json-ld be solved?
    .Because my page is going to be very dynamic with respect to schema I will always vary in structure and micro!
    Will it be that I have to apply it to each personalized page?
    Or could I make a general hook and then edit it in its respective post?

    Well already solved the logo, there was a problem in the element, it was just a question of reviewing the logo without a retina.
    GP has many functions that I am becoming familiar with: D

    Lead Developer
    Lead Developer

    Have you looked at a few JSON-LD plugins? I have a feeling they would be worth it in your case.

    Gustavo E.

    The Plugins do not solve my case.
    I was looking and trying but these do not give me the options that I need from schema, they are very basic.

    I would prefer a way of being able to add them Manually if it exists if not good.

    Edit a plugin is not within my knowledge…

    I’m getting closer and closer to finishing my website, only details remain!

    Lead Developer
    Lead Developer

    If the schema will be completely different for each page, you’ll likely need to make a different hook for each condition.

    If it will be similar for each page, you may be able to use PHP inside the hook to change variables depending on the necessary conditions.

    Gustavo E.

    This is making me give a lot of work!

    (I have no idea how to add that PHP, my knowledge is HTML, basic CSS … and Json-ld)

    There really is no way to add individual SYNTAX of json-ld without the need for an external plugin?

    I’m going crazy for several days without being able to solve it,
    the work is hacking me hahaha. It will be a matter of patience …

    I will continue working looking for the correct form,
    if I find it I notify it, while I remain open to new ideas.

    Thanks TOM

    Gustavo E.

    Searching the web I found maybe a way that could work.
    Maybe with a bit of Orientation it could even be useful
    to add a complement in next versions of GP.

    <? php if (is_single ()) 
    $ js = get_post_meta ($ post-> ID, 'javascript', true);
     if (! empty ($ js)) 
    ?> <script type = "text / javascript"> 
    <? php echo $ js; ?> </ script> <? php}

    That code how could I put it to execute the Json-ld.?
    Could you use custom fields to inject Java ??

    I found this widget plugin that can have
    HTML, CSS, JavaScript, Flash, Shortcodes and / or PHP


    Gustavo E.

    I’m going to test if it works! I will notify you !


    I will put it to the test soon!

    Lead Developer
    Lead Developer

    A plugin like that should definitely help ๐Ÿ™‚

    Gustavo E.

    Step to recommend that this plugin, can provide
    Metadata and Json-LD.
    Default does not execute them, but in their HTML tab. It admits entering these codes.

    A suggestion for further updates, could it be to incorporate something similar to GP? It would be the Themes bomb.

    I think I have already solved it so I close the issue, validating my suggestion to future versions.
    Greetings TOm

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