[Resolved] Code Snippet Query

Home Forums Support Code Snippet Query

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1161985
    Michael

    Hi guys,

    Please can you help me work out what I am doing wrong with this snippet to add FAQ schema to my FAQ page? I have saved and activated it, but when I click View Source, I do not see the markup inserted anywhere in the page, which makes me think I have used incorrect code! Here is the code in question:

    function mm_add_faq_schema() { 
    if(is_page ("447")){ 
    ?> 
    <script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What Wood Do You Use?","acceptedAnswer":[{"@type":"Answer","text":"<p>We use <a href=https://en.wikipedia.org/wiki/Reclaimed_lumber rel=noopener target=_blank>Reclaimed Wood</a>, gathered from various local sources and lovingly restored to a beautiful finish. In the case of pallet wood, we only use <a href=https://www.kampspallets.com/heat-treated-pallets/ rel=noopener target=_blank>Heat Treated Wood</a>. We don't make use of pallets treated with <a href=https://www.epa.gov/ods-phaseout/methyl-bromide rel=noopener target=_blank>Methyl Bromide</a> or any other chemical, so the wood is <em>safe to use in your home</em>.</p>"}]},{"@type":"Question","name":"What Is Reclaimed Wood?","acceptedAnswer":[{"@type":"Answer","text":"<p><a href=https://en.wikipedia.org/wiki/Reclaimed_lumber rel=noopener target=_blank >Reclaimed Lumber</a> is wood that has been thrown out or otherwise discarded. We take that wood to <em>minimize environmental wastage</em> and turn it into our <em>elegant room decor</em> to add flair your <em>dining room</em>, <em>kitchen design</em> or <em>living rooms</em>. To find out more <a href=https://www.reclaimdesign.org/newsletter-sign-up.html>Join Our Mailing List</a> and get the latest <em>sustainable home decor ideas</em>.</p>"}]},{"@type":"Question","name":"Why Do You Use Reclaimed Wood For Your Home Decor And Decorative Accessories?","acceptedAnswer":[{"@type":"Answer","text":"<p>Our <em>decorative home accessories</em> are made from <a href=https://en.wikipedia.org/wiki/Timber_recycling rel=noopener target=_blank>Salvaged Wood</a> (and where possible recycled plastic and glass) that would otherwise go to landfill, thus <em>reducing the need to cut living trees</em> to obtain the wood whilst simultaneously <em>actively decreasing environmental waste</em>.</p>\n          \t<p>Furthermore, the wood has already gone through the heavy industrial milling processes to create the original product thereby <em>negating the need for further pollution of the environment</em>. And we <em>source the wood locally</em> thus keeping transportation energy used to a minimum.</p>\n            <p>We feel that the idiosyncrasies found in reclaimed wood help tell the story behind our products, lend them character and make our <em>home decor unique</em>.</p>"}]},{"@type":"Question","name":"Do You Have A Physical Shop?","acceptedAnswer":[{"@type":"Answer","text":"<p>In a word, no. But we do have our <a href=https://www.reclaimdesign.org/home-decor-shop.html>home decor online</a>, selling a range of our <em>courier-friendly</em> items. All our awesome <em>eco friendly products</em> are also stocked up at home, and you are welcome to come and <a href=https://www.reclaimdesign.org/contact.html>buy directly from us</a> there.</p>"}]},{"@type":"Question","name":"Why Aren't All Your Products Available In Your Online Shop?","acceptedAnswer":[{"@type":"Answer","text":"<p>Due to the nature of the materials we work with many of our pieces are <em>limited edition</em>. Our <a href='https://www.reclaimdesign.org/home-decor-shop.html'>Shop Page</a> lists our <em>replicable, courier-friendly products</em>. If you would like us to make a <em>bespoke</em> piece please <a href='https://www.reclaimdesign.org/contact.html'>get in touch</a>.</p>"}]},{"@type":"Question","name":"Do You Wholesale?","acceptedAnswer":[{"@type":"Answer","text":"<p>As we are a small <em>home decor store</em> (Nikki and I make all the products ourselves by hand), we cannot fulfill bulk orders or offer discounts.</p>"}]},{"@type":"Question","name":"Will You Make Something For Me?","acceptedAnswer":[{"@type":"Answer","text":"<p>Sure, why not. <a href=https://www.reclaimdesign.org/contact.html>Get In Touch</a> with us and tell us what you need for your living space.</p>"}]},{"@type":"Question","name":"What Is The Process Involved In Making Your Home Decor?","acceptedAnswer":[{"@type":"Answer","text":"<p>It's time consuming and laborious ;) But we believe it's worth it as we are taking what has been thrown away to breath new life into it, thereby <em>actively decreasing <a href=https://en.wikipedia.org/wiki/Waste rel=noopener target=_blank>Environmental Waste</a></em> and helping the planet at large.</p>\n<p>We have to scour far and wide looking for <em>reclaimed wood</em>, transport the suitable wood back to us, de-nail, de-staple, de-screw, de-cement, de-paint, de-varnish, and de-gravel the wood, plane it to consistent thickness, mill it to size, make our products using a wide variety of woodworking tools, then carefully sand and finish with <a href=https://en.wikipedia.org/wiki/Shellac rel=noopener target=_blank>Shellac</a> or <a href=https://woodoc.com/en/products/woodoc-5-indoor-polywax-sealer-matt rel=noopener target=_blank>Polywax</a> where appropriate.</p>\n<p>For our other <a href=https://www.reclaimdesign.org/sitemap.html>Recycled Products</a> using plastic and glass we are constantly on the lookout for materials to create innovative products with and make frequent trips around town and surrounds to that end.</p>"}]},{"@type":"Question","name":"When Is Your Next Market?","acceptedAnswer":[{"@type":"Answer","text":"<p>Our <a href=https://www.reclaimdesign.org/blog>Blog</a> has a list of future events available and lots of useful information on <em>sustainability</em>. Alternatively, you can have our events info <a href=https://www.reclaimdesign.org/newsletter-sign-up.html>Delivered To Your Inbox</a>. Or, if you are on Facebook, then head over to our <a href=https://www.facebook.com/reclaimdesignza target=_blank rel=noopener>Reclaim Design Business Page</a> to be kept in the loop that way.</p>"}]},{"@type":"Question","name":"Can I Put Your Products Outside?","acceptedAnswer":[{"@type":"Answer","text":"<p>Generally speaking we make our <em>home decor products</em> for interior use. However the <em>garden products</em> we make can be put outside. Bear in mind that South African sun is intense, so the wood will weather and turn grey over time.</p>"}]},{"@type":"Question","name":"How Should I Care For My Plants?","acceptedAnswer":[{"@type":"Answer","text":"<p><em>Airplants</em> and <em>succulents</em> are an interior designer dream. They are wonderful plants which require very little maintenance, and are quite hard to kill (unless you are hell-bent on doing so).</p>\n<p>Our <a href=https://www.reclaimdesign.org/reclaimed-wood-air-plant-displays.html>Airplant Displays</a> and <a href=https://www.reclaimdesign.org/reclaimed-wood-succulent-displays.html>Succulent Displays</a> are made for indoor usage so these instructions apply to that specific set of conditions. With a minimum of effort to keep the plants happy they will last a long time and give you something magnificent to look at and enjoy during that time.</p>\n<p><em>Airplants</em> like bright, <em>natural light</em>. You can run them under the tap once a week and shake off any excess water before returning them to their stand. A good idea is to keep them in your bathroom so that when you shower they can absorb any humidity generated.</p>\n<p><em>Succulents</em> also like bright, filtered light. Do not leave in direct sunlight as the leaves can scorch (you will see them turn brown or white).</p>\n<p>An underlit succulent will begin to stretch for light, so a plant with elongated stem needs more light. In hot weather, water with a tablespoon of water every other day. In cold weather, once a week will suffice.</p>\n<p>If you see water running out the drainage hole in the bottom of the succulent box you are overwatering. Overwatered plants are soft and discoloured (yellow, white or colourless). Under-watered plants tend to stop growing and shed leaves.</p>\n<p>Where our <a href=https://www.reclaimdesign.org/reclaimed-wood-succulent-displays.html>Hydroponic Succulent Displays</a> are concerned - just keep the glasses topped up to where the roots are covered. If the plant outgrows the glass, simply plant outside and propogate another to replace in the glass. Easy peasy.</p>"}]},{"@type":"Question","name":"Why Don't Your Fabric Pots Have Any Drainage Holes?","acceptedAnswer":[{"@type":"Answer","text":"<p>They don't need any. A standard 11cm diameter nursery pot will fit perfectly inside. The nursery pot has drainage holes in it, and excess water will drain into the pot which can be emptied out easily. Bear in mind that if you find you are having to empty out water from the fabric pot you are generally overwatering, so ease back on the amount watered.</p>"}]}]}</script> 
    <?php 
    } 
    } 
    add_action("wp_head", "mm_add_faq_schema");

    Thank you very much for your help!

    Michael.

    #1162050
    Leo
    Staff
    Customer Support

    Hi there,

    Not sure where that code is coming from but have you checked with the author?

    Those kinds of scripts are usually added in wp_footer so maybe give that a shot?

    Please make sure the forum questions are directly related to GP/GP Premium as we cannot help with editing custom code or code coming from somewhere else.

    Thanks!

    #1162125
    Michael

    Hi Leo,

    I went about it a different way and put the script into the hook element page (that you and David told me about recently) for the wp_head section of the FAQ page, and I can now see the snippet markup in View Source…..

    #1162143
    Leo
    Staff
    Customer Support

    Awesome. Glad to hear!

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