Home › Forums › Archived Forums › Weaver II Theme › Weaver II Pro › How to create a different background image per category?
- This topic has 8 replies, 3 voices, and was last updated 9 years, 11 months ago by
Weaver.
-
AuthorPosts
-
October 30, 2016 at 11:49 UTC - Views: 14 #17491
HansPrive
ParticipantUsing Weaver II Pro.
I want to create a different full screen responsive background image for each post-category.
Did anyone managed to do this?October 30, 2016 at 17:05 UTC - Views: 1 #20665scrambler
ModeratorIf you mean the overall background of the browser, you can do it with Custom CSS rules.
To be sure of the proper CSS to give you, please provide a link to one of these category pages
October 31, 2016 at 14:10 UTC - Views: 1 #20666HansPrive
ParticipantPage: http://www.xxxxxx
Category: Safaribeoordelingen.October 31, 2016 at 17:11 UTC - Views: 1 #20667scrambler
ModeratorOK, so if what you meant is that you want a specific overall background image on all single post pages of a specific category, this could prove non trivial.
There is a manual way to do it by adding the CSS rule below in Advanced Options > Head Section > Custom CSS Rule box, but you need to add a new selector for each post with the proper post id
.postid-xxxx, postid-yyyy, postid-zzzz {background:url(ImageUrl) no-repeat;background-size:cover;}
There may be a way to do that with an Action & filter, but @weaver would have to let us know if that is indeed possible.
October 31, 2016 at 22:04 UTC - Views: 3 #20668Weaver
KeymasterA very good PHP programmer familiar with the WordPress API could probably put together a child theme to do this in less than a day.
But it is not trivial. It could be done using Actions and Filters, but the code is not really all that small, and a child theme might be more appropriate.
But the idea would be to add a new ‘body_class’ filter (this is the exact name of the WP filter), and add the name of the single page’s categories to the body tag. Then one could add custom CSS rules for body with the appropriate BG Image url() and how to display that BG image. But writing that filter does require a good knowledge of the WP API to be able to retrieve the category slug to add to the body class list.
October 31, 2016 at 22:34 UTC #20669scrambler
Moderator@weaver
“But the idea would be to add a new ‘body_class’ filter (this is the exact name of the WP filter), and add the name of the single page’s categories to the body tag. “
Given this is not the first time this question has come up, I think it would be a great addition 🙂November 1, 2016 at 00:51 UTC #20670Weaver
KeymasterBut this is about Weaver II – so a child would be the only way.
November 1, 2016 at 01:06 UTC #20671scrambler
ModeratorGoop point, but keep the idea for Xtreme 🙂
November 1, 2016 at 01:32 UTC #20672Weaver
KeymasterOr Xtreme Plus…
-
AuthorPosts
- The forum ‘ Weaver II Pro’ is closed to new topics and replies.

