
The blog has a Theme as good as for any page an additional character sheet. This stream direction of individuality for any calm is really usual today. Even with WordPress, we can do so; there have been multiform possibilities. One probability is to create, formed on a title, a particular stylesheet.
By default, a category choice of duty body_class() has already a lot of possibilities. More individuality can be reached with a pretension or ID.
It is positively not value for a normal blog sourroundings though for a site with small calm it functions flattering well. As we have implemented in this case.
If a page is loaded, afterwards we can pass a title. If we make use of this a single in a physique tab as ID or category as good as afterwards emanate for any ID or class a style, a right pattern will be loaded.
Alternatively, we can work with a ID of a page or article, duty the_ID() passes it. Please note, IDs as good as classes might not begin with a series as good as thus we contingency supplement a fibre before, for example:
<div id="page-<?php the_ID(); ?>">
As a last alternative, we would similar to to discuss which we can enhance a duty body_class() around Hook with own classes. So we can have a pretension of a page/post around offshoot in this function.
function fb_title_body_class($classes) {
global $post;
$classes[] = sanitize_title_with_dashes( get_the_title( $post->ID ) );
return $classes;
}
add_filter( 'body_class', 'fb_title_body_class' );
In a following I’m display we a simplest box around title, so which we outlay usually this category as good as as well as body_class() is not used.
With a assistance of a Title
Put a stylesheet in a header of your Theme:
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/custom.css" type="text/css" media="screen" />
Alternatively, this is integrated around Hook wp_head if a specific page is loaded, so we bucket a pithy character piece usually if it is needed. Everything happens in a functions.php of your Theme.
in your physique tab of page.php is a pretension of a page:
<body class="<?php echo sanitize_title_with_dashes( get_the_title() ); ?>">
Therefore a page “My Home” has a physique tag:
<body class="my-home">
and so on...
in your custom.css we conclude all character for category home: for example
.my-home a { color: #090; text-decoration: none; }
.my-home a:visited { color: #999; text-decoration: none; }
.my-home a:hover { color: #f60; text-decoration: none; }
in a strange Theme it looks similar to this:
a { color: #009; text-decoration: underline; }
a:visited { color: #999; text-decoration: underline; }
a:hover { color: #c00; text-decoration: underline; }
I consider it’s an proceed with a lot intensity as good as so we leave it to your creativity. So if we would similar to to have for any page a opposite character sheet, this is an easy solution.
Related posts:
Thanks for subscribing a feed! Sponsor a WP Engineer Blog as good as get your code in front of multiform hundred users per day!
© WP Engineer Team, All rights indifferent (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)
View post:
Individual Design for any Page