Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

[SOLVED] Different CSS for pages vs. posts.


  #1  
Old Feb 4, 2011, 10:03 AM
jasonb
 
14 posts · Feb 2011
First of all, I know that pages are really nothing other than just "special" posts - which is why the theme makes no distinction between the two when defining either BODY Box or the div.post-bodycopy (or clearfix) CSS insert.

I can manage to almost accomplish this distinction myself by virtue of a "hack", whereby I simply enclose the text of each of my pages in a <div> block, and then "override" the previously defined style elements with the CSS insert I want.

So, for example:

div.clearfix p { margin: 0em; }
div.post-bodycopy p { text-indent: 1.2em; }
div.override p { text-indent: 0; margin-top: 10px; margin-left: 5px; margin-right: 5px; margin-bottom: 10px; }

Regular posts will now have the first line of each paragraph indented, and there will be no space between paragraphs.

If I now create a page, and enclose the text of my page in <div class="override"> </div>, that page will now no longer have the first line of each paragraph indented, and there will be clear spacing between the paragraphs.

Everything is just fine so far. However, what I want is to have a left-sidebar, single column in the middle, and a right-sidebar. Within that single column of post entries, I want each individual post to be broken into newspaper columns. I can easily do this (of course it only works with Firefox) by adding the following to the definition of BODY Box:

-moz-column-width: 30em; -moz-column-gap: 20px;

Again, everything is good - except that not only all of my posts but also all of my pages are now showing in newspaper columns. I think, no problem, I'll just override that behaviour in the same way I do for the other formatting. So I use the following:

div.override p { text-indent: 0; margin-top: 10px; margin-left: 5px; margin-right: 5px; margin-bottom: 10px; -moz-column-count: 1}

But that doesn't work. I still see two columns. In fact, if I use "-moz-column-count: 2" I actually end up with pages that have double the number of columns that my posts do. Why? Because it seems that this CSS declaration is embedded. In other words, all I'm doing is defining a set of columns within another set of columns.

Looking at the source code, my pages look like this:

<div class="post-bodycopy clearfix"><div class="override">

So the number of columns I end up with are those defined by BODY Box (post-bodycopy) times those in my own div class.

In other words, for this particular CSS formatting (I have no doubt that the same problem would occur if I were to use tables, for instance), my method of distinguishing between posts and pages - as different types of things - doesn't work.

So, is there any method by which conditional CSS can be applied at the BODY Box (post-bodycopy) level depending on whether the thing being displayed actually is a post or a page? That way I would not be embedding a series of CSS, some of which the child DIV can't override, but would actually be applying a single top-level CSS?

Not knowing the finer workings of WordPress or this theme, the only thing I can visually note that's different is the URL:

?p=# is a single post being displayed.
?page_id=# is a single page being displayed.

Is there any way of leveraging this difference?

BTW: You can see my site as I have it currently here - and you'll have to use Firefox if you want to see what I'm talking about. To see the distinction between my posts and my pages, just click on the "About Me" link. (The main part is looking good so far, but that page is also in multiple columns, which I don't want.) I have just recently transitioned from Movable Type to Wordpress, and I'm needing to do a lot of manual "lifting" to get everything integrated together again and looking, more or less, like I'd had it before. I had previously defined my own page layout via .shtml and SSIs - designed the overall code myself, and then just inserted the Movable Type generated pages in as a .txt file within a framework. With Wordpress, it looks like my "best" approach is to migrate my individual pages into actual Wordpress pages. (Unless I can figure out how to manually "call" the Wordpress site in such a way that my previously written pages just "sit inside" the middle column as would a post or page.) I haven't really started that process yet, and would like to know if this problem of mine is solvable first - or if I'm going to have to abandon the idea of newspaper columns, or approach things from a non-native Wordpress angle.

Last edited by jasonb; Feb 5, 2011 at 01:43 AM.
  #2  
Old Feb 4, 2011, 10:37 AM
jasonb
 
14 posts · Feb 2011
Thanks! I thought I'd provide more information rather than less - just so I wouldn't have to go back and explain myself further if there wasn't a simple explanation.

I tried using:

div.post-bodycopy #post

and it seems to be ignoring it. It may well be because I'm not familiar with the syntax required for using "#". I looked into the userChrome.css file for my browser and, using an entry there as an example, also tried:

#post > .post-bodycopy

That didn't work either.
  #3  
Old Feb 5, 2011, 01:41 AM
jasonb
 
14 posts · Feb 2011
I finally figured it out after looking at the source code and the order of the parent / child DIVs:

div.type-post div.post-bodycopy { ... }

vs.

div.type-page div.post-bodycopy { ... }

---

Hmm. I tried to prepend [SOLVED] to the title of the thread, but while it shows that title change after I click on Go Advanced, it didn't actually change the title...

Last edited by jasonb; Feb 5, 2011 at 01:46 AM.
  #4  
Old Feb 5, 2011, 02:08 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
To mark a three solved, you use the 'thread tools' tab
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Feb 5, 2011, 09:48 PM
jasonb
 
14 posts · Feb 2011
Thanks, it makes sense now.

Last edited by jasonb; Feb 5, 2011 at 09:51 PM.

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] post-specific header image w/ css insert (page-specific ones work, but not o viewdesigninc Header configuration & styling 10 Oct 1, 2012 03:43 PM
Blog posts on different pages kal Installing & running WordPress 2 Feb 17, 2010 02:54 PM
Posts vs pages, redux pamlicoink Header configuration & styling 3 Aug 17, 2009 09:55 AM
css insert not showing individual posts bushtool New Versions, & Updating 9 Jul 15, 2009 06:54 PM
Posts below Pages in the Body....How to? ryguy Post-Kicker, -Byline & -Footer 1 Jun 20, 2009 12:55 PM


All times are GMT -6. The time now is 12:22 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.