Hi Corpse, I will want to know how I can make more than one logo with my style.css
Thank you Corpse
Thank you Corpse
What do you mean, "more than one logo"?
If your talking about having it randomly change on each page refresh, then there are several different ways, it really depends on your theme and how its set up and how you really want to go about it. You could do it with jquery, and CSS, or you can do it with PHP and CSS. Me personally, to make it easier on myself, I would just do PHP and an array. Then make the images and do it that way. But I can't say exactly how to do it because each theme is different and it really depends on your theme.
If your talking about having it randomly change on each page refresh, then there are several different ways, it really depends on your theme and how its set up and how you really want to go about it. You could do it with jquery, and CSS, or you can do it with PHP and CSS. Me personally, to make it easier on myself, I would just do PHP and an array. Then make the images and do it that way. But I can't say exactly how to do it because each theme is different and it really depends on your theme.
Ok I will look if I find a tutorial!
This is a theme I bought on clantheme (bf4_xtreme)
This is a theme I bought on clantheme (bf4_xtreme)
well, if you pack up the header file or the theme itself and send it to me, I can code it in for you.
The way I would do it is like this:
then where the image is displayed, I would display the logo using the URL and $displayed_logo, sortof like this.
(HTML Version)
(PHP Version)
But each theme is different and the logo could be a background image instead, or, something else may be different where a slight rewrite of the header may need to be edited/changed.
Note:
But one thing to keep in mind is to make each image the same size in width and height.
The way I would do it is like this:
PHP: [ Select all ]
 $ran_logo = array('logo_1.png', 'logo_2.png', 'logo_3.png', 'logo_4.png', 'logo_5.png' ); // array of filenames
 $i = rand(0, count($ran_logo)-1);
 $dispalyed_logo = "$ran_logo[$i]";
then where the image is displayed, I would display the logo using the URL and $displayed_logo, sortof like this.
(HTML Version)
PHP: [ Select all ]
<img src="./themes/Your_Theme/images/<?PHP echo $displayed_logo; ?>" width="500px" height="150px" alt="">
(PHP Version)
PHP: [ Select all ]
echo '<img src="./themes/Your_Theme/images/'. $displayed_logo .'" width="500px" height="150px" alt="">';
But each theme is different and the logo could be a background image instead, or, something else may be different where a slight rewrite of the header may need to be edited/changed.
Note:
But one thing to keep in mind is to make each image the same size in width and height.
Last edited by coRpSE on Mon Feb 05, 2018 8:02 pm; edited 1 time in total
MP send with file
Okay, Here is an example, let me know if this is what you were looking for.
My Testsite:
In the left blocks, you will see a "Theme Changer" block. Just select the BF4_Multi, and once you have that theme selected, look at the logo image and hit refresh a few times, you will see it change randomly. I have Test Image 1 through Test Image 5. If thats what your looking for, then the way i did that is by editing 2 files.
Open you public_html/themes/BF4_Multi/style/style.css and find
Remove the background: url("../images/header/logo.png") no-repeat; line so it will look like:
Save & Close
Now, open up
public_html/themes/BF4_Multi/theme.php
Find:
On new line before, ADD:
Next, Find:
Replace with:
Save & Close
Now, what you want to do is upload all your logo images into the folder
public_html/themes/BF4_Multi/images/header/
Then, you will see in the edit above, a line that looks like this:
$rl = array('logo1.png', 'logo2.png', 'logo3.png', 'logo4.png', 'logo5.png');
In between each of the quotes, ('), you want to put in the name of the image and the file type. You really want all your images as .png images and keep them the same size as the default one, which is 968 x 200.
My Testsite:
Please login to see this link Get registered or Log in |
In the left blocks, you will see a "Theme Changer" block. Just select the BF4_Multi, and once you have that theme selected, look at the logo image and hit refresh a few times, you will see it change randomly. I have Test Image 1 through Test Image 5. If thats what your looking for, then the way i did that is by editing 2 files.
Open you public_html/themes/BF4_Multi/style/style.css and find
Code: [ Select all ]
#headerlogo {
background: url("../images/header/logo.png") no-repeat;
width:968px;
height: 180px;
margin:0 auto;
}
Remove the background: url("../images/header/logo.png") no-repeat; line so it will look like:
Code: [ Select all ]
#headerlogo {
width:968px;
height: 180px;
margin:0 auto;
}
Save & Close
Now, open up
public_html/themes/BF4_Multi/theme.php
Find:
PHP: [ Select all ]
echo '<div class="headbg">';
On new line before, ADD:
PHP: [ Select all ]
 $rl = array('logo1.png', 'logo2.png', 'logo3.png', 'logo4.png', 'logo5.png');
 shuffle($rl);
 $displayed_logo = array_rand($rl, 1);
Next, Find:
Code: [ Select all ]
<div id="headerlogo"></div>
Replace with:
Code: [ Select all ]
<div id="headerlogo" style="background: url("../images/header/'. $displayed_logo .'") no-repeat;"></div>
Save & Close
Now, what you want to do is upload all your logo images into the folder
public_html/themes/BF4_Multi/images/header/
Then, you will see in the edit above, a line that looks like this:
$rl = array('logo1.png', 'logo2.png', 'logo3.png', 'logo4.png', 'logo5.png');
In between each of the quotes, ('), you want to put in the name of the image and the file type. You really want all your images as .png images and keep them the same size as the default one, which is 968 x 200.
Corpse, look at my capture we can put here the logo because several site put it here.
Thank you Corpse.
Thank you Corpse.
What capture?
Clear your browser's cache and go back to here and check to see if that's what you're looking for.
Again, make sure your on the BF4_Multi theme.
Please login to see this link Get registered or Log in |
Again, make sure your on the BF4_Multi theme.