php - What is the most efficient way to make changes to a selection of pages in CSS for wordpress? -


i want add background picture group of pages in wordpress.

i want add different background picture group of pages

currently applying each individual page using pageid in code below. there on 1000 pages. there more simple way apply each group of pages?

    .page-id-264 #header .logo a,     .page-id-272 #header .logo {      background-image: url("http://www.richcoward.com/newcges/wp-content/uploads/2014/08/nwu-no-frame.png") !important;      background-size: 100% !important;      background-repeat: no-repeat !important;      height: 86px !important;       width: 416px !important;      } 

thanks help

here simple solution.

create custom css (say mystyle.css) file in theme folder. add

#header .logo {      background-image: url("http://www.richcoward.com/newcges/wp-content/uploads/2014/08/nwu-no-frame.png") !important;      background-size: 100% !important;      background-repeat: no-repeat !important;      height: 86px !important;       width: 416px !important;      } 

into mystyle.css. now, open functions.php , enqueue stylesheet conditionally. use is_page() or is_page_template() conditional checks. believe talking groups of pages, imagine use specific page templates specific groups, tend go is_page_template

function enqueue_custom_style() {    if(is_page_template('page-whatever.php')) {      wp_enqueue_style('my-style', get_stylesheet_directory_uri() . '/mystyle.css' );    } }  add_action('wp_enqueue_scripts', 'enqueue_custom_style', 999); 

this should give idea


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -