WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #26386, comment 12


Ignore:
Timestamp:
01/28/2014 12:57:54 AM (8 years ago)
Author:
Shelob9
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26386, comment 12

    initial v1  
    1 I uploaded a patch 26386.2.diff​ that adds the filter I was talking about. Here is example usage:
    2 
    3      add_filter('custom_background_style', 'slug_full_screen_bg', 10, 2 );
    4      function slug_full_screen_bg( $style, $background ) {
    5      if ( $background != '' ) {
    6      $style = "background-repeat: no-repeat; -webkit-background-size: cover;-moz-background-size: cover;-o-      background-size: cover;background-size: cover;background-attachment:fixed;background-position:center;";
    7      $style .= " background-image: url('$background');";
    8      }
    9      return $style;
    10      }
    11 
    12 This example, to be used in a theme or plugin, creates a full-screen background if an image is set in custom backgrounds, and just outputs the background-color rule and value if none is set.