I would like to use a different logo for my mobile version.
I found out that you add another logo in your HTML source code and then define in CSS which logo is shown based on page size.
My problem is that I use Wordpress and can't really access the source code. I can only write something in the functions.php file.
My logo is places in the navigation bar, which makes it more difficult, too.
Would be soooo thankful for any help :)
Daniel
My Page
Yes you can use media queries to do that for example :
.mobile-logo-class {
display:none;
}
#media screen and (max-width: 768px) { // 768px or your break point
.mobile-logo-class {
display: inline-block; // or block
}
.desktop-logo-class {
display:none;
}
}
Or you can use the "Picture" tag but be careful for IE Support:
https://webdesign.tutsplus.com/tutorials/quick-tip-how-to-use-html5-picture-for-responsive-images--cms-21015
In normal case, if your theme provides the options for mobile logo then you can upload different logo for your mobile sections,
if there are not options for the mobile logo into your theme then you can use media queries to set the path for mobiles width
or
you can use the plugins to show different logo for your website in mobile something like this.
https://wordpress.org/plugins/rocket-wp-mobile/
STEP 1: OK first copy the code of logo in your header file which one calling the log on your desktop, copy the code and paste it below the same dive now remove the PHP code and change the div class, and give there <img src=" your image path"> and save it. you can write HTML too for image
STEP 2: Now in CSS use CSS for hiding it. something like
.logo2-img {
display: none;
}
here logo2 is your 2nd div class .
STEP 3: Now write css with media query
#media screen and (max-width: 768px) { // 768px or your break point
.logo2-img{
display: block; //
}
.desktop-logo-class {
display:none;
}
}
thats it sorry for poor English
Related
I created my website using Bootstrap and then converted it to WordPress: My website. I'm not new to Bootstrap, but am new to WordPress.
I'm having a problem that I just can't solve: When I look at the blog page or any of the posts pages in mobile view, there's a huge padding at the top of the post header.
I've tried modifying my CSS file to reduce padding at the top of the heading:
.entry-header {
padding-top: 10px;
}
but it's just not working.
The problem is not with your padding but with your #sidebar div. The sidebars height is causing the mobile issue.
As you are hiding all of the content in your sidebar you might as well hide the whole sidebar on mobile using a media query.
Add this toward the bottom of your css:
#media only screen and (max-width: 767px) {
#sidebar {
display:none;
}
}
I have this function in my tile.twig file that shows one post on a carousel. It works fine on portrait mode on mobile.I need it to show 2 post when it is in landscape. But I do not know how to do this in twig/PHP here is the code:
{{ fn("do_action", "render-carousel", style|default('header-carousel'), carousel_list|default("Header Carousel"), img_size|default("mobile/feed/large"), carousel_show|default(1), extra_options) }}
I need the carousel_show|default(1) to be carousel_show|default(2) when in landscape mode. Any ideas
Unfortunately, it's difficult, and not performant at all, to "tell" PHP that your device is in portrait or landscape mode, and to render different amounts of HTML accordingly.
I believe you're probably a bit stuck as you're using a plugin to render the carousel and therefore don't have control over the CSS or JS.
If you'd written the carousel yourself. You'd use media queries in CSS:
#media (orientation: landscape) {
.carousel-slide {
width: 50%:
}
}
#media (orientation: portrait) {
.carousel-slide {
width: 100%
}
}
You'd also need to tell your carousel code that you're displaying either one or two slides intially:
if (window.matchMedia("(orientation: portrait)").matches) {
Carousel.init({startingNumberOfSlides:1})
}
if (window.matchMedia("(orientation: landscape)").matches) {
Carousel.init({startingNumberOfSlides:1})
}
It sounds like you won't be able to achieve this effect with the carousel plugin you're using.
Thanks,
Jon
I am trying to figure out a way to do this using both server and client (or maybe just client?) side code based on the browser width. What I want to do is take a carousel from bootstrap and populate the slide portion with images from the server.
This is easy to do when the browser is of one size, its a simple sql query and a loop.
But now imagine you can have an image for 1024+, and image for 768, an image for 480px and finally an image for 320px (these are all the same image, just at different widths). How would I use php and css to create a carouse that loads one image for 1024+, then once you get down to 768px it swaps that image out for one of an appropriate size, same for 480 and 320.
I haven't tried anything other then storing the images, because to be honest I am not even sure how to approach this.
How would you accomplish this?
Would it be an option to use media queries in CSS? Although content: url(...) for dynamic images aren't supported in all browsers you can play with background url() property of a div.
To give you an impression:
#media (max-width: 320px) {
#slide1, #slide2, #slide3 {
background:url("http://lorempixel.com/512/256");
}
}
#media (min-width: 320px) {
#slide1, #slide2, #slide3 {
background:url("http://lorempixel.com/1024/750");
}
}
#media (min-width: 1024px) {
#slide1, #slide2, #slide3 {
background:url("http://lorempixel.com/1920/1025");
}
}
See this fiddle in action with a fullscreen bootstrap carousell
I have wordpress sidebar with:
<h3 class="widget-title">TITLE OF SIDEBAR</h3>
and I need show small icon before "TITLE OF SIDEBAR. Can I do with CSS?
Or I must manually add image into code? like:
<h3 class="widget-title"><img src="">TITLE OF SIDEBAR</h3>
Pseudo elements will do what you want. Using the :before pseudo element, your CSS would look like this:
h3.widget-title:before {
content: url('/path/to/image');
}
This will place an image before the text content of the <h3>, however this won't change the DOM at all which is important to note.
A good explanation of how pseudo elements work can be found here, on CSS Tricks.
If your image is 10px wide, you could try this:
.widget-title {
background: url(smallicon.png) left top no-repeat;
padding-left: 10px;
}
Keep your h3 tag without including img tag, and do the following:
h3.widget-title {
position: relative;
padding-left: <width of the icon image>;
}
h3.widget-title:before {
content: '';
width: <width value>;
height: <height value>;
position: absolute;
left: 0;
display: block;
background: url(<path of the icon image>) no-repeat;
}
.widget-title:before {
content: url(path/to/image.png);
}
You can find more information at https://developer.mozilla.org/en-US/docs/Web/CSS/content.
h3:before {
content: url('https://www.google.com/images/srpr/logo4w.png')
}
Sample http://jsfiddle.net/KCXVM/
Yes, you can do it in CSS.
Simply use the :before pseudo-selector, like this:
widget-title:before {
content:url('imagename.png');
}
Or, of course, use h3:before { ... } for it to apply to all h3 elements.
Here's a working example for you
Browser compatibility: This works in all common browsers, except IE7 or earlier.
Why not simply apply the image as a background?
.widget-title {
background: url(...) no-repeat 50% 0;
padding-left: 20px;
}
So, at first, I thought a <span> thing would work.
Then, I tried this, and it worked seamlessly:
h3:before{
content: url('your url');
}
You can add icon before each h3 heading in CSS by following these ways below (via OIW Blog):
- Use Glyphicons of Bootstrap
If you are using Bootstrap then you can use Glyphicons to add icons to the desired title or text.
Bootstrap contains a diverse set of icons, to pick up a suitable icon you can take a look at here: https://getbootstrap.com/docs/3.3/components/. Once choosing a desired icon, adding it to theme is a piece of cake. You just need to add the card after the location that you want your icon to be displayed
<span class="glyphicon glyphicon-ok"></span>
Notice that the icon I added is “ok” so its class shall be “glyphicon-ok”. Each icon (in the list I mentioned above) is compatible to a different class.
- Use icons of existing Cheatsheet of the currently used Font or third party
If your website don’t use Bootstrap or the current set of icons of Bootstrap doesn’t meet your need (despite containing a lot) (Glyphicons of bootstrap has displaying errors on IE10 of Window Phone OS). After that you can check what font of the website you are using is and find out if it has an icons Cheatsheet library or not. For example: Elusiveicons, Fontisto, Material Design… are some of the fonts that have icons Cheatsheet which are for immediate use.
If your currently used font of the website has Icons Cheatsheet then you can have a set of icons of the third party. Here I would like to introduce “Font Awesome Icons”. This is a good-looking and popular set of icons.
To use this set of cons, you need to add this code to the head section in your website:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
– After adding CSS, you can use this code to put in the HTML which shows icons (you can apply this method to the part you use Cheatsheet of the font as mentioned above. Some fonts have unique way of using)
<i class="fa fa-edit"></i>
– If you don’t want the code in the HTML, you can just use CSS. With CSS you need to find the Class or ID of the part that displays icon and after that use the below CSS code to display it. Here I display the EDIT icon of the third party “Font Awesome Icons” before (::before) the title, along with 2 properties of padding-right and font-style (you can also display it after the title by using after property):
span.last-updated-time::before {
font-family: "FontAwesome";
content: "\f044";
padding-right: 5px;
font-style: normal;
}
Notice: the code of content is hexadecimal code. You can find and replace it with the code of the currently used icon. With “Font Awesome Icons” you can find it here: https://fontawesome.com/cheatsheet
I am using a responsive Slideshow module - Lof ArticlesSlideShow (DEMO) .
How can I hide the "Navigator" part (the scrolling rows of articles with thumbnails) when I resize the window to a smaller size.
Right now, if I re-size the browser window to my mobile's display's size (Motorola Defy+), the navigator part will come over the image,title and introtext . Opened the demo link on the mobile browser and same effect.
Since the link to the article is on the title, which becomes hidden under the navigator, the article page cannot be accessed.
Any idea?
Try adding this to a custom CSS file or current one:
#media screen and (max-width: 480px) {
.lof-buttons-control {
display: none;
}
}
This means that the maximum width of the screen, till this code starts to kick in is 480px. From then on, it hides the Navigator part.
Hope this helps
#Lodder - AMAZING!!!!!!!! :D
I replaced .lof-buttons-control with .lof-ass .lof-navigator and it worked :D
#media screen and (max-width: 480px) {
.lof-ass .lof-navigator {
display: none;
}
}
It means a lot!!!!