You want enabling CSS selectors, not disabling ones

Category Image 052

I think this is good advice from Silvestar Bistrović:

An enabling selector is what I call a selector that does a job without disabling the particular rule.

The classic example is applying margin to everything, only to have to remove it from the final element because it adds space in a place you don’t want.

.card {
  margin-bottom: 1rem;
}

/* Wait but not on the last one!! */
.parent-of-cards :last-child {
  margin-bottom: 0;
}

You might also do…

/* "Disabling" rule */
.card:last-child {
  margin-bottom: 0;
}

But that’s maybe not as contextual as selecting from the parent.

Another variation is:

.card:not(:last-of-child) {
  margin-bottom: 1rem;
}

That’s what Silvestar refers to as “enabling” because you’re only ever applying this rule — not applying it and then removing it with another selector later. I agree that’s harder to understand and error-prone.

Yet another example is a scoped version of Lobotomized Owls:

/* Only space them out if they stack */
.card + .card {
  margin-top: 1rem;
}

I think gap is where this is all headed in the long term. Put the onus on the parent, not the child, and keep it an enabling selector:

.parent-of-cards {
  display: grid;
  gap: 1rem;
}

Direct Link to ArticlePermalink


The post You want enabling CSS selectors, not disabling ones appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.

Google Chrome 94 Beta Includes WebCodecs API

Featured Imgs 23

Google has announced the beta release of v94 of Google Chrome and is highlighting the inclusion of a new WebCodecs API that is designed to handle low-level video processing at a broad level. This functionality was first introduced as an origin trial in Chrome 93. 

The Chromium blog outlined the importance of this new API in stating that:

How to Create a Newsletter and Send Email Campaigns with Mailpost.io

Category Image 051

This post is originally published on Designmodo: How to Create a Newsletter and Send Email Campaigns with Mailpost.io

How to Create a Newsletter and Send Email Campaigns with Mailpost.io

An email newsletter is a powerful tool that enables a website owner to share material and valuable information with their network of prospects, subscribers, and customers. Aside from engagement based on triggers and actions, it can automatically provide communication between …

For more information please contact Designmodo

I need help to make this code to run please!! hsa.Console

558fe5180e0e8fc922d31c23ef84d240

Hello, I need help to make this code to run please. this is just a part of the code.
I have the imports below, but hsa.Console is not imported, I have tried to download de jar files for it but cannot find it. Is there a way I could make it work?

import hsa.Console;
import java.io.Console;

Console c;
Console d;

private void askData ()

  d.setCursor ((selection == -1) ? (2): ** // d.setCursor shows an error that says: cannot resolve method "setCursor" in "Console"**
     (3), 1);

  d.println (); **// same error here**

  if (selection2 != -1)
     d.setCursor ((selection == -1) ? (2):
        (3), 1);
  else

     d.clear(); **// same error here**
     d.setCursor (2, 1);

  if (selection == -1)

     d.println ("Please enter the first tower.");
     userInput = d.getChar (); **// same error here**
     if ((userInput - '0' > 3 || userInput - '0' < 1) && userInput != 'e' && userInput != 'E' && userInput != 's' && userInput != 'S')

        JOptionPane.showMessageDialog (null, "Error! Invalid range! The range must be between 1 and 3!");
        askData ();
        return;

     else
     if (userInput == 'e' || userInput == 'E' || userInput == 's' || userInput == 'S')
        return;
     d.println ((selection = (userInput - '0') - 1) + 1);

  d.print ("Please enter the destination tower.");
  userInput = d.getChar ();
  if (userInput - '0' > 3 || userInput - '0' < 1 && userInput != 'e' && userInput != 'E' && userInput != 's' && userInput != 'S')

     JOptionPane.showMessageDialog (null, "Error! Invalid range! The range must be between 1 and 3!");
     selection2 = -1; //Here.
     askData ();

  else
  if (userInput == 'e' || userInput == 'E' || userInput == 's' || userInput == 'S')
     return;
  d.println ((selection2 = (userInput - '0') - 1) + 1);
  if ((highlightIndex (selection, false, false) != -1 && highlightIndex (selection2, false, false) != -1 && board [((difficulty - (highlightIndex (selection, false, false)) == -1) ? (0):
     ((difficulty - highlightIndex (selection, false, false))))] [selection] > board [(difficulty - (highlightIndex (selection2, false, false)) == -1) ? (0):
     (difficulty - ((highlightIndex (selection2, false, false))))] [selection2]))

     selection = -1;
     selection2 = -1;
     JOptionPane.showMessageDialog (null, "Error! Invalid choices! You cannot place a big block over a smaller block.");
     askData ();
     return;

Get Net Income from Income and Expenditure Tables by Date

Category Image 101

I want to be able to write an SQL statement that pulls the sum of revenue and expenditure for each day and gets net income for each day with the distinct dates available in the Income and Expenditure tables. I have tried the following statement, but I'm not getting the desired result. I'm using MS Access.

SELECT
    Income.IncomeDate,
    SUM(Income.AmountPaid) AS IncomeAmount,
    Expenditure.ExpenseDate,
    SUM(Expenditure.TotalAmount) AS ExpenseAmount,
    IncomeAmount - ExpenseAmount AS NetIncome
FROM Income FULL OUTER JOIN Expenditure ON Income.IncomeDate=Expenditure.ExpenseDate
GROUP BY Income.IncomeDate
ORDER BY Income.IncomeDate

Adding Custom HTML Attributes With the Block Attributes Plugin

Category Image 052

Earlier this week, websevendev released its fourth WordPress plugin to the official directory named Block Attributes. The extension allows end-users to add any HTML attribute to nearly any block.

One of the problems with the WordPress editor is that it can be a bit fussy about customizing HTML. Blocks are built on a set of standards, and the markup is supposed to meet those expectations. If something does not fit, users see an invalid markup warning.

However, there are times when users need to drop in a custom HTML attribute for various reasons. For example, I sometimes need to add a custom data- attribute for working with a bit of JavaScript. Since I know my way around code well enough, I typically write out the HTML in those situations via the Custom HTML block. But, that does not make sense when minor attribute additions are called for.

WordPress currently allows users to add classes and IDs (called an “HTML anchor” in the admin) to almost every block. It does not allow for direct input of the dozens of other possible attributes that HTML supports. The use cases for the average user are few and far between.

For those scenarios where some users could use the extra feature, the Block Attributes plugin is handy.

The plugin is straightforward to use. It adds a new field named “Additional attributes” under the Advanced tab of every block. Users can add the attribute name and click the “Add” button. From there, it creates a new field for adding the attribute value.

Adding a custom attribute for JavaScript handling to a Button block in the WordPress editor via the Block Attributes plugin panel.
Adding an onclick attribute to a Button block.

The plugin also supports multiple attributes. Once you add one, you simply use the same input field to create more.

For my first test drive, I added a simple onclick attribute with a value of myFunction(). Then, I hopped over to my theme and created that function via JavaScript to output a simple message in the console. Everything looked good under the hood, and it worked.

Most of the use cases I have in mind are for integrating with JavaScript, and this was a simple example of what is possible. There are far more complex things a developer could do with such a feature. That is reason enough to keep this plugin in the toolbox — sometimes you need a wrench instead of a hammer.

I could also see Block Attributes being used for adding ARIA attributes in other situations where it might aid accessibility.

Users could add custom styles to a specific block via a style attribute with the plugin. However, unless this is a simple one-off, I would recommend against it. For more advanced use cases, Blocks CSS is a far more suitable plugin. It has a built-in syntax highlighter. Plus, a textarea is friendlier than a one-line text input box.

The only downside to Block Attributes I have seen is upon deactivation. You will see the dreaded “this block contains unexpected or invalid content” message in the editor if you have added any custom attributes. The editor has managed to resolve any issues I have run into with the core blocks.

Side-by-side view of the block resolution popup modal in the WordPress editor.
Resolving block warning after deactivating plugin.

Deactivating the plugin should not affect the front-end output. Because the custom attributes are a part of the HTML markup, they will still be there. The error message should only show in the editor.

Google’s New Ad Tracking Tech FLoC and WordPress

Category Image 032

Google’s New Ad Tracking Tech FLoC and WordPressGoogle announced that it would no longer support third-party cookies and has now come out with its own alternative ad tracking technology: FloC. In the wake of third-party cookies, a type of tracker that reports consumer activity across websites to create personalized ads and improve user experiences, there is significant interest in creating alternative tracking […]

The post Google’s New Ad Tracking Tech FLoC and WordPress appeared first on WPExplorer.

A More Tab-Like Look

Featured Imgs 23

We’ve got lots of plans for the Pen Editor on CodePen. Of course we do! This is the heart and soul of CodePen. The thing where all the great stuff on CodePen is actually produced. Down the road, there will be more big-bangs where the editor evolves to do bigger and better things (but don’t worry, it’ll keep it’s signature simplicity). But the temper the biggness of those bangs, we’re releasing parts of it along the way that shift some of the look and functionality of the editor.

There has been other small stuff, like the Save Pen Dropdown, and you might have noticed some aesthetic changes to the Export and Share menus:

But this update to the look of the editors themselves is probably the most noticeable change yet. No functionality changes here, just aesthetic again.

The post A More Tab-Like Look appeared first on CodePen Blog.

Forminator Pro now has Stripe Subscriptions for Recurring Payments, Pricing Plans, and Much More!

Featured Imgs 13

With Forminator Pro’s Stripe Subscriptions, recurring payments, pricing plans, and other improvements, your payment forms just got better! Learn how to implement these amazing features and hear about some other recent advancements in this article.

Forminator Pro, our popular form-creating plugin, just keeps improving with its new subscription payments options. It coordinates with Stripe, making managing and implementing recurring payments more effortless than ever.

This feature works for one-time payments and subscriptions. Plus, you can include free trials, customize subscription terms, add multiple payment structures, and more!

We’ll be going over:

You’ll see how Forminator Pro’s payment features can benefit your business today and other advanced options.

How to Add Stripe Subscriptions to Collect Recurring Payments

Subscriptions are perfect for gym memberships, donations, food boxes, book subscriptions — you name it. There are many reasons to include a subscription on your WordPress site, and now with Forminator, it’s a breeze!

Subscriptions can get set up by going to the Add-Ons section in Forminator’s dashboard. From here, it’s just a matter of clicking Install from the Forminator Stripe Subscription Add-On.

Forminator Stripe subscriptions add-on button.
It will tell you whether the add-on is installed or not, too.

At this point, you click Activate.

Where you activate the subscription option.
Don’t want to activate it yet? Click Close and come back at any time.

If you don’t have your Stripe account connected, you will do so here. You’ll fill in the required information, including your Test Publishable Key, Test Secret Key, Live Publishable Key, and Live Secret Key.

Where you connect your stripe account.
Once your information is added, you’ll hit Connect.

If you need any help setting up your Stripe account, we have you covered in our documentation.

Adding Multiple Pricing Plans

Multiple pricing plans are perfect if you want someone to pay in a given timeframe (e.g. every month), add extra orders, buy additional subscriptions for gifts, including a free trial, and more.

It’s up to you how you want to set up plans for your subscriptions.

Get started by heading to Forminator’s dashboard, go to Forms, and create or edit a form that you already have.

I went ahead and set up a new form called Forminator Subscription.

Where you name the new form.
Fitting name, I’d say.

For this example, let’s say that I want to take subscription payments with the options of Monthly, Quarterly, and Annually. I set up all the fields that I felt were necessary for this type of form.

The fields to include.
The essential information is included.

You’ll notice the Membership Plans field. That was created with a Select field, where I entered the various membership options and labeled it Membership Plans.

Various membership plans.
Three plans are available.

Now we include the Stripe field and edit its settings.

The Stripe field.
The Stripe field is in the mix with the rest of the fields.

In the Settings tab in the Stripe field, you go to the Payment Plan section and add different plans in the Plan Setup. We’ll go ahead and set up a Monthly option…

Where you set up a monthly plan.
We’ll start with the Monthly plan.

Now it’s time to choose a Payment Type. You can choose between One Time or Subscription. It’s then time to decide if you’d like a Fixed or Variable amount.

In this article, we’ll set up a monthly payment plan that costs $25. It’s just a matter of choosing Subscription and entering the Fixed monthly payment in the Amount box.

The payment type and amount box.
Enter any amount you want!

From here, you choose a Quantity. Pick a fixed amount or variable — whatever is best for your specific needs.

Quantity area.
We’ll use just one for this example.

And now, we’re ready to choose a billing cycle. You can decide how often to bill by:

  • Day(s)
  • Week(s)
  • Month(s)
  • Year(s)
Where you pick how often to bill.
Days, weeks, months, or years — the choice is yours when to bill!

There’s also an option for a Trial Period. Just check the box!

Selecting this option will give the user a limited-time free trial for a specific plan. For the time being, let’s allow for a 7-day trial. So, I’ll enter a ‘7’ in the Trial Duration area.

Where you pick a trial period.
Pick a reasonable trial period that works for you and your users.

Next, we’re going to head to the Conditions tab to connect it to our dropdown selection. This tab is in all of your subscription options. In this case, we’re on the Monthly subscription.

The conditions tab.
The Conditions tab is right next to Plan Setup.

From here, you add the condition(s) selections from the dropdown.

Conditions area.
This shows all of the fields I have inserted.

Conditions can be adjusted and changed however you’d like. For more information on how to specify what conditions are and how they function, be sure to check out our documentation.

To sync everything with Stripe, under the Advanced tab in the Stripe Field, scroll down, and you can select the Billing Details, where you choose your appropriate fields from the dropdown (e.g. Name, Email, etc.).

The billing details.
The dropdowns will contain the suggested fields to include.

Use the Meta Data area to include any other additional information that you’ll need from your users. This information will be sent to Stripe and appear in the MetaData section of every transaction.

For example, add a Phone Number.

The meta data area.
You’ll include any fields that you want.

Once you have all of the Meta Data you want to collect, you’re all set to publish your form!

Viewing Your Subscription Information in Stripe

What’s remarkable is how the information syncs with Stripe. This makes it easy to manage your subscriptions, see sales, get users’ information, and much more.

From Stripe’s dashboard, you check out who signed up under the Customers tab. You’ll be able to view the email, trial end date, invoice number, credit card info, and all additional information you need.

The subscription details in Stripe.
As you can see, Forminator signed up for a subscription!

On top of that, you can see all of the subscriptions that you created in the Products area.

The products area in Stripe.
You can see the Yearly, Quarterly, and Monthly subscriptions.

All of this can be viewed in test data and live mode, making for smooth operations as you start collecting payment for your subscriptions!

Subscription Example

To get an idea of the possibilities with recurring subscriptions and payments, here’s an example of a book box membership created with Forminator.

A book club webpage.
A user enters exactly what they want.

As you can see, there are a lot of options and variables to choose from. Users decide whether to get hardcover only and extra items (e.g. coffee, bookmark, etc.). When it comes to subscription options, you can choose between 3, 6, and 12 months.

The form also gives a running total of the price.

It goes without saying that setting up an appealing subscription option can be a game-changer when it comes to your sales.

If you’d like to test out this specific template for yourself, upload the code for it into Forminator’s dashboard and give it a try! Get the code here to check it out.

Using Localization Number Formatting

Another advanced feature that’s now included with Forminator Pro is the option to use localized number formatting.

This feature is available for the Number, Currency, and Calculations fields. In these fields, you can edit the number format under the Settings > Formatting.

You choose your decimal separator from the Separator dropdown. From here, you’ll have numerous options for decimals and commas, including not having them in specific spaces.

The separators section.
You get to choose how you want to format your numbers.

Pick what decimals you want to round to in the — you guessed it — Round To section. You choose between 0-4.

Where you round the decimals off.
Totally up to you how many decimals to round to.

Finally, you can also pre-populate this field dynamically using the query parameter passed in your form URL. Just enter it in the Query Parameter area (e.g. query_parameter_key).

The pre-populate area.
Add any query parameter that you’d like.

Localization number formatting gives you more control of how the value of your field is displayed.

Other Features

Forminator Pro released some other advanced features that you will find beneficial. They include:

    • Stripe and PayPal Options In a Single Form
    • Quizzes Accessibility for Videos and Images

Let’s check them out!

Stripe and PayPal Options In a Single Form

Instead of having just one or the other, you can now include both Stripe and PayPal. They can be included as payment options for your users on a single form.

Just add the Stripe and PayPal fields to any form as a payment option. You can also use the Select field to provide a dropdown of the options.

The dropdown makes it simple for a user to choose their preferred payment.

Quizzes Accessibility for Videos and Images

Want to spice up your quizzes? Add videos in quiz answers! This is useful for various purposes (e.g. a correct answer to a scene in a movie, what a particular song is, etc.) and can provide added engagement.

It’s done by adding a link to a video on YouTube or elsewhere. Then, it’s just a matter of including the link to the video in the Description area.

The video URL.
Add text on top and the link below!

You can always arrange the quiz order from Forminator’s dashboard under Appearance > Layout > Quiz Item Ordering. This is beneficial for arranging if you need the video to appear first or want the description at the top of the question.

The quiz alignment area.
Simply drag and drop to arrange.

And just like that, you’ll have videos added to your quiz!

Forminator Pro’s Features Are Something To Subscribe To

With recurring payment options, more payment options, and the inclusion of videos for quizzes, your forms for your WordPress site will go beyond the norm!

Plus, there are new advanced features always in the works. Be sure to check out our Roadmap for a glimpse of what’s coming next.

Forminator Pro is worth subscribing to. Really though, you don’t need to “subscribe” — it comes with every WPMU DEV membership (which you can try free for 7-days).

How to Create a Short Link in WordPress (The Easy Way)

Category Image 091

Do you want to create short links to your WordPress blog posts or pages?

Short links are useful for sharing in your emails, Facebook messages, and even text messages.

In this article, we will show you how to generate short links using a plugin, and how to add the ‘Get Shortlink’ button back to the classic WordPress editor.

How to Create a Short Link in WordPress

Why Create a Short Link in WordPress?

Sharing your web content on social media can build user engagement and bring new users to your website. But pasting in long links or URLs isn’t always the best way.

That’s because some social media platforms will limit the number of characters you can use. A shorter URL gives you extra space for more useful content, which can lead to more engagement and traffic to your WordPress website.

That’s why URL shortener services like Bitly and TinyURL were originally created. They take a long link and make it shorter so that it doesn’t take up as much space.

For example, if you’re using SEO-friendly URL structures, then you might have long URLs that look something like this:

https://www.wpbeginner.com/beginners-guide/self-hosted-wordpress-org-vs-free-wordpress-com-infograph/

Our short link for that post saves a lot of space:

http://wpbeg.in/b6xh7G

Note: We’re using a custom domain, wpbeg.in, for our short links, which is a bit more technical to set up and would require you to purchase another domain. We have a separate tutorial on how to create your own customized short URL.

In the past, WordPress made it easy to get a short link to your blog post or page. There was a Get Shortlink button located right next to the permalink area of the classic editor.

Get Shortlink Button in the Classic Editor

However, if you recently started your blog, then you will not see this feature on your WordPress site because it was removed after WordPress version 4.4. WordPress still creates the links, but the button has been removed.

Still, there are a few ways you can get short links for your WordPress posts and pages.

We’ll cover the best link shortener plugin, plus a couple of ways you can restore the ‘Get Shortlink’ button in the classic editor. Simply click the links below to jump straight to each option:

We’ll start with a method that works for everyone. The Pretty Links plugin doesn’t rely on the classic editor and will create its own short link out of any URL.

It works with all links, including pages outside of your blog or website. So, besides letting you share your own content, it’s also the perfect tool for shortening affiliate links.

To get started, you’ll need to install and activate the Pretty Links plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Note: There is a Pro version of Pretty Links with more powerful features like keyword auto-linking and link categories and tags, but for this tutorial we will be using the free version.

Once you activate the plugin, a Pretty Links section is added to your WordPress dashboard. To create your first short link, you need to go to the Pretty Links » Add Link page.

Next, you need to paste the original URL of the page you want to share into the Target URL text field. A short Pretty Link is automatically created, but you can customize it if you’d like to make it more readable.

Paste the Original URL Into Target URL

Once you’ve created a few short links, you may not remember what they are all for. So it’s a good idea to type in the title of the web page and consider writing some notes of anything you need to remember.

Fill in the Title and Notes

Once you have filled in the Pretty Links form, click the Update button to activate the short link.

Click the Update Button to Activate the Short Link

You will now see a list of all of your Pretty Links. To copy one to the clipboard, just click on the Copy icon at the right of the screen.

After that, you can paste it into any of your social media channels. Pretty Links will even keep track of how many clicks each link gets.

Copy the Short Link Using the Copy Icon

While pretty links have built-in analytics, you can further improve your analytics by connecting it with Google Analytics using the MonsterInsights plugins. For more details, see our step by step guide on how to properly set up Google Analytics in WordPress.

This is a simple method of adding back the Get Shortlink button to the classic editor.

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

Upon activation, this plugin will automatically add the Get Shortlink button to the classic editor. To check that it worked, just edit any of your posts.

The Get Shortlink Button is Added to the Classic Editor

When you click the Get Shortlink button, it will show you the WordPress Shortlink for your post or page. You can copy the link to the clipboard so you can share it with your audience in your emails and messages.

Copy the Short Link to Share It with Your Audience

This method is for more advanced users and uses code rather than a plugin. It adds the Shortlink button to the classic editor by adding a custom code snippet to your theme’s functions.php file.

We don’t recommend this method to inexperienced users because if you make a mistake, then it could break your website. Method 2 above is a simpler way to achieve the same result without needing to use code.

If this is your first time adding code to your WordPress files, then you should check out our guide on how to copy and paste code snippets in WordPress.

We’ll use the Code Snippets plugin mentioned in that guide, so you’ll need to install that first. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, the plugin will add a new menu item labeled Snippets to your WordPress admin bar. Clicking on it will show you a list of all the custom code snippets you have saved on your site.

Go ahead and click on the Add New button to add your first custom code snippet in WordPress.

Click the Add New Button to Add Your First Custom Code Snippet in WordPress

This will bring you to the ‘Add New Snippet’ page.

You need to start by entering a title for your custom code snippet. Let’s call it ‘Short Link Button’. After you enter a title, simply copy and paste the code snippet below into the code box.

add_filter( 'get_shortlink', function( $shortlink ) {return $shortlink;} );

Copy and Paste the Code Snippet Into the Code Box

When you come across this snippet in the future, you may not remember what it’s for. So it’s a good idea to type something helpful in the description as a reminder.

Type Something Helpful in the Description

You can also assign tags to your code snippet. This will help you sort your code snippets by topic and functionality.

Finally, you need to click on the ‘Save Changes and Activate’ button. Once the snippet is activated, the Shortlink button will be added to the classic editor.

The Shortlink Button Will Be Added

We hope this article helped you learn how to create a short link in WordPress. You might also like to learn how to get a free email domain, or see our comparison of the best domain name registrars.

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 Create a Short Link in WordPress (The Easy Way) appeared first on WPBeginner.

How Employee Work-Life Balance Contributes to a Positive Team Culture? How Are You Helping Your Employees Maintain Work-Life Balance?

Featured Imgs 23

Work-life balance is something everyone desires, but so few can truly achieve. Thankfully, business leaders can help employees reach this balanced state and create a more positive company culture in turn. Here are some tips...

The post How Employee Work-Life Balance Contributes to a Positive Team Culture? How Are You Helping Your Employees Maintain Work-Life Balance? appeared first on 85ideas.com.