The surprising behavior of !important in CSS custom property values

Category Image 091

Huh! I did not realize that CSS custom properties had their own resolution behavior for how !important works in their values. Uh, despite writing a guide about them. 😬 But hey it’s now updated.

Stefan Judis documents it clearly. The deal is that !important is not at all used in the final value. So:

div {
  --color: red !important;
  color: var(--color);
  color: yellow;
}

It kinda feels like red should win, but because !important is ultimately stripped from the custom property value, yellow wins it out. And it’s not because the color declaration comes last — if color: red !important; was the first declaration, then red would win.

But it’s not like !important is just stripped and ignored; it’s used in a scoped way, affecting which custom property value wins. But then !important is gone when that value is applied. Stefan’s example:

div {
  /*
    `!important` overrules the
    other `--color` definitions
  */
  --color: red !important;
  color: var(--color);
}

.class {
  --color: blue;
}

#id {
  --color: yellow;
}

This feels weird (to me) as you’d think yellow declared on #id would win because it has the highest specificity. But that’s the deal with the scoped behavior — !important makes red the winner, then is applied to the color as such.

To Shared LinkPermalink on CSS-Tricks

10 Tips To Keep WordPress Clients Coming Back

Featured Imgs 26

10 Tips To Keep WordPress Clients Coming BackLet’s say you own a WordPress agency providing services and products to clients from one hemisphere to the other. You work your butt off to drum up your business, including writing top-notch content, launching marketing campaigns, joining WordPress meetups to introduce your services, etc. Through blood, sweat, and tears, you finally get it off the […]

The post 10 Tips To Keep WordPress Clients Coming Back appeared first on WPExplorer.

How to Add a Simple User Password Generator in WordPress

Wp Plugins

Do you want to add a simple user password generator in WordPress?

Many WordPress users end up using weaker passwords for the sake of convenience. These passwords can be easily cracked by hackers, which makes your WordPress website vulnerable.

In this article, we’ll show you how to easily add a simple user password generator in WordPress. This would allow you or other registered users on your website to generate a strong password.

Adding a password generator in WordPress

Why Use a Stronger Password Generator in WordPress?

By default, WordPress allows you to choose a password for your user account, but it doesn’t require that the password be secure.

The built-in password generator appears during WordPress installation, on the user registration page, and on the user profile page.

By clicking on the Generate Password button, users can generate a new strong password.

Similarly, when changing a password by editing their user profile, users can click on the ‘Set New Password’ button to generate unlimited combinations of unique strong passwords.

Generating strong passwords in WordPress

However, you’ll notice that it allows you to skip the password strength check by checking the ‘Confirm use of weak password’ option.

Strong password can be escaped

Similarly, any users registering on your website can also escape the strong password requirement by checking this option on the user registration page.

If you run a membership site or online store where many users have accounts, then this can seriously affect the security of your WordPress site.

Generate password for new user registration

That being said, let’s take a look at how to easily enforce secure passwords and require users to use the strong password generator instead.

Method 1. Enforce Strong Password Generator in WordPress

First, you need to install and activate the Password Policy Manager for WordPress plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Password Policies page in WordPress admin area and click on the Enable Password Policies check box.

Set up password policy for all users

After that, you can set a site-wide password policy for all users. You can choose minimum password strength, enforce special characters and number usage, expire passwords after a period of time, and more.

Below that you can set additional advanced options for password security.

For instance, you can automatically reset passwords for inactive users, prevent users from reusing old passwords, or disallow users from resetting passwords on their own.

Advanced password security options

The plugin also allows you to limit login attempts to prevent brute force attacks. You can choose the number of login attempts a user can make, after which their account will be locked and login will be disabled for 24 hours.

Block login attempts

You can also set a lock duration after which the accounts will be automatically unlocked. Alternatively, you can choose to manually unlock accounts by an administrator only.

Set Password Policies Depending on User Roles

The plugin also allows you to set different password policies based on user roles.

For instance, you can set different password requirements and security settings for authors, subscribers, customers, or members on your membership website.

Set password policy for user roles

Seeing the Password Generator in Action

The plugin will now automatically display a strong password generator on registration, profile, and password change screens in WordPress.

Password enforcement in WordPress

It will also prevent users from setting weaker passwords or bypassing your password policy.

Password policy enforced

Method 2. Strong Passwords in Custom User Registration and Login Forms

The password policy method above works well for default WordPress user registration and password reset forms.

However, if you are using a custom user registration and password reset form, then users may still find ways around your stronger password requirements.

One easy way to enforce strong passwords is by using WPForms. It is the best WordPress form builder plugin and allows you to easily create any kind of form including custom user registration and login page forms.

First, you need to install and activate the WPForms plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Note: You’ll need at least the Pro plan to access User Registration addon.

Upon activation, you need to visit the WPForms » Settings page to enter your license key. You can find this information under your account on the WPForms website.

Enter WPForms license key

After that, you need to visit the WPForms » Addons page and click on the Install Addon button under the ‘User Registration Addon’.

User registration addon

You are now ready to create your custom user registration and login forms.

Simply head over to WPForms » Add New page. First, you need to provide a title for your form and then choose the user registration form template.

User regisration form template

This will load the form builder where you can edit form fields.

Simply click on the password field to edit and turn on ‘Enable Password Strength’ switch. Below that you can choose minimum password strength and set it to ‘Strong’.

Require strong password

You can now save your form and exit the form builder.

WPForms makes it super easy to add your forms anywhere on your website. Simply edit the post or page where you want to display your custom user registration form, and add the WPForms block to your content area.

Add WPForms block

After that, you need to select your custom user registration form under the block settings.

WPForms will then load a live preview of your form inside the editor.

Select custom user registration form

You can now save and publish your post / page and preview your custom user registration form.

You’ll notice that as users fill in the password field they will be asked to use a stronger password. The form will not be submitted with a weaker password.

Strong password required error

We hope this article helped you learn how to use the simple user password generator in WordPress and enforce stronger passwords on your WordPress website. You may also want to see our step-by-step guide on how to properly move from HTTP to HTTPS, or our expert pick of the best WordPress plugins for small business.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Add a Simple User Password Generator in WordPress first appeared on WPBeginner.

Maybe there kinda is background-opacity?

Category Image 091

I was reading Jake’s “Cross-fading any two DOM elements is currently impossible” which is a wonderfully nerdy deep dive into how there is no real way to literally cross-fade elements. Yeah, you can animate both of their opacities, but even that isn’t quite the same. Turns out there is a Chrome/WebKit-only CSS function call called -webkit-cross-fade() that does the trick. MDN says it’s specced, but the implemented version differs, so it’s a bit of a mess… but it does exist:

.el {
  background: -webkit-cross-fade(url(img1.svg), url(img2.svg), 50%);
}

I didn’t even know that was a thing.

The first thing I thought of was: if one of the images was just a blank transparent image, wouldn’t that apply partial transparency to the other one? And thus it’s kind of a proxy for background-opacity (which doesn’t exist but feels like it should).

I gave it a test to see if it would work:

It seems to work! This is the meat of it:

.el {
  background-image: -webkit-cross-fade(
    url(image.jpg),
    url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7),
    50%
  );

That’s a 1px transparent GIF Base64 encoded.

It doesn’t work in Firefox but it does in everything else. Plus, you can test for support right in CSS and do something different if this isn’t just an enhancement.

@supports (background: -webkit-cross-fade(url(), url(), 50%)) {

  /* Only apply the idea if supported, do the Firefox fallback outside of this */

}

That’s baked into the demo above.

Still on the fence about hiring an SEO? Here are 10 benefits that might persuade you to hire one.

Featured Imgs 23

Introduction:

Are you still on the fence about hiring an SEO? Here are 10 benefits that might persuade you to hire one.

An SEO company can be of great help in increasing your site’s visibility and getting it to rank higher on Google page searches, plus, there are tons of other benefits to hiring a search engine optimization agency.

Check out these 10 advantages of hiring an SEO Agency before you make up your mind!

 

1) Increased traffic:

When visitors come from search engines like Google, they’re ready for conversion; when they come from non-search sources, then not so much. Search engine optimization is all about giving potential customers what they want when they need it most – which is now!

 

2) More business opportunities:

A strong website presence is good for business – it gives more opportunities to potential customers. According to research, 93% of consumers who searched on Google said they looked for more information before making a purchase decision.

 

3) Cost effectiveness:

SEO is not as expensive as you might think – especially if you hire an agency or consultant to do the work versus trying to learn about SEO yourself. Plus, outsourcing your SEO ensures greater accuracy and scalability. For some businesses, hiring an expert might even cost less than the resources they’d have to invest if they tried it themselves. Plus, when clients find you because of the SEO efforts, it pays for itself.

 

4) Improved website design:

Today’s best practices for website design are based on conversions rather than aesthetics, which can be different from what has worked in the past. Utilizing an SEO company can be especially helpful when it comes to designing any new content or making changes to your existing site.

 

5) Sharper business focus:

As an expert in search engine optimization, you’re not just focusing on the website – you’re focusing on what makes money for the business overall. You’ll see which products or services are selling best and where they need improvement, which will help improve customer retention levels over time.

 

6) Getting found is easier than ever:

Now more than ever, consumers start their purchase research with a major search engine like Google (82%) before doing further research online (79%). Plus, close to 75% of people believe that companies should make information available especially if they appear high in the search results. That means you’re reaching a huge market if your business is easily found on Google and other search engines.

 

7) Improved website performance:

Regular SEO audits can help improve user experience and site functionality – leading to better conversions overall. Your site might be slow, with old out-of-date content or broken links, which hurts your SEO efforts over time. A strong web presence starts with a website that works well for visitors and google bots alike!

 

8) You’ll know how your online investment is doing:

It’s important to track your website’s progress as it relates to SEO efforts because there are so many factors involved in rankings. Plus, it has been that an increase of just one position in rankings can have a positive impact on traffic, leads, and conversion rates.

 

9) You’ll know when you’re ranking well:

SEO companies will be able to share their insights with you about how your site is doing in organic search results – which keywords are working for you and what to focus on next. Having this information not only saves time but it ensures that your SEO efforts aren’t going to waste because they’re working toward specific goals and milestones!

 

10) It’s all part of the service:

An SEO company or consultant might offer additional services like website design, PPC management, reputation management, and social media marketing and can do those simultaneously – it’s just included as part of getting found online. Since these services all work together, it’s more advantageous for your business to have everything done by one company instead of hiring different experts for every job.

 

Conclusion:

Hiring an SEO company can be one of the best decisions you make for your business – these 10 benefits are just a taste of what they can do! Still on the fence? Do some more research and see if an SEO agency is a right choice for you. Thanks for reading!

Why and How to Automatically Translate a WordPress Site

Featured Imgs 13

Why and How to Automatically Translate a WordPress SitePersonalized content, friendly interfaces, and interactive themes help create engaging, accessible websites. But to truly reach a global audience, your website should speak your clients’ language. Fortunately, translating your site into any language is getting easier, quicker, and more affordable thanks to automatic translation options, also called machine translation, in many translation plugins. Why Translate […]

The post Why and How to Automatically Translate a WordPress Site appeared first on WPExplorer.

New in Golang language

558fe5180e0e8fc922d31c23ef84d240

Hello.

I want to start studying the Golang language but I can't find any IDE that I can configure well, can you tell me an IDE that is good for Go and how to configure it (explained for fools in Spanish), please? I have tried with Sublime, Visual Studio Code and Eclipse and I have not clarified with any. And, if it is not too much to ask, can you recommend a free course to start studying (if possible in Spanish)? I have found a course but I ask if anyone knows of any good and free.

I really appreciate the help.

All the best.

How to Add Product Tags, Attributes, and Categories to WooCommerce

Set Up Woocommerce

Do you want to learn how to add tags, attributes, and categories to your WooCommerce products?

By optimizing your WooCommerce product listings, you can help your visitors find what they’re looking for and get more traffic from search engines and social media. 

In this article, we’ll show you how to add product tags, attributes, categories, and more in WooCommerce, step by step.

How to add product tags, attributes, and categories to WooCommerce

Why Add Product Tags, Attributes and Categories to WooCommerce Products?

Adding the right product tags, attributes, and categories in WooCommerce will help you to get more traffic to your online store, make more sales, and improve the overall user experience for your customers.

Firstly, using categories, tags, and attributes in WooCommerce will make your store more organized, helping visitors find the products they’re looking for much faster.

They can also help to improve your store’s search engine optimization. That’s because using descriptive tags, attributes, and categories will help your products to appear in more searches, growing your traffic and sales.

What’s the Difference Between Categories, Tags, and Attributes in WooCommerce?

Many beginners get confused about the differences between categories, tags, and attributes. 

Categories are meant for a broad grouping of your products, like men’s, women’s, or children’s clothing.

Tags are more like keywords for a specific product. A women’s shirt could have tags like summer, discount, casual, soft, and more.

Attributes are for specific characteristics of a product. For example, you can give important information about the product’s weight, material, color, and more.

This is common in clothing stores, where customers can filter products by a specific size, color, or fabric.

Here’s an example of a WooCommerce product with the category ‘Accessorites’ and an attribute for the color red listed on the product page.

WooCommerce product with categories, tags, attributes

Categories and tags are used for your WordPress blog posts as well. You can read more about the difference in our guide to categories vs tags.

That being said, let’s show you how to add product categories, tags, and attributes to your WooCommerce products.

Adding Product Categories, Tags, and Attributes to WooCommerce Products

WooCommerce has built in settings to add categories, tags, and attributes right out of the box. 

To add categories, navigate to Products » Categories in your WordPress admin panel.

Then, you can give your category a name, add a slug, and choose whether or not it has a parent category. 

Add new product category

Next, you can optionally give your category a description and choose the ‘Display type’ from the ‘Default’ drop down.

This controls what the category landing page will look like. Here you can choose to display your ‘Default’ theme options, ‘Products’, ‘Subcategories’, or ‘Both’.

The Default option will depend on the theme you’re using. ‘Products’ would display all the products in that category and any subcategories on the main category page (for example, wpbeginner.com/shop/jackets). ‘Subcategories’ would simply display the subcategories, and the visitor would have to click on one of the subcategories to view those products.

Select category display type

If you want to add a category thumbnail, then click the ‘Upload/Add image’ button.

Make sure you click the ‘Add new category’ button to save your changes.

Add product category thumbnail

To add more categories or subcategories, simply follow the same steps as above. 

Now you can assign a product to a category by going to your product page, then checking the category box in the ‘Product categories’ section.

Add category on individual product page

You can also click the ‘Add new category’ link.

This brings up a section where you can quickly create new categories on the fly. 

Add new category on product page

Once you’re finished assigning categories, make sure to click the ‘Publish’ or ‘Update’ button.

Adding and Editing Product Tags

Your product tags are similar to tags in your blog posts. You can use product tags to make it easier for your visitors to find the exact products they’re looking for. 

To add new tags, simply go to Products » Tags and enter the name of your tag, the slug, the description, and then click the ‘Add new tag’ button.

Add new product tag

To add more tags, simply follow the same steps as above. 

You can also add individual tags to your product pages. Simply open up the product page you want to edit, then enter your tags into the ‘Product tags’ box and click the ‘Add’ button.

Add tags to product page

Once you’re finished, make sure to click ‘Publish’ or ‘Update’ to save your changes. 

Adding and Editing Product Attributes

Finally, you have product attributes. These help group products together and offer users a way to filter your products.

To add product attributes, you need to go to Products » Attributes and then give your attribute a name and slug.

You can also enable archives by checking the ‘Enable Archives’ box. This gives you the ability to display all items that share that attribute on a page. 

Add new product attribute

After that, you need to choose the ‘Default sort order’. This is the order your products will appear on the shop page for that attribute.

We’ll choose the ‘Custom ordering’ option to give more control, but you can also order by name, and term ID.

Set default sort order

Then, click the ‘Add attribute’ button to add it to the attribute table.

Now, you need to click the ‘Configure terms’ link to add terms to the attribute. 

Click configure terms

For example, if you created an attribute called ‘Color’, then you can add the individual colors as terms.

This brings up a screen similar to the main attribute screen, where you need to enter the name, slug, and optional description.

Add new attribute term

Then, click the ‘Add New Color’ button to save your attribute terms. You can add as many attribute terms as you want by repeating the process.

Once you’ve done that, you can add your attributes to individual products.

Simply open up the product page you want to edit, then click the ‘Attributes’ option in the ‘Product data’ section under the text editor.

Go to product data attributes section

Next, select your attribute in the ‘Custom product attribute’ drop down.

Then, click ‘Add’.

Select product attribute drop down

This adds the attribute to your product. 

Now, you can select your attribute terms from the ‘Value(s)’ box.

Select attribute terms

Once you’re done adding your attributes, click the ‘Save attributes’ button.

After that, make sure to click ‘Publish’ or ‘Update’ to save your product. 

Optimizing Your Product Listings for WooCommerce SEO

Once you’re done creating tags, attributes, and categories, you can improve your product pages even more with the help of an SEO plugin.

We recommend using All in One SEO since it’s the best WordPress SEO plugin in the market used by over 3 million website owners. 

AIOSEO

It’s very easy to use and lets you optimize your website for SEO without any technical skills. This means more traffic from the search engines and social media, and more eyes on your products. 

Note: There is a free version of the plugin, but we’ll be using the Pro version since it includes the WooCommerce SEO features we need. 

First thing you need to do is install, activate, and setup the plugin. For more details, see our guide on how to setup All in One SEO for WordPress correctly.

After that, you can optimize your product titles by opening the page for a product and scrolling down to the ‘AIOSEO Settings’ box below the product editor.

Here you can change the product’s SEO title and description. You can use the smart tags to automatically generate descriptions based on your product details, or enter a custom title and description instead.

Optimize product title with AIOSEO

Make sure that you use your main product keyword in both the title and meta description fields.

After that, click on the ‘Social’ tab to optimize how your product will display across social media. 

AIOSEO product social sharing settings

You have complete control over the product image you want to use, which will help you get more engagement from your followers.

Next, click the ‘Schema’ tab. Schema markup lets the search engines better display your content in the search results. 

If you’ve seen product listings with prices, star ratings, and more, then you’ve seen product schema in action.

Schema search example

All in One SEO will automatically choose the right schema type for your products and fill in the pricing, availability, and more.

You can also add additional schema markup, including the brand, identifier type, and identifier fields. Identifiers can be any unique ID such as ISBNs, GTIN codes, or UUIDs.

AIOSEO product schema

Once you’re done customizing your product listing for SEO, make sure to click the ‘Update’ button to save your changes. 

For more details, see our ultimate WooCommerce SEO guide for ranking higher in Google. 

We hope this article helped you learn how to add product tags, attributes, and categories to WooCommerce. You may also want to see our expert picks of the best WooCommerce plugins for your store and our guide on how to create an email newsletter the right way.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Add Product Tags, Attributes, and Categories to WooCommerce first appeared on WPBeginner.

Controlling traffic lights

558fe5180e0e8fc922d31c23ef84d240

Hello, I have a problem in making that when the light is green it would light for 5seconds and when the lights are red-yellow or yellow it will only light up for 3seconds. Could anyone help me how to get the result?

; controlling external device with 8086 microprocessor.
; realistic test for c:\emu8086\devices\Traffic_Lights.exe

#start=Traffic_Lights.exe#

name "traffic"


mov ax, all_red
out 4, ax


mov si, offset situation


next:
mov ax, [si]
out 4, ax

; wait 5 seconds (5 million microseconds)
mov     cx, 4Ch    ;    004C4B40h = 5,000,000
mov     dx, 4B40h
mov     ah, 86h
int     15h


add si, 2 ; next situation
cmp si, sit_end
jb  next
mov si, offset situation
jmp next


;                        FEDC_BA98_7654_3210
situation        dw      0000_0011_0000_1100b
s1               dw      0000_0110_1001_1010b
s2               dw      0000_1000_0110_0001b
s3               dw      0000_1000_0110_0001b
s4               dw      0000_0100_1101_0011b
sit_end = $


all_red          equ     0000_0010_0100_1001b