If I want to use a same widget but when the post page type different, I would like to show header and footer in different style. Can I change the appearance through the widget? If it's not a good way, what is the best way to do it. Thanks in advance.
1 Answer
I would say it is not good practice to use a widget to change appearance of other items than the widget itself.
If you want to influence the appearance for a specific post type, you can work with post templates.
archive-{post_type}.php
single-{post_type}.php
If such a template file is in use, there is also a class added to the body element single-{post_type}
. You can then refer to this class in CSS:
.single-post_type .footer {
}
If you really just want to change the appearance for one specific page, just use the post-id or page-id which are added to the body element's class:
.postid-## .footer {
}
.page-id-## .footer {
}