Tuesday, February 18, 2020

Mark Zuckerberg Reveals Unexpected Personal Feelings About Government Regulations Over Facebook

We are living in a day and age where everything is quite new and this is basically why so many people are worried about how companies that are becoming more and more influential every single day will be held accountable if they ever cross a line or end up causing a lot of harm. Facebook is a...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Zia Muhammad via Digital Information World

Bootstrap CSS Form Style 29

The post Bootstrap CSS Form Style 29 appeared first on Best jQuery.


by Admin via Best jQuery

Bootstrap CSS Tab Style 79

The post Bootstrap CSS Tab Style 79 appeared first on Best jQuery.


by Admin via Best jQuery

How to Add Custom CSS to Your WordPress Site

The WordPress ecosystem is huge, so it can be a challenge to find the perfect theme to match your brand in every respect. A good starting point is by browsing the thousands of high-quality WordPress themes on ThemeForest

However, it frequently happens that you find an almost perfect design but you still want to tweak it a little—or a lot. Although most WordPress themes come with built-in options that let you modify basic things such as typography and colors, sometimes you want to make bigger changes. This is when you need to add custom CSS to your WordPress site. 

In this tutorial, we'll look at four techniques for adding custom CSS to WordPress:

  1. using the Customizer
  2. with a plugin
  3. editing the style.css file of your child theme
  4. editing the functions.php file of your child theme

The first two techniques don't require you to create a child theme. You can do everything from your WordPress admin, without touching the source files or connecting to your server via (s)FTP. Both are excellent methods that allow you to quickly add custom CSS rules to your site.

However, if you want to make significant changes, it can be a good idea to create a child theme—even if it takes more work to set it up. Besides directly adding custom CSS rules to your WordPress theme, you can also safely enqueue external CSS files with the help of a child theme.

1. Add Custom CSS to WordPress Via the Customizer

When you add custom CSS to your WordPress site via the Customizer, your custom CSS will be tied to your theme. You can keep the customizations as long as you are using the same theme. Your modifications won't be deleted when you update the theme, either. However, when you switch to a new theme, your additional CSS rules will be lost. (If you want to add theme-independent CSS to your WordPress site, you will need to use a plugin.)

You can open the Customizer by clicking the Appearance > Customize menu in the left sidebar of your WordPress admin area.

Open the Customizer

As the Customizer shows a live preview of your site, you can immediately see the changes you are making. For example, here's how it looks like with the Twenty Twenty theme:

Customizer Live View

You can see the Customizer sidebar on the left of the screen. Here, navigate to the last menu item called Additional CSS. This is where you can insert the custom CSS you want to add to your theme. You only need to type your style rules into the text area below the instructions:

Additional CSS box in Customizer

Say you want to change the font-size property of the headline. By default, the theme options of Twenty Twenty don't allow you to do that. The easiest way to find out which CSS rule you need to override is by using your browser's developer tools. Right-click the headline and choose the Inspect or Inspect Element option (depending on your browser) to open your DevTools' inspector right at the headline element: 

Inspect headline with Firefox DevTools

The inspector tool will show you that the Twenty Twenty theme uses the following style rule to control the font-size of the headline:

As most DevTools also show the file name and line number (style.css – line 4716 on the image below) of every style rule, you can also open the CSS file in your code editor and check out the exact code.

Find CSS to override in DevTools

Now, you can override the font-size rule by inserting the same CSS rule with a different value into the Additional CSS input field, for example:

Custom CSS added via Customizer

As the Customizer shows a live preview, you can see the effect of the new rule right as you are typing it. 

Note that if you want to keep your theme responsive, it's important to pay attention to media queries. You can test the theme for different screen sizes using the little device icons (desktop, tablet, mobile) at the bottom of the Customizer sidebar.

Once you've added all the custom CSS rules you wanted, you can hit the Publish button on top of the Customizer sidebar and your changes go live immediately.

2. Add Custom CSS to WordPress With a Plugin

The biggest advantage of using a custom CSS plugin is that it allows you to add theme-independent CSS to your site that you can keep when switching to a new theme. This technique can be useful when you want to modify the look of theme-independent content added by a plugin, such as an extra page, a custom post type, or a widget.

Besides, if you want to add a lot of custom CSS to your site, you might also find that a plugin's settings page and UI is more user-friendly than the tiny input field of the Customizer. On the downside, note that these plugins can slow down your site, as they add extra overhead to the page load time compared to the Customizer which is built into the WordPress Core.

In the WordPress.org plugin repo, you can find a couple of free plugins that let you add custom CSS to your WordPress site. In this tutorial, we will use Simple Custom CSS that works without any further configuration. 

You can install the Simple Custom plugin from the Plugins > Add New menu of your WordPress admin area: 

Install the Simple Custom CSS plugin

After installing and activating the plugin, click the Appearance > Custom CSS menu that will take you to the plugin's admin page. As Simple Custom CSS has only one input field, it's super easy to use. You only need to enter your custom CSS into the text area and hit the Update Custom CSS button.

Add custom CSS with the Simple Custom CSS plugin

3. Add Custom CSS to Your Child Theme's style.css file

If you want to significantly modify your theme's CSS, it's a reasonable thing to create a child theme and add your custom code to it. A child theme sits on top of the parent theme. It uses the same templates but lets you override any file of the parent theme—not just CSS but JavaScript, PHP, and static assets such as images too. 

You can add your customizations to the child theme while the parent theme remains intact. When a new update for the parent theme is released, you can securely update it, as your custom code will be held by the child theme. However, the child theme will also inherit the updates from the parent theme, so you can have both the updates and the custom CSS at the same time.

To create a child theme, you can check out our step-by-step tutorial by Rachel McCollin. In this article, I will use a child theme of the Twenty Twenty theme that I have created following the above tutorial.

Twenty Twenty child theme activated

Every child theme is required to include two files (even though you can override any other file of the parent theme if you want):

  1. style.css for the custom CSS styles,
  2. functions.php for the custom theme functions.

If you want to add custom CSS directly to your child theme, you need to edit style.css. Only use functions.php if you want to add an external CSS file to your child theme.

You can edit the style.css file from either your code editor such as Atom or Visual Studio Code, or the Appearance > Theme Editor menu of your WordPress admin area (see on the screenshot below). 

You need to add your custom CSS rules below the top comment section that serves the purpose of notifying the WordPress Core about the presence of the child theme (so don't delete the top comment). Otherwise, you can edit style.css as any other CSS files. Whichever CSS rule you place here, it will override the corresponding CSS rule of the parent theme.

Edit child themes stylecss file

4. Enqueue an External CSS File in Your Child Theme's functions.php File

If you want to add an external CSS file to your child theme, you will need to enqueue it by editing the functions.php file so that the WordPress Core can properly call it. This technique can be useful when you want to use a third-party CSS library on your site or modularize your custom CSS code. 

Say, you want to change the styles of a widget by creating a widget.css file where you can store all the widget-related CSS rules. In this case, the file structure of your child theme will look as follows:

Besides the two required files (style.css and functions.php), you will also have an assets folder holding the widget.css file with the custom CSS code. Now, you need to edit functions.php using either your code editor or the Appearance > Theme Editor menu within your WordPress admin area. 

You need to create a custom function (called tutsplus_external_styles() in the example below) in which you can register and enqueue widget.css using the wp_register_style() and the wp_enqueue_style() WordPress methods. I registered the stylesheet using the 'widget-css' handle but you can use any other name.

You also need to attach the custom tutsplus_external_styles() function to the wp_enqueue_scripts WordPress action with the help of the add_action() method.

And, that's it—the custom widget.css file has been added to your theme. The entire functions.php file of your child theme should look as follows:

Wrapping Up

When you need to add custom CSS to your WordPress site, you can use four different techniques. If you don't want to touch the code base, you can add your customizations with either the Customizer or a custom CSS plugin. The latter method is recommended when you want to add theme-independent CSS to your site or make a lot of modifications without editing the source code.

You can also opt for creating a child theme for your customizations. For adding custom style rules to your child theme, you need to edit the style.css file, while for enqueuing an external CSS file, you need to edit functions.php. Before starting to add custom CSS to your WordPress site, think about what you exactly need, what purpose your customizations will serve, and choose the best technique accordingly.

The Best WordPress Themes on ThemeForest

While you can do a lot with free themes, if you are creating professional WordPress sites, eventually you will want to explore paid themes. You can discover thousands of the best WordPress themes ever created on ThemeForest. These high-quality WordPress themes will improve your website experience for you and your visitors. 

Here are a few of the best-selling and up-and-coming WordPress themes available on ThemeForest for 2020.


by Anna Monus via Envato Tuts+ Code

YouTube on 15 years - CEO Susan Wojcicki determined to make the platform a reliable video library

YouTube CEO, Susan Wojcicki, reflected the views that the company aims to remove all content that breaks the law of the world's largest video library and promotes authority voices when it comes to providing news to make it authentic on its 15th birthday. In the official note, the CEO writes that...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by aqsqa qadir via Digital Information World

The Why and How of Securing Your WhatsApp Account

It seems like barely any days go by without regular internet users hearing about some kind of accident occurring that results in massive data breaches all of which would harm the overall level of safety that you would want to enjoy while you are using the internet and social media. Hence, it would...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Zia Muhammad via Digital Information World

Use ipdata’s Geolocation Data to Protect & Customize Your Site

This article was created in partnership with GoGetSSL. Thank you for supporting the partners who make SitePoint possible.

Modern websites are becoming more and more effective at customizing content based on their visitors’ location. They can redirect users to a page in their own language, display prices in the local currency, pre-fill webforms with location information, and show the current time and date for the correct timezone.

ipdata is a low-latency API that provides website owners with a wide variety of information about their visitors based on IP address (IPv4 and IPv6). Think of it as an IP geolocation and threat intelligence API.

By using a visitor’s IP address you can learn their continent, country, region, city, latitude and longitude, organization or ISP, and timezone. The API also detects Proxy and Tor users, as well as known spammers and bad bots. Blocking these risks will protect your website, and reduce the need for security strategies like CAPTCHA.

Let’s look specifically at some ways ipdata can help, and how to implement them on your own website.

Redirect Visitors and Localize Content

When you visit the ipdata website you’ll immediately see what the service is capable of. Everything that can be learned from your own IP address is displayed.

ipdata data return example

That data includes:

  • Whether you’re in the EU,
  • Your city,
  • State or region (and region code),
  • Country (and country code),
  • Continent (and continent code),
  • Latitude and longitude,
  • Postal or zip code,
  • Country calling code,
  • Your country’s flag emoji,
  • Your service provider’s ASN and carrier information,
  • Languages,
  • Currency (name, code, symbol, plural),
  • Time zone (name and abbreviation, offset, daylight savings time, current time),
  • Threat information (Tor, Proxy, anonymous, known attacker, known abuser, threat, bogon).

You can call ipdata's API on each page request to geolocate your visitors and localize their content. Here’s a handful of ideas of what you can achieve:

  • Restrict or block access to your content to specific countries or continents,
  • Redirect users to country-specific (or language-specific) sites or pages,
  • Pre-fill your webforms with their location data,
  • Show your visitors their local time and weather,
  • Display events that are near your visitors, or available flights in their area,
  • Serve targeted ads based on location,
  • Enforce GDPR compliance,
  • Automatically convert prices on your e-commerce store to their local currency, using the correct currency symbol,
  • More accurately analyze where your traffic is coming from.

You can get a client’s IP address using JavaScript, but it’s a bit of work. Instead, use ipdata’s API. It’s super-fast and reliable across all browsers. Here’s the code:

    $.get("https://api.ipdata.co?api-key=test", function(response) {
        console.log(response.ip);
    }, "jsonp");

Once you have a visitor’s API address, ipdata’s documentation shows you how to get their location in 26 different languages. You’ll also find detailed tutorials on how to code for a variety of use cases. Here are a few examples.

To block (or allow) users by country, look up the ISO 3166 ALPHA-2 Country Codes for the ones you want to blacklist or whitelist. Then follow this sample code to learn how to blacklist or whitelist them.

    // List of countries we want to block
    // To see this in action add your country code to the array
    var blacklist = ['US', 'CA', 'UK', 'IN']

    // Getting the country code from the user's IP
    $.get("https://api.ipdata.co?api-key=test", function (response) {

      // Checking if the user's country code is in the blacklist
      // You could inverse the logic here to use a whitelist instead
      if (blacklist.includes(response.country_code)) {
        alert('This content is not available at your location.');
      } else {
        alert("You're allowed to see this!")
      }
    }, "jsonp");

Redirecting users by country is useful if you have country-specific online stores, or if you have a separate page with content in their language or with country-specific contact details.

Here’s an example of how to redirect your visitors located in Germany and Australia. They will be redirected from https://ift.tt/2vIDQfm to https://ift.tt/2uXdNAP and https://ift.tt/2HyOmbN.

    // Getting the country code from the user's IP
    $.get("https://api.ipdata.co?api-key=test", function (response) {
      if (response.country_code == 'UK') {
        window.location.href = "https://uk.store.ipdata.co";
        } else if (response.country_code == 'DE') {
        window.location.href = "https://de.store.ipdata.co";
        } else if (response.country_code == 'AU') {
        window.location.href = "https://au.store.ipdata.co";
        }
    }, "jsonp");

You can also personalize the content of your site depending on the user’s location. Here’s an example that displays a special offer to UK visitors only:

    // Getting the country name from the user's IP
    $.get("https://api.ipdata.co?api-key=test", function (response) {
      if (response.country_code == 'UK') {
        alert("Special offer for all our users from " +response.country_name+ "!");
        }
    }, "jsonp");

Instead of targeting a whole country, you can drill down to region, city or postal code (zip code). Alternatively, you could target a time zone or specific currency.

You can further personalize your content by displaying the user’s local time (adjusted for DST) and local currency symbol. To request time zone data for IP address “3.3.3.3”:

    $ curl https://api.ipdata.co/3.3.3.3/time_zone?api-key=test

You’ll receive this response, which includes the name and abbreviation of the time zone, its UTC offset, whether it is currently DST, and the local time:

    {
        "name": "America/Los_Angeles",
        "abbr": "PDT",
        "offset": "-0700",
        "is_dst": true,
        "current_time": "2019-03-27T01:13:48.930025-07:00"
    }

Currency detection is similar. Here’s an example for the IP address “203.100.0.51”:

    curl https://api.ipdata.co/203.100.0.51/currency?api-key=test

And the response:

    {
        "name": "Australian Dollar",
        "code": "AUD",
        "symbol": "AU$",
        "native": "$",
        "plural": "Australian dollars"
    }

Protect Your Website from Threats

You can also use ipdata to identify potential threats against your website. They maintain a database of over 600 million malicious IP addresses, open proxies, Tor nodes, spammers, botnets, and attackers. These are aggregated only from high-quality, authoritative sources. You can use this information in a variety of ways:

  • Protect your comments by blocking known spammers and bad bots, alleviating the need for CAPTCHA,
  • Detect frauds by determining if their credit card is from a country different to where they are located,
  • Block anonymous traffic to eliminate the risks that come from such networks,
  • Block high-risk countries, such as the countries where most of your malware and attacks originate,
  • Prevent “free trial abuse” by detecting Proxy and Tor users.

Here’s how to access the threat data for the IP address “103.76.180.54”:

    curl https://api.ipdata.co/103.76.180.54/threat?api-key=test

The request generates the following response:

    {
        "is_tor": true,
        "is_proxy": false,
        "is_anonymous": true,
        "is_known_attacker": false,
        "is_known_abuser": false,
        "is_threat": false,
        "is_bogon": false
    }

The visitor is using a Tor network. is_anonymous is true if the visitor is either a Tor or Proxy user. You can use ipdata to stop anonymous users creating an account. Here’s some sample code from the official documentation:

    // Getting the anonymity status from the user's IP
    $.get("https://api.ipdata.co?api-key=test", function (response) {
      if (response.threat.is_anonymous) {
        alert("You are not allowed to create an account.");
        }
    }, "jsonp");

You can get more specific, for example, by blocking Proxy users but letting Tor users through:

    // Getting the anonymity status from the user's IP
    $.get("https://api.ipdata.co?api-key=test", function (response) {
      if (response.threat.is_proxy) {
        alert("You are not allowed to create an account.");
        }
    }, "jsonp");

Some users are repeat offenders, having been repeatedly reported by admins of other websites for spam or malicious activity. You can stop them from creating an account by blocking them if one of these fields are true:

  • is_known_abuser: IP addresses that have been reported to be sources of spam,
  • is_known_attacker: IPs that have been reported to be the source of malicious activity.

Why Choose ipdata?

ipdata compares very favorably with other IP Geolocation APIs. It is written in Python 3 with an average execution time of 2.9 ms. It’s fast and reliable enough to keep a long list of clients happy, including Comcast, Redhat, Cooperpress, Sphero, AMD, and NASA.

ipdata is highly scalable, with low latency globally. The API serves millions of requests every day at an average speed of just ~65ms, and runs in eleven data centers around the world:

  • 4 in the US,
  • 1 in Canada,
  • 2 in Europe (London and Frankfurt),
  • 1 in India (Mumbai),
  • 1 in South America (Sao Paulo),
  • 1 in Europe (Seol), and
  • 1 in Australia (Sydney).

According to Jonathan Kosgei, the Founder of ipdata, execution time is kept low by not doing any database reads or writes in the application code. “A separate authorizer function handles getting usage data from DynamoDB and authorizing users based on whether they’re within their quota or not. And its results are cached.”

Start Geolocating Your Visitors with ipdata

By now I’m sure you’ve thought of a dozen ways you can use ipdata to enhance and protect your website, or those of your clients. Sign up for free and start testing it!

The service is Jonathan Kosgei’s first SaaS, and he’s quite transparent about the smart way he set it up and the lessons he learned along the way. Learn from his experiences in his guest posts:

The post Use ipdata’s Geolocation Data to Protect & Customize Your Site appeared first on SitePoint.


by Adrian Try via SitePoint