Jump to content
Sign in to follow this  
ecee

Css for content - on per page basis

Recommended Posts

ecee    0
ecee

Hi, I made a css customization to the content on front page. But then the content area on other pages (like blog and product pages) changed as well. Is it possible to style the content area, only on a specific page? I also wonder this for example the widget-pad. Maybe I don't want some widgets to be styled, but when I style them it's all or none... Thanks!

Share this post


Link to post
Share on other sites
catrina    103
catrina

Yes, it is possible to change the style of a content area on a specific page. The same goes for a specific widget in a sidebar. For example, if you want to change the content area (the main content column on the left side of the page) on specifically the homepage, you'd use this CSS:

body.home div.mcolumn-pad {background-color: #yourcolor;}
For the blog page, this code:
body.blog div.mcolumn-pad {background-color: #yourcolor;}
For a regular page (like About Us), this code:
body.page-id-874 {background-color: #yourcolor;}

...and so on. For the regular pages, you need to use that specific page's page ID for the body tag selector (as shown above in the About Us example - since the ID for that page is 874). To find it, you can view your source and look at the

class tag at the top of the page.
  • Like 2

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
ecee    0
ecee

Superthanks again Catrina! I haven't tried it yet, but I think that I get it... I will have a lot of fun customizing tonight :) Is it kind of the same for widgets somehow? Superthanks!

Share this post


Link to post
Share on other sites
catrina    103
catrina

Correction: The last piece of code in my previous post should look like this...

body.page-id-874 div.mcolumn-pad {background-color: #yourcolor;}

  • Like 1

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
ecee    0
ecee

Great, I kind of wondered why that didn't needed to be there on the last one...so this makes it more clear :)

Share this post


Link to post
Share on other sites
catrina    103
catrina

If div.mcolumn-pad doesn't change the content area, you can use Firebug to inspect your page for the area that you want to adjust (instructions on how to do that are here: http://www.pagelines.com/wiki/Custom_CSS).


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
munts    0
munts

Catrina,

Thanks a ton for providing this info. It is helping me as well, as I have left sidebar for navigation that I want to be a unique color. However, is there a way to set the background color for the top level page and have it inherrit on only the child pages of that particular section (without having to do something like the following)?

body.page-id-102 .one-sidebar-left {background-color:#666666;}

body.page-id-103.one-sidebar-left {background-color:#666666;}

body.page-id-104 .one-sidebar-left {background-color:#666666;}

body.page-id-105 .one-sidebar-left {background-color:#666666;}

body.page-id-106 .one-sidebar-left {background-color:#666666;}

Thanks again,

Scott

Share this post


Link to post
Share on other sites
evan    0
evan

Hey Munts,

You can target child pages by using another body class. If you inspect your body classes on your child page, you will see there is a class that identifies the parent page id like so: "parent-pageid-14". You can use this class to target all the child pages of that parent page all at once.

As for targeting widgets on individual pages, you'd have to prefix it with the proper body class and then target the specific widget, they have unique IDs.

BTW, I recently wrote a plugin that allows you to add custom styles to any individual page or post! I'm sure you'd find it useful if you do a lot of special styling for different pages. It lets you write your own custom CSS/LESS that is only loaded on that page, so you don't have to worry about messing with body classes. It doesn't however handle groups of pages (like child pages), that would still have to be done using the parent-pageid-X body class. It's linked down in my signature below if you're interested in learning more about it.

Cheers!

  • Like 1

Share this post


Link to post
Share on other sites
munts    0
munts

Evan,

Thanks a ton. I will look into the parent-pageid-14... as well as your plugin.

Thanks again,

Scott

Share this post


Link to post
Share on other sites
Rob    547
Rob

The topic was marked as resolved.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • janpeeters
      By janpeeters+
      Over the last month I had extensive communications with the developer of the (premium) Anything Boxes section (in Pagelines store) (Adam Munns) and the developer of the WP Polylang Multilingual plugin (Frederic Demarle).
       
      This was because the following problem occurred:
      Anything Boxes showed all posts of two languages (Dutch and English) on the respective static frontpages for each language. It should of course have filtered posts for Dutch language on the Dutch frontpage and English on the English frontpage.
       
      The solution to this problem was simple in the end. When duplicating a page for use in another language the settings for Anything Boxes were not copied to the new page and I should have set these settings manually again on the new page. I wasn't aware of this, but it makes sense. Because of this the pages didn't know how to differentiate between posts from different languages.
       
      The dev of Polylang told me that Polylang is currently smart enough to synchronize metas like Featured images and page templates but it does not work out of the box with metas created by plugins and themes but (according to Frederic) it is rather easy to add them in the list using the filter 'pll_copy_post_metas'.
      He mentions that he is not sure that these 'PageLines Meta Settings' are stored in post meta but that would make sense according to him. He asks if the Pagelines dev team will be interested to support this feature in the future.
       
      I'm also wondering if you will consider adding Polylang translation support for manually editable strings like the 'Read more…' strings in Pagelines Settings.
       
      Well that's of course up to you but I thought to let you know to be able to take this into consideration. I also post this for other users in case they experience the same kind of trouble and are looking for an answer.
       
      Best regards,
      Jan Peeters
    • bankrollbuilder
      By bankrollbuilder
      I used a custom hook to put a banner ad in my header. It works but its not in the right position. it is centered and above my logo and I would like to float it to the right of my logo in the header. heres the link: http://shaboopie.com/shaboopie-wp/free-logos-pg1/

      thanks.

      Dan B.
    • starlit
      By starlit
      Can one have two hero sections on one page?

      I want a landing page which leads/advertises two subpages.

      Or is there another option?

      Please help.

      THANK YOU
    • hutruk
      By hutruk
      Hi!

      I am using the shortcodes for tabs, as described in the documentation.

      When I insert the following code:


      [pl_tabs][pl_tabtitlesection type="tabs"] [pl_tabtitle number="1"]Title 1[/pl_tabtitle] [pl_tabtitle number="2"]Title 2[/pl_tabtitle] [/pl_tabtitlesection] [pl_tabcontentsection] [pl_tabcontent active="yes" number="1"] Lorem ipsum dolor sit amet, consectetur adipiscing elit [/pl_tabcontent] [pl_tabcontent number="2"] Lorem ipsum dolor sit amet, consectetur adipiscing elit [/pl_tabcontent] [/pl_tabcontentsection] [/pl_tabs]

      I get a strange output (in the attachment).

      Any ideas?

      Thanks in advance!

    • MooiWeb
      By MooiWeb
      Hello,

      I would like to align my qtranslate with my breadcrumb so that the flags are on the same hight.
      I'm aware of putting a code in the custom css and tryed severall codes from your site but for now, no succes

      The site i'm working on is http://nieuw.vazdias.nl

      Thx,
      Edwin



×