jihen Posted June 1, 2021 Share Posted June 1, 2021 Hello, I want to know how can I add a js code to a specific CMS page ? Link to comment Share on other sites More sharing options...
Rhobur Posted June 2, 2021 Share Posted June 2, 2021 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. Link to comment Share on other sites More sharing options...
w3bsolutions Posted June 2, 2021 Share Posted June 2, 2021 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 More sharing options...
Rhobur Posted June 2, 2021 Share Posted June 2, 2021 @w3bsolutions yep, I was writing on several things and mistyped js for css 🙂 Link to comment Share on other sites More sharing options...
NikSol Posted June 2, 2021 Share Posted June 2, 2021 If you favor inlining page specific js or css I would suggest using {if $cms.id == id of your page} conditional which you can put in the javascript_bottom block inside cms->page.tpl. Link to comment Share on other sites More sharing options...
jihen Posted June 3, 2021 Author Share Posted June 3, 2021 Hello, And if I want to add js code for only one CMS page ? Link to comment Share on other sites More sharing options...
Rhobur Posted June 3, 2021 Share Posted June 3, 2021 Didn't you read my answer? Quote then add a condition to check for that page specific body class Link to comment Share on other sites More sharing options...
jihen Posted June 3, 2021 Author Share Posted June 3, 2021 Sorry ! I didn't read your answer. But I add a js code to custom.js file but JS functions did not take into account Link to comment Share on other sites More sharing options...
NikSol Posted June 4, 2021 Share Posted June 4, 2021 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. 1 Link to comment Share on other sites More sharing options...
salvo72 Posted July 5, 2024 Share Posted July 5, 2024 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 More sharing options...
salvo72 Posted July 5, 2024 Share Posted July 5, 2024 I was wondering if I can insert or how I can insert a short code in the prestashop content page the plugin shows me a short code of this type [creativeslider id="76"] thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now