Different Post Styles

Discuss PivotX 2.0.x themes here, and view themes that are available for download.

Different Post Styles

Postby wildrocker92 » Mon Nov 29, 2010 3:30 pm

Hello!

I was wondering if there's a way to insert some CSS for each post right on the header to match the style of it.
Or maybe I could use a custom field on the post page, but I don't know how to script that :?

Code: Select all

HTML

<body class="tag or id of post"></body>

CSS

<style>
.tag or id of post {
   background: #000;
}
</style>



And then add the CSS externally, maybe? :|
Any suggestions? Thanks! :D
Your mind is the limit.
wildrocker92
 
Posts: 6
Joined: Mon Nov 29, 2010 3:00 pm

Re: Different Post Styles

Postby ankedesign » Mon Nov 29, 2010 4:30 pm

You could use the bonusfields extension ( http://extensions.pivotx.net/entry/17/bonusfields ), and create a custom field for the entries.
Then you can and add a class to your post using this custom field.

Additionally, you can add a couple of these classes to your css. There you can style your entries..

That should do the trick!
ankedesign
 
Posts: 21
Joined: Sun Oct 12, 2008 1:51 pm

Re: Different Post Styles

Postby wildrocker92 » Mon Nov 29, 2010 5:11 pm

ankedesign wrote:You could use the bonusfields extension ( http://extensions.pivotx.net/entry/17/bonusfields ), and create a custom field for the entries.
Then you can and add a class to your post using this custom field.

Additionally, you can add a couple of these classes to your css. There you can style your entries..

That should do the trick!


Awesome! Thank you so much! :D
Your mind is the limit.
wildrocker92
 
Posts: 6
Joined: Mon Nov 29, 2010 3:00 pm

Re: Different Post Styles

Postby hansfn » Mon Nov 29, 2010 6:05 pm

Just a comment: Setting the style manually (with extra/bonus fields) seems like a lot of work. Don't you really want different styles based on the category or maybe alternating every 2nd, 3rd?
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Different Post Styles

Postby wildrocker92 » Mon Nov 29, 2010 6:33 pm

hansfn wrote:Just a comment: Setting the style manually (with extra/bonus fields) seems like a lot of work. Don't you really want different styles based on the category or maybe alternating every 2nd, 3rd?


Yup, I understand that's a lot of work. But suits with my idea. (Just 3 variables to change for each article: bg of header, link's color and a big image title instead of an H1)
I'm not pretending to post an article everyday, it's like a weekly magazine and it shows the latest article on frontpage with the corresponding style of it.

To understand better you can get the idea looking at this websites:
Jason Santa Maria or Trent Walton

They are based on WordPress though, but now I understand that I can get the same result with PivotX 8-)

But I'm also interested on that idea about the category based styles, could explain it more? :D
Your mind is the limit.
wildrocker92
 
Posts: 6
Joined: Mon Nov 29, 2010 3:00 pm

Re: Different Post Styles

Postby ankedesign » Thu Dec 02, 2010 4:05 pm

For categories: You can check the category of an entry with [[$entry.category.0]]. And with that, you can make if-statements adding classes, depending on what category your entry has.

This is, indeed, a far easier way then with the bonusfields, but offcourse, whatever suits your needs! :)
ankedesign
 
Posts: 21
Joined: Sun Oct 12, 2008 1:51 pm

Re: Different Post Styles

Postby wildrocker92 » Thu Dec 02, 2010 4:11 pm

ankedesign wrote:For categories: You can check the category of an entry with [[$entry.category.0]]. And with that, you can make if-statements adding classes, depending on what category your entry has.

This is, indeed, a far easier way then with the bonusfields, but offcourse, whatever suits your needs! :)


Ok! No problem :D

But I've found how to do it.. so thanks anyway :D

Have a great day!
Your mind is the limit.
wildrocker92
 
Posts: 6
Joined: Mon Nov 29, 2010 3:00 pm


Return to 2.x Themes

Who is online

Users browsing this forum: No registered users and 1 guest

cron