Guest User

Untitled

a guest
Feb 1st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2. $bg_url= '';
  3. $cats = get_terms('category');
  4.  
  5.       foreach($cats as $cat) {
  6.  
  7.         $term_id = $cat->term_id;
  8.  
  9.                 }
  10.  
  11. $bg_img = rwmb_meta( 'myprefix_cat_banner_image', array( 'object_type' => 'term' ), $term_id );
  12.     if(count($bg_img) > '0') {
  13.    
  14.     foreach ($bg_img as $img){
  15.         $bg =  "{$img['full_url']}";
  16.         $bg_url =  "background-image: url('". $bg ."');";
  17.     }
  18. $bg_pos = "background-position: " . rwmb_meta('myprefix_cat_banner_bgpos') . ";";
  19. $banner_text = rwmb_meta('myprefix_cat_banner_text', array( 'object_type' => 'term'), $term_id);       
  20. }?>
  21. <!-- ==== HEADERWRAP ==== -->
  22.         <div class="pagewrap row">
  23.                 <div class="pagewrapcolor col-md-5 col-lg-5 col-sm-12" style="background-color:<?php echo rwmb_meta('myprefix_cat_bg-color', array( 'object_type' => 'term' ), $term_id);?>;">
  24.                     <?php if ($banner_text != '') {
  25.                     echo $banner_text;
  26.                 } else {
  27.                      echo '<h1 id="site-description">'.get_bloginfo( 'description', 'display' ) .'</h1>';
  28.                     }?>
  29.                 </div>
  30.                 <div class="pagewrapimg col-md-7 col-lg-7 col-sm-12" style="<?php echo $bg_url.$bg_pos;?>">
Add Comment
Please, Sign In to add comment