Allow visitors to call you easily

In the last blog post I wrote about how to customize a web font to add some social media icons to your website. In the project was I’ve mentioned there was the wish to add an icon to call the site’s owner.

Protocols to call from a website

In order to allow visitors to call a number, you simply have to wrap it into a link and use the tel protocol. A link would look like this:

<a href="tel:+1-555-2401">555-2401</a>

In this example, I have used the country code for the US. This is technically not necessary, but it helps when the number might be used from visitors outside of the US. You can add dashes to make the number more readable, but you can also write it like +15552401. The link text can be in any format. It could also be some text like Call us, just as with any other link.

What happens, when clicking the link?

On a mobile phone, as soon as a visitor clicks the link, it will either directly call the number or ask for the app to use, if there is more than one app (like the regular phone app and Skype installed).

And what about desktop browsers?

Even on a desktop browser you can use such links. Here is an example of Chrome, with a left click on the link:

If you have a mobile phone connected to your profile, you can send the phone number from the link to your mobile. Alternatively you can pick another app.

On a right click you can also send the phone number to your mobile, but you don’t habe the option to use a different app:

Alternative protocols

The tel protocoll works for regular phone calls on mobile and desktop. On mobile phone, you can usually also pick a different VoIP app, such as Skype. But on desktop browsers, Skype is not offered. If you want visitors to use Skype, you can use the callto protocol.

There are also the protocols sms and fax, but the browser support is still quite limited.

Conclusion

Offering a link for your visitors to call you is really easy and helps to improve the user experience of your website. You can find an overview on the different browser behaviours and tips and tricks to style such links on CSS-Tricks. So why don’t you add such a link to your website, if you don’t already have one?

Optimize icon web fonts for your needs

On almost any modern website you find icons. They are often used on links to social media profiles. Many WordPress themes come bundled with such a web font for icons. Nowadays I usually always use SVG symbols instead of icon web fonts when building a theme from scratch. But when customizing a theme, you might have to still use them.

Load web fonts locally

Many website owners embed fonts locally due to the GDPR. For this purpose they download the web font and put it into their child theme. Tha’s a perfect time to think about which icons you really need and which not. Icon fonts for social media profiles are a good example on why you might want to customize the font you are including.

Customize a icon web font

Let’s take the popular Font Awesome as an example. It contains 1544 icons with 433 icons for brand such as social media. But do you really have a profile on all of them? If not, it might be worth to only load those icons you really need. With an SVG sprite, that would be as easy as removing al unnecessary symbols from the file, but with web fonts it’s a bit harder.

Online service for font customization

For a friends website I had to add some social media icons the web font bundled with the theme was not providing. So I had to use Font Awesome instead. While searching for a way to use just as few icons as possible I’ve found site Fontello, which offers a variety of icon font. One of them was Font Awesome.

On that website you can simply use the two searches to search for font names and icon names. Then you multi-select all the icons you need. Maybe add some you might need in the near future as well.

On another tab you can even customize the names of the icons in the resulting files and the unicode values. Then simply download your selection, which will contain the web font in different formats as well as some CSS files with the necessary definitions.

Saving a lot of bandwidth

But how much can you safe? Font Awesome uses 3 files for different icon types with 5 formats each. The woff2 files add up to around 165kB. The minified CSS file adds another 57kB.

For that friends website, I only needed 9 icons and woff2 file less then 4kB with another 2kB CSS (unminified), which can be reduced to 1kB (minifed).

In total 2 files/requests and almost 98% in bandwidth (217kB) could be saved.

Do optimize your fonts!

As you can seen, there is a huge potential to safe bandwidth and make your site load faster. The only issue you have to deal with is updating that reduced font, once you need a new icon.

When using Google Fonts, you can use the text parameter to define the characters you need. Unfortunately on Google Fonts you don’t find icon web fonts and I have not found an online service offering a similar functionality. If you know of such a website, please leave a comment below.

Compiling SASS in PhpStorm automatically with a file watcher

In the first post of this litte blog series I showed you how to install SASS manually and how to compile it using the terminal. But this way is not very user friendly and you could easily forget to start the compiler/watch when working on a project.

Adding a file watcher

The easiest way to add the file watcher is by just opening a SASS file. PhpStorm will recognize it and show you a little Notification above the file content. Just click the „Yes“ link and the settings screen will open:

If you don’t see the notification, you will find the option to add a file watcher at „File | Settings | Tools | File Watchers“. Here you just click the green plus icon to add a new file watcher and choose SCSS (not Sass, as this would be a file watcher to .sass files, the alternativ syntax, which is less frequently used):

Adjusting the file watcher settings

The default settings are quite good. PhpStorm will most probably find the path to your sass executable. In my case it’s a Windows file path:

One of the options I usually change is the „Arguments“ setting. I prefer the expanded output style and not the default nested one, as it looks more like CSS you would usually write manually. My „Arguments“ setting looks like this:

--style expanded --no-cache --update $FileName$:$FileNameWithoutExtension$.css

Conclusion

That’s all. Now every time you change your SCSS files (you don’t even have to save them explicitly with the default settings), your files will be compiled into CSS files. The file watcher will even recognize if you change a file that is imported into another file. If you don’t know what that means, just wait for my next blog posts, were I will explain some of the fundamentals of SASS.

Note: If you use the „Tools | Deployment“ of PhpStorm to deploy to a FTP server, make sure you activate „Upload external changes“ in the „Options“ settings, as otherwise the compiled CSS file would not be uploaded.

An intense year in review

First of all, Happy New Year to all of you! I hope you all made it well to 2018. Since you probably recognized, that I haven't blogged in the past weeks, I want to give you a small review of the past year and the plans for this year.

#Project52 bilingual

In 2017, I planed to continue to blog once a week. But unlike before, I wanted to blog English first and then translate the blog post to German the other week.

For the first 11 month it worked out really well. I blogged at least once a week and created some new plugins along the way. And then came December and the question if I could do an advent calendar in two languages.

The 2017 advent calendar

You might call be crazy or too ambitious, but I started another advent calendar for the third year in a row, with no blog posts prepared beforehand. The first 9 days went really well. Somethimes I posted them a bit after midnight, but I came up with some topics to write about. But then my streak ended.

Making priorities

After all, blogging is just a hobby for me. I really enjoy sharing knowledge and get feedback on it. But there are more important things in life and this year friends and family needed me more then my readers. So after about a week of not having the time to blog, I decided to give up on blogging for the rest of the year, as writing all the missing posts would probably have burned me out.

Plans for 2018

So what are my plans for this year? With my last posts from December 10, I started a little blog series. Although the initial reason is no longer there, I think it will still be a nice little series. I do want to blog bilingual as well this year. And I again want to do an advent calendar in 2018. Maybe I succeed in preparing some blog posts before December 1 😉

If you have any topics you want have covered and you think I could write about, just let me know in the comments below. And if you also have a new years resolution and are brave enough to tell us, please leave a comment as well 🙂

I am wishing all of you all the best for 2018 and I also hope to see some of you on an upcoming WordCamp somewhere.

  • Veröffentlicht in: Misc

Getting started with SASS

This is going to be the start of a small series of blog posts. I am not spoiling too much of the end result, but it has something to do with the special seasons of the year. The idea to this series is based on the wish for a blog posts by a very good friend. And I wanted to take the chance to introduce you into SASS. So before get to the actual code, let's start with the basics.

Installing SASS

SASS is an acronym for "Syntactically Awesome Style Sheets". You could see it was "coding in CSS". To use SASS, you write code which will then be compiled into normal CSS. To compile it, you have different options.

Using the official ruby gem

SASS was originally written in ruby. So to get started with this version, you have to install ruby first. On Windows, the easiest way it to use the RubyInstaller. On Mac you might want to you Homebrew with the following command:

brew install ruby

If you are on linux, your package manager most likely has a ruby package available. I would suggest to use ruby 2.2 and newer, but an older version might also work.

To install SASS, you simply have to install the ruby gem (the SASS "package" for ruby) with the this command:

gem install ruby

Now you should be able to run the ruby command in your terminal.

Using grunt

If you are familiar with grunt, you can also install a SASS package and use this to compile your files. It comes in two flavors. One package is using ruby while the other one is using libsass, a JavaScript implementation of SASS. For the ruby package, install this package:

npm install grunt-contrib-sass --save-dev

For the libsass version, which lacks some features of the ruby variant, use this package:

npm install grunt-sass --save-dev

Using gulp

If you preferred task runner is gulp, things a very similar to the grunt setup. For the libsass version, use this package:

npm install gulp-sass --save-dev

There is also a ruby version, but I am not sure if it's still actively maintained:

npm install --save-dev gulp-ruby-sass

Compiling SASS

Once you have SASS installed, you can compile a SASS file to normal CSS with this command:

sass style.scss style.css

This example is using the alternative SCSS syntax, which is more popular, as it is quite similar to CSS. This command will compile the file only once. As you don't want to run this command after every change you've made to a file, simply run the "watcher" which will compile the SCSS file on every detected change (usually when saved):

sass --watch style.scss:style.css

For more options, take a look a the official documentation.

Conclusion

You should now be able to use SASS to improve your CSS development process. In the next blog post I will show you how to integrate SASS into PhpStorm, an IDE many developers are using nowadays.

Correct quotes in WordPress

Different languages use different quotation marks. In English, is usually looks like this: “…”. In Germany it looks like this: „…“. And in French they use other symbols: « … ».

Correct typography is not always easy to get, especially when you can't type those symbols using your keyboard (even with the correct language set up). But where is a way to help you, at least in blockquotes.

CSS for quotes

You can define some CSS which would automatically put the correct quotes on a q element (usually inside of a blockquote element). There is a default to that property implemented in the browser. Just add this:

 q { quotes: "\00ab" "\00bb" "\2039" "\203A"; } 

This example defines the two variants of French quotes (as quotes can have "inner quotes" as well).

Using the HTML element

But there is an easier way. Just don't define anything specifically and let the browser handle the correct quoting. All you have to do is to set the correct lang attribute on the document.

<html lang="fr">
    ...
</html>

Now you can just use a q element and the quotation marks will match the defined language.

Fixing quotes in WordPress

WordPress is adding the lang attribute to the HTML tag, but unfotunately it is using the "four digit local", so instead of "fr" it is using "fr-FR" which will break the quoting for most browser. That's why I have written a small plugin to fix that.

This blog is now ad-free

As of today, I have removed all ads from this blog. I've used Google AdSense almost since the beginning of this blog. I have also experimented with some other advertisements and until today I had two banners to the affiliate program of my web hoster (clearly noticable as ads) on my blog.

Why I put ads on this blog

Running a self hosted blog comes not for free. The costs for hosting and domains increased over time, as more performance was needed and more websites were run on this single web server. I tried to cover some of these costs putting ads on my website. In the first years, I probably only got around 15% from costs back.

Why I removed all ads

In yesterdays blog post I wrote down my feelings about affiliate links in support forums and groups. I really don't like this. I also don't like websites which are full of ads, expecially within the content. That's why I tried to put them in places where they don't distract too much.

But with ads comes also a lot of overhead. I just check my blog before I removed the ads and it had around 70 requests from 19 different domains and weight around 1MB. After removing the ads, it only has 30 requests from 9 different domains and weighs aroud 640KB.

But not only the size was one of the reasons I planed to remove the ads. The privacy of my visitors is important to me as well as the security, as ads can be exploited.

How will I finance my blog

Last year I was able to cover all costs through Google Ads (43%) and the second monetarization: VG Wort. This is the german "collecting society" for authors (57%). Now that I drop one of them, I have to cover the costs in other ways. As I host the websites of some friends on my server, I can divide the costs a bit.

How do you finance your blog or website?

What do you do to cover the costs of your personal website? Do you also use some form of advertisements or affiliate programs? Do you use crowd funding plattforms or similar things? For me, only VG Wort and my wishlist will be left for the moment.

Selfish WordPress support

I love the WordPress community. They are wonderful people and I enjoy it very much to attend as many WordCamps in new cities/countries as I can to meet even more new members of the global community.

That also the reason I really like to give support in various ways. I organize WordCamps and meetups, I contribute to different Meta teams and I answer questions in some Facebook groups.

Helping others … or rather yourself?

As the holiday season is near, many companies offering WordPress related products and services offer some great deals. But just today I had another negative incident in a Facebook group. A member was posting a special deal on a well-known premium theme. This is great, right? Anyone will make a good deal. Not really. The one persons that benefits the most is the one who posted the link. Because it turns out that it was an affiliate link.

Stop selfish help!

Maybe I am too altruistic. But I really get angry when someone is just "helping" others to benefit from that help. I have no problem with freelancers and agencies offering help and being paid for that, if they deliever a real value for an individual problem. But posting affiliate links in Facebook groups just isn't right in my opinion.

Your thoughts?

What do you think? Are you also annoyed by this type of help? Or am I just overreacting on this topic?

Gutenberg test

On my way to WordCamp Cologne, I tested the new Gutenberg editor for the first time. As I didn't just wanted to type some random text, I wrote a small blog post about how I just use the editor and what experiences I have while using it.

The blog post was written in German and I am not quite sure if I should just translate it. Why don't you head over to my German site and check it out?

At WordCamp US last weekend there was a live demo of Gutenberg in the "State of the Word" and I realized how few functions I am currently using.

So to get more familiar with Gutenberg I installed him on this blog and I will try to write my new blog posts with him.

Insert shortcodes into sidebar widgets

Shortcode can be very useful, when you want to insert dynamic content into a static page or a post. WordPress is offering some internal shortcodes such as the

shortcode (which is usually rendered in the backend). By default, shortcodes can only be used in the main content of a page or a post.

Insert shortcodes using the Text or HTML widget?

One might think, that you can simply use the Text or the HTML widget. This is possible for some shortcodes, but many of them will not work. The gallery shortcode fails on both and the syntax highlighting shortcode produces incorrect code or fails completely.

The Shortcode Widget plugin

As usually always with such issues, someone else already had the same problem and found a solution. The plugin Shortcode Widget was written just for that one task. When you install and active it, you will find a new widget, quite similar to the old text widget, with only a title and a textarea. In this textarea you can paste ans shortcode you want to use in any of the widget areas.