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;
}
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.
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:
Running a restaurant is not for the faint of heart. There are just many tasks to juggle at any given time. If you’re not trying to cut food costs, you’re talking to suppliers or balancing books. If you’re not whipping up specials and prepping recipes, you’re hiring (or firing) staff. It is a lot of […]
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 …
Have you been thinking about starting a blog, but don’t have any idea where to start? Setting up a blog seems really overwhelming, but it doesn’t have to be. Once you’ve figured out...
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;
We know the struggle of having 20 social media accounts, from personal to business ones, emails, sites, and so on. Especially nowadays, once you are logged in on your smartphone, you do not need to...
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
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.
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.
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 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 […]
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.
Some minor aesthetics changes to the @CodePen editor. Some of the colors in use are now more derived from your chosen theme.
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!
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.
It will tell you whether the add-on is installed or not, too.
At this point, you click Activate.
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.
Once your information is added, you’ll hit Connect.
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.
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 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.
Three plans are available.
Now we include the Stripe field and edit its settings.
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…
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.
Enter any amount you want!
From here, you choose a Quantity. Pick a fixed amount or variable — whatever is best for your specific needs.
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)
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.
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 is right next to Plan Setup.
From here, you add the condition(s) selections from the dropdown.
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 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.
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.
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.
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 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.
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.
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).
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.
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.
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.
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.
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:
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.
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:
Method 1: Create Short Links Using the Pretty Links Plugin
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.
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.
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.
Once you have filled in the Pretty Links form, 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.
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.
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.
Method 3: Creating a Short Link Button in the Classic Editor with Code
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.
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.
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.
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.
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.
Hi, I am currently working on a banlist and I am thinking about which data type to choose for storing the IP address in the database. Will the Binary data type be ideal?
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...
In late 2020, Twitter launched Spaces, a new tool for group voice chats that was intended to enable a more robust experience on the platform. Since that time, the company has been slowly expanding access to the product and is now expanding access to developer tools to support this growth.