Site logo

Archived topic

adding script code on single page or post

10 replies · Started by Yaeko on March 28, 2022

Viewing posts 1–11 of 11

hi.I am trying to add some chat apps on my site. currently I did add code with elementor. somehow I need to change my direction. I want to add code on single page. chat manual says copy and paste just before closing </body> tag, but on code editor mode on each page, I can not find </body> tag. so is there anyway that I can achieve it?
thanks!

Hi there,

For sure - follow these steps:

1. Enable the Elements Module in Appearance > GeneratePress.

2. Then Create a New Hook Element in Appearance > Elements:

https://docs.generatepress.com/article/hooks-element-overview/

2.1 In the Hook text area add your chat app script.

2.2 Select the Hook: wp_footer

2.3 Set the Display Rules to the Entire Site or the specific pages you want the chat app displayed.

2.4 Publish the hook.

thank you for quick reply!
yes I know, I am using elements and hook.
but I rather want to try single page.
is there any way that I can do?

Why not just set the Element Display Rule to the single page you want it applied to?

The only alternative is to add it to the page in the editor using a HTML Block.
But it won't be just before the </body> tag

I understand your question that not using element.
I am on learning curve. that is first.

I am building site that 2 languages. Japanese and English. Both language I have original text, not auto translation.
which means I do not require polylang or any other multi lingual plug in. only give different slug /ja or /en.
in which case, hook unable to find out which page is japanese or english. (mind you, Not using polylang, so each page or post no identify language!)

does it make sense to you?

Is it possible to see an English and a Japanese language page ?

Japanese site almost complete.
English page, I just duped japanese page to english, only home is uploaded. but yes, sure, please.
also if you want to log in, I can create user for you. do let me know.

So will you be creating 'english' copies of every page ?

copy the layout, put in original english text. so answer is yes, sir.

so it seems only way is I have to rule out exclude english hook on japanese page. am I right?

Yes, with your current setup you would need to Exclude all Japan pages for the english chat. And All the English Pages for the Japan chat

This archived topic is closed to new replies.