Post to inherit custom category background image from parent

You can use this function to output the parent category ID and then style off of that. <?php function wpse_74737_category_top_parent_id($catid) { while ($catid) { $cat = get_category($catid); $catid = $cat -> category_parent; $catParent = $cat -> cat_ID; } return $catParent; } And then call this in your body class: <?php echo wpse_74737_category_top_parent_id( $cat->term_id ); ?>

Random home page background images with caption text

First of all I don’t think that create a custom post type only for backgrounds is a right choose: backgrond are images and images already have their post type: attachment. If you have Worpress 3.5+ you can register a custom taxonomy for attachments, call it, e.g. ‘image_scope’ : register_taxonomy(‘image_scope’, ‘attachment’, $args ); for the $args … Read more

How to change the background color of my header dynamically based on a Custom Posts types color value?

Because my neighborhoods were the only pages that required custom header colors i decided to just include its custom header within the single-neighborhood.php page so that the top header container, that was wrapping the navigation, logo, etc., would reflect the custom color chosen from the custom fields in the admin. It was the only way … Read more

Restrict size of custom background image

There are two parts to the answer: You can set the size of images using add_image_size. This is done in your functions.php. add_image_size( ‘background-image’, 900, 500 ); //900 px wide 500px high – no crop Once this is set you will need to regenerate your thumbnails. There are number of great plug-ins that can help … Read more

Random sidebar/widget background

Place the following code above the DOCTYPE in header.php: <?php $bg = array(‘bg-01.jpg’, ‘bg-02.jpg’, ‘bg-03.jpg’, ‘bg-04.jpg’, ‘bg-05.jpg’, ‘bg-06.jpg’, ‘bg-07.jpg’ ); // array of filenames $i = rand(0, count($bg)-1); // generate random number size of the array $selectedBg = “$bg[$i]”; // set variable equal to which random filename was chosen ?> Now place this code within … Read more

Custom Background default color not changing

I have hunted down the problem. It is the _custom_background_cb function in wp-includes/theme.php file. on line 1272 the comment “A default has to be specified in style.css. It will not be printed here.” Line 1272 is where the color is being retrieved: $color = get_theme_mod( ‘background_color’ ); If we change that to: $color = get_theme_mod( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)