Site logo

Archived topic

how to add customize code at my single product page

1 reply · Started by xinghui on September 7, 2022

Viewing posts 1–2 of 2

I wrote a simple code for an accordion and wanted to add it to my product page. I used the code of generatepress blocks. I wrote my code directly in it and saved it to the hooks block. I went to the product page to check and found My code is still displayed, how can I add my product content to the product page correctly, in addition, I added javascript code to my code, does woocommerce support this language? Does it matter?
there is my problem image:

Hi there,

the <code> block is for showing code on your website.
If you wanat to add code such as <link> <style> <script> to your site then:

1. Use a Hook Element:

https://docs.generatepress.com/article/block-element-hook/

2. You can add any code you need within the hook text area.

3. Choose either of these hooks for adding code.

i) wp_head for inserting code into the <head> of your site. best used for <link> and <styles>
ii) wp_footer for inserting code into the footer of your site. Best for <scripts> that have to be loaded after HTML.

4. Set the Display Rules for your Products

DO NOT Add this kind of code:

<!DOCTYPE html>
<html>
<head>
<meta name= "viewport"

The theme already does that and you don't want duplicates of those.

This archived topic is closed to new replies.