Answer the question
In order to leave comments, you need to log in
A couple of questions: background for wordpress category posts, header?
Help me solve a couple of questions:
1. I made a certain background (background) on the home page, for each of the headings there is a different background:
body.home {
background: url('....')
...
}
body.category-1 {
background -image: url("X") ;
.....
}
and so on
for a single entry is clear:
.postid-1 {
background-image: url(".... ") ;
...
}
how to set a common background "X" for all entries in category 1?
Second question. Set the padding for the header
#header .hu-pad {
padding-top: 260px;
}
similar to the first question - how to implement indentation only on the home page (the home page is supposed to be temporary), in the categories (all category entries)?
Answer the question
In order to leave comments, you need to log in
for a single entry it is clear:
.postid-1 {
background-image: url(".... ") ;
...
}
postid-1
how to set a common background "X" for all entries in category 1?
Second question. I set the indentation for the header
similarly to the first question - how to implement the indentation only on the home page (on the home page is supposed to be temporary), in categories (all category entries)?
if( is_front_page() || is_home ) {
// вставляем стили для главной
}
if( is_single() ) {
// вставляем стили для одиночной записи
}
if ( in_category( 10 ) ) {
// вставляем стили для записи, которая находится в рубрике с ID 10
}
In theory, this is not exactly a single record, but a record with an ID equal to 1 postid-1
<?php if ( in_category()): ?>
<div class=".." style="background-image: url('<?php $image=wp_get_attachment_image_src( $attachment_id, 'full'); echo $image[0]; ?>);">;
<?php endif ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question