WordPress.org

Forums

Custom Background Extended
Works perfectly, but... (3 posts)

  1. inflatabill
    Member
    Posted 1 year ago #

    This plugin works out of the box, and does exactly what it says it will do.

    It has options for controlling the position of the image: repeat, horizontal position, vertical position, and fixed vs. scrolling. It even has the option for selecting a background color.

    What's missing is the one feature I need, which is the option to scale the image to fill the entire page. I was able to remedy this with a single CSS statement, but it would be nice to do it with JS for greater browser compatibility.

    It's a great plugin, nonetheless!

  2. Jurjen
    Member
    Posted 3 months ago #

    It's easy. Open inc/class-custom-backgrounds-filter.php

    Then, look for:

    /* Output the custom background style. */
    		echo "\n" . '<style type="text/css" id="custom-background-css">body.custom-background{ ' . trim( $style ) . ' }</style>' . "\n";

    And replace it by:

    /* Output the custom background style. */
    		echo "\n" . '<style type="text/css" id="custom-background-css">
    	body.custom-background{ ' . trim( $style ) . '
    	-webkit-background-size: cover;
    	-moz-background-size: cover;
    	-o-background-size: cover;
    	background-size: cover;}</style>' . "\n";
  3. Justin Tadlock

    Plugin Author

    Posted 3 months ago #

    There are proper ways to extend plugins like this one using the core WP APIs. Any code changes directly to the plugin like the one above will be lost when the plugin is updated and is dangerous in the wrong hands.

    Also, the CSS code can be added directly to your theme's style.css file.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Background Extended
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.