Embedding pop up form only on certain pages or blogs - craft theme

Hi everyone, I’m wondering if anyone can tell me whether it is possible, and if it is, how to embed my pop up form code only into specific pages and blog pages on craft theme?

Currently using flodesk for my forms and have a code, just need to know where to put it, if it’s possible to do so.

Hi @erin_smith26

You can go to Online store > Themes > Edit code > open theme.liquid file, add this code before tag

{%- if template.name == 'blog' or template.name == 'pages'  -%}
// add your popup form code here
{%- endif -%}

Do I change the ‘blog’ or ‘pages’ to whatever my page or blog is called?

If you want it appear in specific blog or page, please use this code instead

{%- if article.handle == 'your article handle' or page.handle == 'your page handle'  -%}
// add your popup form code here
{%- endif -%}

Example your blog article link is yourstore.com/blogs/news/blog-8, then handle is blog-8, same as page handle

This is what the full code looks like… is that right? It’s not working.

{%- if article.handle == ‘blog-3’ -%}
//

{%- endif -%}

Please send me that page link so I can check

https://soundlittlesleepers.co.nz/blogs/news/blog-3

Thanks!

Hi, mus

{%- if article.handle == 'news/blog-3' -%}
// 

{%- endif -%}

change code like this

Thank you so much! I had it working with your code but then I slightly changed my form so had to upload a new form code into it and now its not working anymore. This is the code im trying to use.. can you see why it wouldn’t be working?

{%- if article.handle == ‘news/blog-3’ -%}
//