Пример #1
0
 public static function singleton()
 {
     if (is_null(self::$singleton)) {
         self::$singleton = new self();
     }
     return self::$singleton;
 }
Пример #2
0
 public function header()
 {
     global $wp_query;
     $options = PostBackgroundPluginOptions::singleton();
     echo "<style type=\"text/css\">\n";
     if ($wp_query->is_single() || $wp_query->is_page()) {
         $postbackground = get_post_meta(get_the_ID(), 'postbackground', true);
         $this->rule('body', isset($postbackground['body']) ? $postbackground['body'] : array());
     }
     while ($wp_query->have_posts()) {
         $post = $wp_query->next_post();
         $postbackground = get_post_meta($post->ID, 'postbackground', true);
         $selector = $options->get_content_selector($post);
         $this->rule($selector, isset($postbackground['content']) ? $postbackground['content'] : array());
     }
     $wp_query->rewind_posts();
     echo "</style>";
 }