Tagged: limit selector scope
- This topic has 4 replies, 2 voices, and was last updated 6 years, 10 months ago by
laucocos.
Author | Posts |
---|---|
laucocos
May 20, 2018 at 2:27 pm
|
Heads up! this post was created when Microthemer was at version 5. The current version is 7. Some references to the interface may be out of date. Hello, I would like to set a custom design to apply to all my blog posts. For example, I would like the titles centred, increased line height and extra padding between sections. I would like this style to apply consistently across all posts but not pages. I have looked in the settings and cannot see an option for this. Could you advise whether this is possible and how I can do it? Any help would be much appreciated. Best, |
Sebastian
May 21, 2018 at 9:03 am
|
Hi Laura, If you could send me a link to your site I can advise you more specifically. But for now, I can say that tapping into the classes WordPress adds to the HTML body tag is probably the way forward. Among the various classes there, there might be a .post-single class, or something similar, which is only present on single blog posts – not pages. And so if you prefix your Microthemer selectors with this class it will limit them to single posts e.g.
Alternatively, if you want to style collections of posts in the category view, you would look for a category class to include e.g.
You can manually change the CSS selectors Microthemer generates via the edit icon in the Selectors menu at the top left (visible when hovering over a selector). Or by clicking the current selector’s name in the top toolbar. Cheers, |
laucocos
May 21, 2018 at 12:01 pm
|
Hi Sebastian, Thanks for your response. I can see a class called ‘entry-content’ which seems to apply to the body text and ‘entry-title’ which seems to apply to the title. I tried applying this and it worked for the blog, but it also applied to the pages too. I cannot seem to find any blog–specific tags. Here is a link to my site: https://www.inspiratti.com/ You can access the blog posts from here: https://www.inspiratti.com/blog/ If you could help, I’d really appreciate it. Best, |
Sebastian
May 22, 2018 at 9:28 am
|
Hi Laura, The entry-content and entry-title classes you found are nearby the elements you want to style. But I was actually recommending looking at the classes added to the HTML body tag, which WordPress often adds. The following video shows how to find and use these body classes. (I forgot to mention in the video that you can use the Ctrl+F keyboard shortcut to search the HTML pane in targeting mode) Looking at your site, I can see that your theme also adds the class to the body tag, so you can use method. Note, my code example above initially used .post-single rather than .single-post, but I’ve updated it now. Cheers, |
laucocos
May 28, 2018 at 5:09 pm
|
This works perfectly – thank you. Best wishes, |