Posted: September 21, 2015 at 12:25 am
|
September 21, 2015 at 12:25 am Hi there eg <div id=”espresso-notices”/> In particular I believe this line is breaking my CSS nth child rule: thanks! |
|
Seems that line of code didn’t publish:
|
Hi Jade, To remove those sections from those specific pages you can add:
I’ll check to see if we can only include those sections within EE pages.
|
|
|
Thanks Tony. This has successfully removed the notices. However, I also need to remove the offscreen checkout link – this is the one that’s causing my nth-child(4n) to be miscounted on the article tiles.
Is there a filter to remove this too? thanks |
September 22, 2015 at 12:26 pm Hi Jade, Those are added by an action, so they can be removed via an action like this:
I can also give you a little background info on why the markup is added to some pages, but not all of them. You’ll find that the markup isn’t added to a regular WP page like If it becomes a game of whack-a-mole to remove the EE notices and cart markup from any of the pages you’re working, please let us know and we might be able to offer some advice on how to avoid the CSS nth rule breakage. |
|
|
Thanks Josh. I’ve tested this on our dev site and unfortunately it’s not working for me. There is the potential in the future we may want to integrate event listings into the What’s on page (when I can figure out how to get a paginated loop working nicely with a merged query of normal posts and EE posts – tips appreciated!) So perhaps looking at a CSS fix might be a better option…? thanks, |
Hi Jade, It turns out we have some readymade code that you can use/adapt/reuse to make a merged query of normal posts and EE posts in our github snippets library. Here’s a link to the code: We’re happy to help you get the nth selector issue straightened out. Can you post the CSS code you’re trying to get working, and let us what it’s supposed to style? |
|
|
Brilliant, thanks Josh. I will check this out. The relevant CSS is:
(This is for desktop, it drops down to 3n, 2n as the columns drop with screen size) |
|
As you can see on this page: https://www.southgatemelbourne.com.au/offers-promotions/ The 3rd & 4th columns of children-tiles/articles run together with no margin between, so the 4n is applying to 3n instead. The same CSS logic is used successfully on this page http://www.southgatemelbourne.com.au/southgate-cinema/ Which incidentally doesn’t have the hidden checkout button, despite actually being a loop of espresso events! |
|
To clarify, it’s not applying to 3n, it just seems to be counting the checkout button as the first child. |
September 24, 2015 at 10:54 am I’ve run into this before, instead of using nth-child, it’d be better to use nth-of-type like this:
There’s a good explanation why it’s more bulletproof to use nth-of-type in this article: https://css-tricks.com/the-difference-between-nth-child-and-nth-of-type/ |
|
|
Thanks so much Josh! I didn’t know this option existed – always assumed that nth-child meant nth-of-type. |
The support post ‘How do I stop extra EE code being added to all pages’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.