Hi Clay, This is an old post of yours I am replying to. I want to have different house ads displayed in different categories too. Were you ever able to get this to work? I scrolled down this post but could not see a reply to your question.
Cheers
Hi Clay, This is an old post of yours I am replying to. I want to have different house ads displayed in different categories too. Were you ever able to get this to work? I scrolled down this post but could not see a reply to your question.
Cheers
I think Iāve done it by making a bunch of ads that all display and then hiding them by category with css.
Hi pfaffman,
After reading your post. I asked google gemini for the code to use in ccs and HTML.
However it is not displaying the ads at all now.
This is the CSS it said to use but I am not sure if it is correct.
/* -------------------------------------------------------------------------- */
/* CSS to control which ads are displayed in which categories */
/* -------------------------------------------------------------------------- */
/* Initially hide all category-specific ads. The [class*="-ad"] selector is more general */
.house-ad[class*="-ad"] {
display: none;
}
/* Homepage Ad (if you have one - adjust the body class if needed) */
body.list-latest .house-ad.homepage-ad,
body.list-top .house-ad.homepage-ad {
/* body.list-latest and body.list-top are common Discourse classes for "Latest" and "Top" */
display: block;
}
/* Category Specific Ads */
body.category-community-support .house-ad.category-community-support-ad {
display: block;
}
body.category-general .house-ad.category-general-ad {
display: block;
}
Is there any chance you could let me know what css you used or if what I posted looks correct?
This is the HTML
<div class="house-ad category-community-support-ad">
<a href="DESTINATION_URL" class="banner-ad" target="_blank">
<img class="desktop" src="DESKTOP_IMAGE_URL">
<img class="mobile" src="MOBILE_IMAGE_URL">
</a>
</div>
I kinda think I got it to work? But in checking, the last house ads I did were 3 years ago, and when I just tried to make it work again, I couldnāt get them to appear. Weird.
Thanks for letting me know. I am having the same issue of it now not displaying any ads.
Hi Pfaffman,
I replied to you yesterday asking if my css was correct. I posted the CSS and the HTML I was using that gemini suggested (which is not working). Not sure why but the post was moderated and removed, as other people have posted code above in this thread.
I also asked if had time to share the code you used to make it work. Not sure if that was the moderation issue but again people have posted code above.
I donāt know how to move forward in asking for help with this now that my posts are being removed. Iām lost!
Hi @becl I restored your post with the not working css - feel free to keep the conversation going, and let us know how it goes!
Thank you very much. I appreciate it.