I got my first PC in 1980, before Windows (remember DOS any one?) In over 30 years of tinkering with PCs and networks, I have never run across Tech Support like I received from Rajiv at Enweby.
]]>I tried adding the background through Appearance–>Backgrounds and through a CSS rule (below). I’m obviously doing something wrong. Any suggestions are appreciated.
body {
background: url(‘https://www.angelshands.info/green/wp-content/uploads/2014/10/bg.jpg’) no-repeat center center fixed;
-moz-background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
I’m having an issue creating a full screen background for my WordPress theme that uses random images from the image library. I want to write a PHP function that can be used on multiple sites, so I can’t simply use the direct path in the code. It also needs to work on MultiSite in such a way that it only pulls images that are uploaded to that site. Here’s the code I’m working with:
HTML for my Background Div
<div id="background" class="background" style="background-image:url(<?php displayBackground();?>);">
</div>
PHP to randomize my image folder
<? php
function displayBackground()
{
$uploads = wp_upload_dir();
$img_dir = ( $uploads['baseurl'] . $uploads['subdir'] );
$cnt = 0;
$bgArray= array();
/*if we can load the directory*/
if ($handle = opendir($img_dir)) {
/* Loop through the directory here */
while (false !== ($entry = readdir($handle))) {
$pathToFile = $img_dir.$entry;
if(is_file($pathToFile)) //if the files exists
{
//make sure the file is an image...there might be a better way to do this
if(getimagesize($pathToFile)!=FALSE)
{
//add it to the array
$bgArray[$cnt]= $pathToFile;
$cnt = $cnt+1;
}
}
}
//create a random number, then use the image whos key matches the number
$myRand = rand(0,($cnt-1));
$val = $bgArray[$myRand];
}
closedir($handle);
echo('"'.$val.'"');
}
I know that my CSS markup is correct because if I give the DIV a fixed image location, I get a fullscreen image. Can anyone tell me what to do to fix it?
Also, I’m doing it this way because I don’t like the way the WPSupersize.js script affects the site styling.
]]>https://i.imgur.com/z8NDt0G.jpg
The problem is, varying screen resolutions are messing it up. Higher res screens will create a huge space between the robot and the content (which is completely right justified), and smaller screens crunch the image down and lay the content on top of it. Right now, the robot image is just a full screen background image.
My website is www.stereobotic.com, and my layout is “Sempress”.
How can I achieve this kind of layout across all monitors?
Any help would be greatly appreciated. I’m so eager to get this blog started, but I need to feel secure with my (1.0) look.
]]>First of all, great plugin! I was wondering if it is possible to set a standard background image on all pages and only change the image for certain posts or pages?
Regards, Niels
https://www.ads-software.com/extend/plugins/wp-backgrounds-lite/
]]>