<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Custom Jquery for the Shop]]></title><description><![CDATA[<p dir="auto">Hey y'all</p>
<p dir="auto">I would like to know how I can target the Shop (just the main page with all the products) with jQuery, as it apparently does not fall into the “Page” categorie but into the “Archive” categorie? I cannot use the if statement (type == "page" &amp;&amp; <a href="http://obj.id" target="_blank" rel="noopener noreferrer nofollow ugc">obj.id</a> == XX) right ??</p>
<p dir="auto">Thanks in advance for your answer!</p>
<p dir="auto">Théo</p>
]]></description><link>https://laythemeforum.com/topic/7528/custom-jquery-for-the-shop</link><generator>RSS for Node</generator><lastBuildDate>Wed, 19 Aug 2026 09:11:31 GMT</lastBuildDate><atom:link href="https://laythemeforum.com/topic/7528.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 11 Jan 2022 11:02:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Custom Jquery for the Shop on Sun, 16 Jan 2022 20:21:08 GMT]]></title><description><![CDATA[<p dir="auto">Happy to help <a class="plugin-mentions-user plugin-mentions-a" href="/user/tylm">@<bdi>TYLM</bdi></a> have a great day ✨</p>
]]></description><link>https://laythemeforum.com/post/28028</link><guid isPermaLink="true">https://laythemeforum.com/post/28028</guid><dc:creator><![CDATA[Richard]]></dc:creator><pubDate>Sun, 16 Jan 2022 20:21:08 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Jquery for the Shop on Wed, 12 Jan 2022 21:00:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/richard">@<bdi>Richard</bdi></a></p>
<p dir="auto">I will have to check that slug/type situation to be sure to have a clean and functional website in the future… But in the meantime the code you sent works perfectly! Thank you very much! :)</p>
<p dir="auto">Best wishes,</p>
]]></description><link>https://laythemeforum.com/post/28007</link><guid isPermaLink="true">https://laythemeforum.com/post/28007</guid><dc:creator><![CDATA[TYLM]]></dc:creator><pubDate>Wed, 12 Jan 2022 21:00:24 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Jquery for the Shop on Wed, 12 Jan 2022 20:11:28 GMT]]></title><description><![CDATA[<h3>Dear Theo</h3>
<h6><a class="plugin-mentions-user plugin-mentions-a" href="/user/tylm">@<bdi>TYLM</bdi></a></h6>
<p dir="auto">Unsure why myself (could be your product page?), but regardless you can still use this information to apply jQuery:</p>
<pre><code>&lt;script&gt;
window.laytheme.on("newpageshown", function(layoutObj, type, obj){

	if(type == "archive" &amp;&amp; obj.id == 553){
		console.log("fantastic!");
	}
});
&lt;/script&gt;
</code></pre>
<hr />
<h5>Best wishes ✨</h5>
<h5>Richard</h5>
]]></description><link>https://laythemeforum.com/post/28006</link><guid isPermaLink="true">https://laythemeforum.com/post/28006</guid><dc:creator><![CDATA[Richard]]></dc:creator><pubDate>Wed, 12 Jan 2022 20:11:28 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Jquery for the Shop on Wed, 12 Jan 2022 19:45:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/richard">@<bdi>Richard</bdi></a> Thanks for your answer</p>
<p dir="auto">I don't know why but my shop page is not a page but an archive – it's not supposed to be tho. I applied the code to have the console readout and I get this :</p>
<pre><code>obj 
Object { id: "553", type: "archive", slug: "product", catid: "" }
catid: ""
id: "553"
slug: "product"
type: "archive"
&lt;prototype&gt;: Object { … }
</code></pre>
<p dir="auto">That's probably why I can't use the if statement correctly.<br />
It's weird that the slug here is "product" when the actual slug is "shop"…<br />
And I really don't understand that “Archive” thing.</p>
]]></description><link>https://laythemeforum.com/post/28002</link><guid isPermaLink="true">https://laythemeforum.com/post/28002</guid><dc:creator><![CDATA[TYLM]]></dc:creator><pubDate>Wed, 12 Jan 2022 19:45:28 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Jquery for the Shop on Wed, 12 Jan 2022 19:25:50 GMT]]></title><description><![CDATA[<h3>Dear Théo</h3>
<h6><a class="plugin-mentions-user plugin-mentions-a" href="/user/tylm">@<bdi>TYLM</bdi></a></h6>
<p dir="auto">My main shop page is a <code>page</code> is your's not?<br />
When applying the following code (<a href="https://laytheme.com/documentation.html#custom-javascript" target="_blank" rel="noopener noreferrer nofollow ugc">documentation</a>):</p>
<pre><code>&lt;script&gt;
window.laytheme.on("newpageshown", function(layoutObj, type, obj){
	console.log("layoutObj", layoutObj);
	console.log("type", type);
	console.log("obj", obj);
});
&lt;/script&gt;
</code></pre>
<p dir="auto">I get a console readout:</p>
<pre><code>obj 
{id: '11', type: 'page', slug: 'shop', catid: ''}
catid: ""
id: "11"
slug: "shop"
type: "page"
&lsqb;&lsqb;Prototype&rsqb;&rsqb;: Object
</code></pre>
<p dir="auto">Then i can use the following <code>if</code> statement to be sure:</p>
<pre><code>&lt;script&gt;
window.laytheme.on("newpageshown", function(layoutObj, type, obj){

	if(type == "page" &amp;&amp; obj.id == 11){
		console.log("fantastic!");
	}
});
&lt;/script&gt;
</code></pre>
<p dir="auto">Result:</p>
<p dir="auto"><img src="/assets/uploads/files/1642015421725-screen-shot-2022-01-13-at-8.20.02-am-resized.png" alt="Screen Shot 2022-01-13 at 8.20.02 AM.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">So i know the code that i use within the <code>if</code> statement will be applied to this page.</p>
<hr />
<h5>Hope this helps &amp; best wishes Théo ✨</h5>
<h5>Richard</h5>
]]></description><link>https://laythemeforum.com/post/27995</link><guid isPermaLink="true">https://laythemeforum.com/post/27995</guid><dc:creator><![CDATA[Richard]]></dc:creator><pubDate>Wed, 12 Jan 2022 19:25:50 GMT</pubDate></item></channel></rss>