Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #394735

    Hi,

    I would like to add Google’s Sitelinks Search Box code to homepage (and only to the homepage):
    https://developers.google.com/webmasters/structured-data/slsb-overview

    How can I proceed?

    Cheers,
    Gee Are

    #395273

    Hi Gee Are!

    It looks like they give you all the instructions there.

    For step #2 you can add this to the bottom of your functions.php file to add it to your homepage.

    add_action( 'wp_footer', 'enfold_customization_footer_scripts' );
    function enfold_customization_footer_scripts() {
    ?>
    <script type="application/ld+json">
    {
       "@context": "http://schema.org",
       "@type": "WebSite",
       "url": "https://www.example-petstore.com/",
       "potentialAction": {
         "@type": "SearchAction",
         "target": "https://query.example-petstore.com/search?q={search_term_string}",
         "query-input": "required name=search_term_string"
       }
    }
    </script>
    <?php
    }

    Best regards,
    Elliott

    #451307

    hello
    can you precise your answer
    what function.php are you talking about?
    The function.php ? or
    theme function php (enfold/functions.php)?
    please give an accurate answer
    best regards

    #451308

    Hey!

    Functions.php file of the theme that you can edit in Appearance > Editor tab

    Regards,
    Yigit

    #451312

    Thanks Yigit

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Add Google's Sitelink Search Box to homepage’ is closed to new replies.