Jump to content

Add a js code to my CMS page in prestashop 1.7.5


jihen

Recommended Posts

19 hours ago, jihen said:

Hello,

I want to know how can I add a js code to a specific CMS page ? 

 

4 hours ago, Rhobur said:

themes/assets/css/custom.css (if missing, add it) then add a condition to check for that page specific body class and within, your code.

For JS, as the OP asked, it would be themes/assets/js/custom.js ;)

Link to comment
Share on other sites

21 hours ago, jihen said:

Hello,

And if I want to add js code for only one CMS page ?

Use the code below inside your page template:

{if $cms.id == '10'}

your js code here inside script tags

{/if} 

This way you can specify which CMS page you want to inject your code into. Just replace 10 with your page's id.

  • Like 1
Link to comment
Share on other sites

  • 3 years later...
On 6/4/2021 at 9:59 AM, NikSol said:

Use the code below inside your page template:

{if $cms.id == '10'}

your js code here inside script tags

{/if} 

This way you can specify which CMS page you want to inject your code into. Just replace 10 with your page's id.

 

On 6/4/2021 at 9:59 AM, NikSol said:

Use the code below inside your page template:

{if $cms.id == '10'}

your js code here inside script tags

{/if} 

This way you can specify which CMS page you want to inject your code into. Just replace 10 with your page's id.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...