Sketch Theme: Hide Thumbnail from Blog Only

  • Unknown's avatar

    Hi,

    Yesterday I asked how to hide thumbnails on blog pages only (I don’t want to hide them on my portfolio pages) and I received an answer which resolved the question.

    As I’m going through and testing my site though I’ve noticed that the CSS I was given only applied to the main blog page:

    .blog .entry-thumbnail {
    	display: none !important;
    }

    I’ve since been expanding on the elements I target, and the CSS now looks like this

    .blog .entry-thumbnail, .tag .entry-thumbnail, .category .entry-thumbnail{
    	display: none !important;
    }

    However, the more I dig into my site, the more areas I’m finding need adding in, for example, the archive (by date) pages.

    When I add .archive .entry-thumbnail to the above CSS though, it hides the thumbnails on my portfolio archives too, which I do not want to do.

    So, is there a simpler way of targeting just the blog and all related pages? Alternatively, does anyone have a complete list of all the pieces of CSS that would need adding to target blog-related pages?

    Also, how do I stop this from affecting my portfolio archives? I cannot find a page-id on those pages and am not sure what I should be targeting to show the thumbnails if they are hidden by .archive .entry-thumbnail.

    Many thanks in advance.

    Josh.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi there,

    To clarify: you’d like to hide the thumbnail everywhere except portfolio archives and the front page – is that accurate?

    If it is, please try using this instead:

    body:not(.tax-jetpack-portfolio-type) .entry-thumbnail,
    body:not(.home) .entry-thumbnail {
        display: none;
    }
  • Unknown's avatar

    Hi Gary,

    That is correct. That code is almost there – it is hiding the thumbnails from all blog-related pages, they are displaying on portfolio archives, however on the main (home) page the thumbnails are not displaying.

    You can see what I mean if you visit joshuae.com – then mouse-over Portfolio in the menu and see either Photography or Video.

    Many thanks for you help!

  • Unknown's avatar

    Actually Gary, I think your code is correct, however I have actually created a page which is set to use the portfolio template. What would I need to put in to target that page? Is it the page-id?

  • Unknown's avatar

    Yup, I see what you mean.

    Please try this. It should hide them on the blog page and all archives except the portfolio (in theory at least :)

    .blog .entry-thumbnail,
    body.archive:not(.tax-jetpack-portfolio-type) .entry-thumbnail {
        display: none;
    }
  • Unknown's avatar

    Your second piece of code worked a treat!

    Thank you for your help Gary!

  • Unknown's avatar

    w00t!

    You’re welcome :)

  • Unknown's avatar

    Hi again Gary,

    Can I pick your brains over one very small issue with this please?

    IF someone were to land on the portfolio archive page https://joshuae.com/portfolio/ – from say a Google search, the thumbnails are not displaying on that page. With the first piece of code they were, with the second they’re not. Obviously I may have to make a compromise here, but I was wondering if you knew how to get them back on that page?

    I’ve been playing about trying to mix the two pieces of code but it either breaks one area or the other. I’d be very grateful for your (or anyone else’s) suggestions.

    Thanks,

    Josh.

  • Unknown's avatar

    Please try changing the css to:

    .blog .entry-thumbnail,
    body.archive:not(.tax-jetpack-portfolio-type):not(.post-type-archive-jetpack-portfolio) .entry-thumbnail {
        display: none;
    }
  • Unknown's avatar

    Gary,

    You are a legend!

    Thank you so much for your help!

    Josh.

  • Unknown's avatar

    You’re welcome.

    Hopefully we’ve got everything this time- if not, let me know :)

  • The topic ‘Sketch Theme: Hide Thumbnail from Blog Only’ is closed to new replies.