Having values from combobox printed into textbox

I have a Python file with 50+ frames.
Each frame has 5 radio button and 1 textbox.
Each radio button has a pre-determine numeric value that will print to textbox.

What I would like to do is replace the radio buttons with a combobox.
the combobox is set up with a base numeric value with a math equation.

The principle works but i can only get it to print to shell.

I have tried numerous different code from posts for the past month.

I thought the community may be able to help me.

I have attached a snippet of my code.

Thanks in advance.

from tkinter import *
from tkinter import Tk
import tkinter as tk
from tkinter import ttk
from tkinter.ttk import Combobox
root=tk.Tk()

root.title("Dental Milling Machines")
root.geometry("250x200")


def onclick1():#3M
textbox1.delete('1.0', 'end')
textbox1.insert('end', '2.83')
def onclick2():#3M
textbox1.delete('1.0', 'end')
textbox1.insert('end', '5.66')


def to_float( string ):
try:
    return float( string )
except ValueError:
    return 0.0

def Cnum():
print(combobox2.current()*2.83)


cb_var1 = tk.IntVar()

frame1 = Frame(root, height = 150, width= 150, relief= RAISED, bd=8, bg="blue")

frame1.grid(row=0, column=0, pady=2,sticky="NW")
label = Label(frame1, text="Frame 1", fg="red")
label.grid(row=0, columnspan=3, pady= 1, sticky= "W")

button1=Radiobutton(frame1, text="Submit", command=Cnum)
button1.grid(row=1, column=1, pady= 1, padx= 5, sticky= "W")



textbox1=Text(frame1, borderwidth=1, wrap="none", width=5, height=1)
textbox1.grid(row=0, column=1,padx=10, sticky="W")


combobox2=Combobox(frame1, width=7)
combobox2.grid(row=1, column=0)
combobox2['values'] = ( '', ' 1', ' 2', ' 3', ' 4', ' 5')

button1=Radiobutton(frame1, text="1 Unit ", variable=cb_var1, command=onclick1)
button1.grid(row=2, column=0, pady= 1, padx= 5, sticky= "W")
button2=Radiobutton(frame1, text="2 Unit ", variable=cb_var1, command=onclick2)
button2.grid(row=4, column=0, pady= 1, padx= 5, sticky= "W")

root.mainloop()

Two New Editor Fonts from Toshi Omagari

Toshi Omagari makes fonts. I caught wind of the Codelia release just recently:

Fortunately, Toshi allowed us to purchase a license to allow you to use it on CodePen! You’ll find those options in your Settings > Editor area.

Codelia

I think Codelia is awfully nice, but in chatting with Toshi, their favorite is actually Comic Code, another coding font they have created.

Comic Code

I was like: No way, surely Comic Code is to jokey and childish to actually code in. But I’ll tell ya, I’ve been using it for about a week now and I’m still finding it fun and perfectly usable.

Looks good eh? Toshi thinks so:

The post Two New Editor Fonts from Toshi Omagari appeared first on CodePen Blog.

Lower Inventory Cash Burn in Your WooCommerce Store

Lower Inventory Cash Burn in Your WooCommerce StoreNo matter how successfully you market your e-commerce business, an inability to handle inventory can become a roadblock in your way to making efficient supply decisions. Your inventory management process becomes largely inefficient when you don’t have a grip on your inventory or keep a track of it with unorganized spreadsheets. To avoid inventory cash […]

The post Lower Inventory Cash Burn in Your WooCommerce Store appeared first on WPExplorer.

Long Hover

I had a very embarrassing CSS moment the other day.

I was working on the front-end code of a design that had a narrow sidebar of icons. There isn’t enough room there to show text of what the icons are, so the idea is that we’ll use accessible (but visually hidden, by default) text that is in there already as a tooltip on a “long hover.” That is, a device with a cursor, and the cursor hovering over the element for a while, like three seconds.

So, my mind went like this…

  1. I can use state: the tooltip is either visible or not visible. I’ll manage the state, which will manifest in the DOM as a class name on an HTML element.
  2. Then I’ll deal with the logic for changing that state.
  3. The default state will be not visible, but if the mouse is inside the element for over three seconds, I’ll switch the state to visible.
  4. If the mouse ever leaves the element, the state will remain (or become) not visible.

This was a React project, so state was just on the mind. That ended up like this:

Not that bad, right? Eh. Having state managed in JavaScript does potentially open some doors, but in this case, it was total overkill. Aside from the fact that I find mouseenter and mouseleave a little finicky, CSS could have done the entire thing, and with less code.

That’s the embarrassing part… why would I reach up the chain to a JavaScript library to do this when the CSS that I’m already writing can handle it?

I’ll leave the UI in React, but rip out all the state management stuff. All I’ll do is add a transition-delay: 3s when the .icon is :hover so that it’s zero seconds when not hovered, then goes away immediately when the mouse cursor leaves).

A long hover is basically a one-liner in CSS:

.thing {
  transition: 0.2s;
}
.thing:hover {
  transition-delay: 3s; /* delay hover animation only ON, not OFF */
}

Works great.

One problem that isn’t addressed here is the touch screen problem. You could argue screen readers are OK with the accessible text and desktop browsers are OK because of the custom tooltips, but users with touch-only screens might be unable to discover the icon labels. In my case, I was building for a large screen scenario that assumes cursors, but I don’t think all-is-lost for touch screens. If the element is a link, the :hover might fire on first-tap anyway. If the link takes you somewhere with a clear title, that might be enough context. And you can always go back to more JavaScript and handle touch events.


The post Long Hover appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Automatically Create Image Slideshows With the Full Screen Galleries Plugin

Earlier today, core WordPress contributor Nick Halsey released Full Screen Galleries, a plugin that automatically creates a full-screen slideshow when site visitors click on an image. The plugin works with all images, regardless of whether they are in a gallery block. It also supports both the classic and block editors.

Lightbox-type plugins are a dime a dozen. It is tough to wade through them to find the perfect solution. However, sometimes the simplest solution is the way to go. Halsey’s plugin has no settings screen, post metadata, or block options. It is plug-and-play. The only configuration is in activating the plugin itself.

Full Screen Galleries creates a slideshow-style overlay for all images located on a post or page. When a visitor clicks on one, the full-screen slideshow takes over the page.

Popup overlay of an image slideshow with arrows for navigation.
Slideshow overlay from Full Screen Galleries.

Halsey has a demo page on his site where potential users can see the plugin in action.

There are more advanced options out there. Some show EXIF data, create transition effects and other types of animation, and offer a boatload of customizable settings. However, I prefer the simplicity of something that I can activate and forget. Over the years, I have come to appreciate these types of plugins more and more. They let me get back to focusing on the parts of my sites that I care about.

Full Screen Galleries also figures out the full-sized image URL automatically. If a gallery uses thumbnail-sized images and links to the attachment page, the slideshow will still display it in full.

Each slide outputs forward and back arrows to scroll between the images. In the top left corner is an exit button. In the top right, the plugin outputs a northeast arrow button that links to the original image. It also displays the image caption if it is available.

For many users, this is all they need. I am particularly interested in it because it works well with classic content. Many of the sites I am involved with have years of galleries from the pre-block era.

One of the downsides is that the plugin relies on jQuery. The plugin’s code has a small footprint, but jQuery has grown into a bit of a beast over the years and is becoming less and less relevant with more recent features of modern JavaScript. For many WordPress sites, this may be a non-issue because their theme or some other plugin is already loading the jQuery library. This plugin will be a lightweight addition. For others who are keeping it lean, they might want to seek out alternative solutions.

Regardless, this plugin is going into my toolbox, ready to pull out when I need it. Overall, it is a dependable version 1.0.

Attackers Continue to Exploit Vulnerabilities in The Plus Addons for Elementor Plugin

Last week, security researchers at Seravo and WP Charged reported a critical zero-day vulnerability in The Plus Addons for Elementor on March 8, 2021. WPScan categorized it as an authentication bypass vulnerability:

The plugin is being actively exploited to by malicious actors to bypass authentication, allowing unauthenticated users to log in as any user (including admin) by just providing the related username, as well as create accounts with arbitrary roles, such as admin. These issues can be exploited even if registration is disabled, and the Login widget is not active.

It’s important to note that this particular vulnerability affects users of the commercial version of The Plus Addons for Elementor, not the free version, and not core Elementor.

The plugin’s authors pushed out a partially patched version 4.1.6 after disclosure and then a second version 4.1.7 to more fully address the issue.

Wordfence is reporting that they are still blocking attempts on sites that are using unpatched. They have blocked 1900 site takeover attempts from a specific username, blocked 1170 attempts from a specific email, and blocked 4,000 attempts over the past week. Attackers are still targeting sites that have not updated to the patched version.

“Evidence suggests it had been actively exploited for ~5 days before that,” Wordfence threat analyst Chloe Chamberland said on the Wordfence Live show today. “Our earliest date of compromise was March 5th that we know of so far. There was a vulnerability for a few days that nobody really knew about except for this attacker who was going out and exploiting it.”

Those whose sites have been exploited have seen malicious admin accounts created. Others have experienced every URL on their sites redirecting, making it very difficult to clean. Attackers have also been installing malicious plugins called “WP Strongs” and “WP Staff.” Those who cannot access the admin dashboard will have a more difficult time removing these plugins.

Elementor users who have the Plus Addons plugin installed are advised to update to the latest version and check for malicious plugins and files. Ideally, site owners who were subject to exploits would have a backup to restore. Chamberland concluded the Wordfence Live broadcast today by walking users through manually cleaning up exploited sites, including replacing the wp-includes and wp-admin folders, along with standard files outside those directories. The recording might be helpful for those who are struggling to clean up the damage.

Scalable Jenkins on Kubernetes Cluster and Pipeline for Automated CI/CD (Jenkins—Github Integration)

Introduction

Setting up scalable Jenkins on Kubernetes can be a daunting task. This article demonstrates not only how to set up scalable Jenkins on Kubernetes but also how to integrate Jenkins into Github so that whenever any Pull Request is requested on a branch, the build is automatically triggered and results are made available to the branch admin to review before merging the Pull Request.

Let us first get the scalable Jenkins up before setting up a pipeline for automated CI/CD.

What is a Blog and How is it Different Than a Website?

The difference isn’t as prominent as you may think because, technically, both are websites that help you accomplish some of the same things. But there are a few important things you should know.

In this guide, I’ll give you a walkthrough through the world wide web to help you become an expert in starting a blog and distinguishing from a website.

What’s a Blog Anyway?

A blog is a type of website.

It’s where you present your content—news, tutorials, tips, articles, collections, lists, anything—in chronological order, with newest at the top down to oldest at the bottom. The goal is simple: Whenever anyone visits your blog, they’ll see the most recent blog post at the top.

Here’s an example from our Quicksprout:

A blog layout generally includes details like title, author, brief description, the publish date, etc. There is also usually a section where users can leave comments.

It’s either an individual or a small group of people who run a blog to present topics in a conversational style. You’ll find informational and thought leadership-style content, too.

Blogs run on a content management system or CMS, such as WordPress. It’s a tool that lets you edit your blog content as you would in MS Word or Google Docs. It also makes managing your content easier, even if you don’t have web development or web programming skills or knowledge.

Another interesting thing to note here is that a blog could be a website by itself or included as part of a larger, more expansive website. The Quicksprout blog, for example, is a blog contained within the main website, Quicksprout. In comparison, Mashable is a blog as well as a website.

Read that again.

People typically start a blog to journal their thoughts, ideas, and hobbies with the intent to make money. I’ll discuss this in more detail later in the article.

Examples of Some of the Best Blogs

The hardest part about blogging is getting started.

Before you begin writing, you have to pick a niche, choose a theme, and build a content strategy to realize your blogging goals and objectives. And that’s just a gist of it.

To make it slightly easier for you, here are the examples of three great blogs that present some fantastic ideas you can use for inspiration.

Shopify

Shopify needs no introduction. It’s an excellent ecommerce platform that is perfect for anyone who wants to launch an online business. As one would expect, their blog contains a broad range of topics related to ecommerce, marketing, business, and the web in general.

Why Does It Work?

One thing that really stands out about the Shopify blog is the variety of content. Despite being an ecommerce website builder, it successfully avoids being too narrowly focused.

It covers everything you need to know about running an ecommerce business and more. You’ll find marketing tips, helpful techniques to promote sales hacks to capture more market share, and so on. By staying more broad in the subject matter, Shopify doesn’t go too narrow and miss out on views.

Ideas to Try:

You can also cover a variety of topics in your blog to boost your traffic.

Start by figuring out the topics that would resonate with your target audience, and then regularly publish helpful articles. It would be even better to get different people to write your content to have multiple voices and points of view.

Michael Hyatt

Michael S. Hyatt is the CEO and founder of Michael Hyatt & Company. Throughout his career, he has produced several books about leadership, productivity, and goal setting.

His blog is a reflection of his experience and expertise in his selected niche. When people read Hyatt’s articles, they know he is reliable, and the information is something they can trust.

Why Does It Work?

Michael’s blog has a no-nonsense approach. Instead of overcrowding his blog page with haphazardly placed blog articles, he has displayed his content simply in two parallel columns.

Every article has a bold heading with an image, which adds to the neat appearance. This is, of course, in addition to the high-quality advice his articles have. As such, visitors get the best of both worlds: visually-attractive content and valuable advice.

Ideas to Try:

Plan out your posts where you share practical advice, and then group them together by theme. Make sure you have a supporting real-life image—not cartoons or copied images of stats and quotes—to add a more professional touch to your blogs.

Your articles should have a warm and friendly tone, and the content should clearly establish your authority on the subject.

Spoon Fork Bacon

Food blogs are a competitive niche. But despite the competition, Spoon Fork Bacon manages to stand out—for all the right reasons. It has a clean design filled with quality photos and recipes. In fact, this blog could very well be a case study in food blogging and writing.

Why Does It Work?

The blog’s name is unique and catchy. It instantly lets the reader know that this blog is fun and has tons of personality.

Next, you’ll find several high-quality images of the different recipes prepared by the owners, which works since food presentation is equally important for foodies. Every blog is well-written and highly detailed about a specific recipe.

Ideas to Try:

Use lots of high-quality photography across your blog. Also, you can get a writing partner or someone to help you with your blog like Spoon Fork Bacon (It’s a collaboration between two foodies, Teri and Jenny)

While you’re at it, don’t try to clutter the blog with unnecessary information or ads. If you do want to monetize your blog, be careful with how you place advertisements.

How’s a Blog Different From a Website?

Since we’ve covered what a blog is all about, let’s find out what we mean by a website.

When you open up your web browser and enter a web address like www.quicksprout.com, what you see on your computer screen is a website. In fact, whatever you open from your web browser will have you end up on some kind of website. Google is a website, and so are Instagram and Twitter and Huffington Post.

Technically speaking, a website is a collection of landing pages and multimedia content collated under a single domain. Every website is usually hosted over a web hosting service that allows these pages and content to be accessed over the internet.

That said, a website can also be a single page.

But how is a blog different from a website?

Blogs are dynamic and are updated regularly with fresh new content. On the other hand, generic websites are more static. Here, the content is organized in pages, which is why they don’t have to be updated frequently. Examples include About Us pages, product pages, or Contact Me pages. These are typically static, meaning the pages stay the same over time.

Additionally, blogs are often one part of a larger website. You’ll find websites having a separate blog section they regularly update to educate their customers and attract more organic traffic to the website.

In other words, while all blogs can be a website or a part of a website, not all websites can be called blogs.

When to Start a Blog

You can start a blog for various reasons. Some turn to blogging to voice their feelings and thoughts, while others want to share their opinion or knowledge on a topic.

You’ll also find bloggers who want to connect with like-minded people and help others by sharing their creativity and expertise on a particular subject. This is in addition to the obvious fact that most want to earn extra income from their blog, whether through advertisements, affiliate marketing, or using it as a lead generator.

If you find yourself nodding your head to any one of these reasons, and you have a lot of fresh information to share with the world, then a blog is probably the right choice for you now.

When to Start a Website

If you run a business that sells products or services or plan to start one, you definitely need a website to boost your sales and conversions.

A website is an excellent way to help potential customers find you and learn more about what you have to offer. They allow you to create a 24/7 online presence to make it easier for customers to find you anytime, anywhere.

The key here is to optimize the website to make your landing pages rank higher in the SERPs. You can include every detail you want to communicate about your products or services. Think of it as an advertisement for your offering.

You can also gain useful consumer insights through your website. For instance, you can identify who your typical customer is and what they like, how they find you, and how you can change your business strategies to maximize purchases through your site.

These insights can also help you identify ways to improve the offline aspects of your business, such as branch opening times, product ranges, and promotions.

How to Start a Blog

Starting a blog is a very straightforward process. There are specific steps you need to follow, and you’ll surely see results.

Before you can think about launching your blog, you have to pick a web hosting service and come up with a name for your blog. Once that’s done, you can start your blog by launching WordPress. Follow this by choosing an attractive theme to add more personality to your blog.

While it’s optional, I also recommend adding specific WordPress plugins that can help extend your blog’s capabilities.

For example, you can use Yoast SEO for optimizing your articles to help them rank higher in Google, UpdraftPlus for creating backups of your website, and Akismet Anti-Spam for handling unwanted spam. There are several others as well that you can use to make blogging easier for you.

The only thing left to do is also the most important: write high-quality content consistently.

Whatever content you post on your blog should be compelling and something your readers will love and learn from. Otherwise, the whole point of taking the effort of launching a blog will be a waste. Do thorough research to come up with ways to add a unique angle to your articles.

Even if you don’t have the fanciest-looking blog, you’ll still have a loyal fan base if you consistently provide value to your readers.

Wondering how to do this? Make sure you check out the following blogs to help you start blogging the right way:

We’ve also grouped all our articles related to blogging here.

Introduction To Google Anthos

Introduction

Google has put over a decade’s worth of work into formulating the newly released Anthos. Anthos is the bold culmination and expansion of many admired container products, including Linux Containers, Kubernetes, GKE (Google Kubernetes Engine), and GKE On-Prem. It has been over a year since the general availability of Anthos was announced, and the platform marks Google’s official step into enterprise data center management.

Anthos is the first next-gen tech multi-cloud platform supporter designed by a mainstream cloud provider. The platform’s unique selling point lies in application deployment capability across multiple environments, whether on-premises data centers, Google cloud, other clouds, or even existing Kubernetes clusters.

Sending books to ereader with Calibre

I have an ereader and I'm trying to upload books to it. Therefore I use the app Calibre. But the "send to device" options all don't allow me to do so. Any users of this app here?

Thanks

I must add: The device is a Kobo Glo

Better Line Breaks for Long URLs

CSS-Tricks has covered how to break text that overflows its container before, but not much as much as you might think. Back in 2012, Chris penned “Handling Long Words and URLs (Forcing Breaks, Hyphenation, Ellipsis, etc)” and it is still one of only a few posts on the topic, including his 2018 follow-up Where Lines Break is Complicated. Here’s all the Related CSS and HTML.

Chris’s tried-and-true technique works well when you want to leverage automated word breaks and hyphenation rules that are baked into the browser:

.dont-break-out {
  /* These are technically the same, but use both */
  overflow-wrap: break-word;
  word-wrap: break-word;

  word-break: break-word;

  /* Adds a hyphen where the word breaks, if supported (No Blink) */
  hyphens: auto;
}

But what if you can’t? What if your style guide requires you to break URLs in certain places? These classic sledgehammers are too imprecise for that level of control. We need a different way to either tell the browser exactly where to make a break.

Why we need to care about line breaks in URLs

One reason is design. A URL that overflows its container is just plain gross to look at.

Then there’s copywriting standards. The Chicago Manual of Style, for example, specifies when to break URLs in print. Then again, Chicago gives us a pass for electronic documents… sorta:

It is generally unnecessary to specify breaks for URLs in electronic publications formats with reflowable text, and authors should avoid forcing them to break in their manuscripts.

Chicago 17th ed., 14.18

But what if, like Rachel Andrew (2015) encourages us, you’re designing for print, not just screens? Suddenly, “generally unnecessary” becomes “absolutely imperative.” Whether you’re publishing a book, or you want to create a PDF version of a research paper you wrote in HTML, or you’re designing an online CV, or you have a reference list at the end of your blog post, or you simply care how URLs look in your project—you’d want a way to manage line breaks with a greater degree of control.

OK, so we’ve established why considering line breaks in URLs is a thing, and that there are use cases where they’re actually super important. But that leads us to another key question…

Where are line breaks supposed to go, then?

We want URLs to be readable. We also don’t want them to be ugly, at least no uglier than necessary. Continuing with Chicago’s advice, we should break long URLs based on punctuation, to help signal to the reader that the URL continues on the next line. That would include any of the following places:

  • After a colon or a double slash (//)
  • Before a single slash (/), a tilde (~), a period, a comma, a hyphen, an underline (aka an underscore, _), a question mark, a number sign, or a percent symbol
  • Before or after an equals sign or an ampersand (&)

At the same time, we don’t want to inject new punctuation, like when we might reach for hyphens: auto; rules in CSS to break up long words. Soft or “shy” hyphens are great for breaking words, but bad news for URLs. It’s not as big a deal on screens, since soft hyphens don’t interfere with copy-and-paste, for example. But a user could still mistake a soft hyphen as part of the URL—hyphens are often in URLs, after all. So we definitely don’t want hyphens in print that aren’t actually part of the URL. Reading long URLs is already hard enough without breaking words inside them.

We still can break particularly long words and strings within URLs. Just not with hyphens. For the most part, Chicago leaves word breaks inside URLs to discretion. Our primary goal is to break URLs before and after the appropriate punctuation marks.

How do you control line breaks?

Fortunately, there’s an (under-appreciated) HTML element for this express purpose: the <wbr> element, which represents a line break opportunity. It’s a way to tell the browser, Please break the line here if you need to, not just any-old place.

We can take a gnarly URL, like the one Chris first shared in his 2012 post:

http://www.amazon.com/s/ref=sr_nr_i_o?rh=k%3Ashark+vacuum%2Ci%3Agarden&keywords=shark+vacuum&ie=UTF8&qid=1327784979

And sprinkle in some <wbr> tags, “Chicago style”:

http:<wbr>//<wbr>www<wbr>.<wbr>amazon<wbr>.com<wbr>/<wbr>s/<wbr>ref<wbr>=<wbr>sr<wbr>_<wbr>nr<wbr>_<wbr>i<wbr>_o<wbr>?rh<wbr>=<wbr>k<wbr>%3Ashark<wbr>+vacuum<wbr>%2Ci<wbr>%3Agarden<wbr>&<wbr>keywords<wbr>=<wbr>shark+vacuum<wbr>&ie<wbr>=<wbr>UTF8<wbr>&<wbr>qid<wbr>=<wbr>1327784979

Even if you’re the most masochistic typesetter ever born, you’d probably mark up a URL like that exactly zero times before you’d start wondering if there’s a way to automate those line break opportunities.

Yes, yes there is. Cue JavaScript and some aptly placed regular expressions:

/**
 * Insert line break opportunities into a URL
 */
function formatUrl(url) {
  // Split the URL into an array to distinguish double slashes from single slashes
  var doubleSlash = url.split('//')

  // Format the strings on either side of double slashes separately
  var formatted = doubleSlash.map(str =>
    // Insert a word break opportunity after a colon
    str.replace(/(?<after>:)/giu, '$1<wbr>')
      // Before a single slash, tilde, period, comma, hyphen, underline, question mark, number sign, or percent symbol
      .replace(/(?<before>[/~.,\-_?#%])/giu, '<wbr>$1')
      // Before and after an equals sign or ampersand
      .replace(/(?<beforeAndAfter>[=&])/giu, '<wbr>$1<wbr>')
    // Reconnect the strings with word break opportunities after double slashes
    ).join('//<wbr>')

  return formatted
}

Try it out

Go ahead and open the following demo in a new window, then try resizing the browser to see how the long URLs break.

This does exactly what we want:

  • The URLs break at appropriate spots.
  • There is no additional punctuation that could be confused as part of the URL.
  • The <wbr> tags are auto-generated to relieve us from inserting them manually in the markup.

This JavaScript solution works even better if you’re leveraging a static site generator. That way, you don’t have to run a script on the client just to format URLs. I’ve got a working example on my personal site built with Eleventy.

If you really want to break long words inside URLs too, then I’d recommend inserting those few <wbr> tags by hand. The Chicago Manual of Style has a whole section on word division (7.36–47, login required).

Browser support

The <wbr> element has been seen in the wild since 2001. It was finally standardized with HTML5, so it works in nearly every browser at this point. Strangely enough, <wbr> worked in Internet Explorer (IE) 6 and 7, but was dropped in IE 8, onward. Support has always existed in Edget, so it’s just a matter of dealing with IE or other legacy browsers. Some popular HTML-to-PDF programs, like Prince, also need a boost to handle <wbr>.

One more possible solution

There’s one more trick to optimize line break opportunities. We can use a pseudo-element to insert a zero width space, which is how the <wbr> element is meant to behave in UTF-8 encoded pages anyhow. That’ll at least push support back to IE 9, and perhaps more importantly, work with Prince.

/** 
 * IE 8–11 and Prince don’t recognize the `wbr` element,
 * but a pseudo-element can achieve the same effect with IE 9+ and Prince.
 */
wbr:before {
  /* Unicode zero width space */
  content: "\200B";
  white-space: normal;
}

Striving for print-quality HTML, CSS, and JavaScript is hardly new, but it is undergoing a bit of a renaissance. Even if you don’t design for print or follow Chicago style, it’s still a worthwhile goal to write your HTML and CSS with URLs and line breaks in mind.

References


The post Better Line Breaks for Long URLs appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Java – Collection with File Handling and

Hi Experts,

Appreciate your help or advise as I am stuck.

The user will input all of the objects (like name, gender, age) into the system. Once, user input it will write to a file.
The program should only handle file handling. is my program correct? Thank you in advance

import java.util.*;
import java.text.*;
import java.io.*;
 import java.util.Scanner;

public class Sample {

    public static void main(String[] args) {
        //if (args.length < 1) {
         //   System.out.println("Please provide output file");
        //    System.exit(0);
      //  }

       // String outputFile = args[0];

        DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");

        try (
            BufferedWriter groceryFile = new BufferedWriter(new FileWriter("grocery.txt", true))) {
            Scanner input = new Scanner(System.in);

            Set<Student> listStudent = new HashSet<>();
            Student student = new Student();
            System.out.println("Student name");
            Student.setName(input.nextLine());

            listStudent.add(
                new Student("Mike", dateFormat.parse("01-15-1998"), false, 40, 80.5f));



            for (Student student : listStudent) {
                groceryFile.write(student.getName());
            }

        } catch (IOException | ParseException ex) {
            ex.printStackTrace();
        }
    }

Good, Better, Best: Untangling The Complex World Of Accessible Patterns

Marc Benioff memorably stated that the only constant in the technology industry is change. Having worked in tech for over 15 years, I can confirm this. Fellow tech dinosaurs can attest that the way the web worked in the early days is drastically different than many of us could have even imagined.

While this constant change in the technology industry has led to innovation and advancements we see today, it has also introduced the concept of choice. While choice — on the surface — may seem like an inherently positive thing, it does not always equal rainbows and roses. The influx of technological change also brings the splintering of coding languages and the never-ending flavors of programming “hotness.” Sometimes this abundance of choice turns into overchoice — a well-studied cognitive impairment in which people have difficulty making a decision due to having too many options.

In this article, we will attempt to untangle the complex world of accessible patterns — one step at a time. We will kick things off by reviewing current accessible patterns and libraries, then we will consider our general pattern needs and potential restrictions, and lastly, we will walk through a series of critical thinking exercises to learn how to better evaluate patterns for accessibility.

What A Tangled Web We Weave

Overchoice has crept its way into all aspects of technology, including the patterns and libraries we use to build our digital creations — from the simple checkbox to the complex dynamic modal and everything in between. But how do we know which pattern or library is the right one when there are so many choices? Is it better to use established patterns/libraries that users encounter every day? Or is it better to create brand new patterns for a more delightful user experience?

With the myriad of options available, we can quickly become paralyzed by the overabundance of choices. But if we take a step back and consider why we build our digital products in the first place (i.e. the end-user) doesn’t it make sense to choose the pattern or library that can add the most value for the largest number of people?

If you thought choosing a pattern or library was an already daunting enough process, this might be the point where you start to get worried. But no need to fret — choosing an accessible pattern/library isn’t rocket science. Like everything else in technology, this journey starts with a little bit of knowledge, a huge heaping of trial and error, and an understanding that there is not just one perfect pattern/library that fits every user, situation, or framework.

How do I know this? Well, I have spent the past five years researching, building, and testing different types of accessible patterns while working on the A11y Style Guide, Deque’s ARIA Pattern Library, and evaluating popular SVG patterns. But I have also reviewed many client patterns and libraries on every framework/platform imaginable. At this point in time, I can say without qualms that there is an innate hierarchy for pattern accessibility that starts to develop when you look long enough. And while there are occasionally patterns to avoid at all costs, it isn’t always so clear-cut. When it comes to accessibility, I would argue most patterns fall into gradients of good, better, best. The difficult part is knowing which pattern belongs in what category.

Thinking Critically About Patterns

So how do we know which patterns are good, better, best when it comes to accessibility? It depends. This often invoked phrase from the digital accessibility community is not a cop-out but is shorthand for “we need more context to be able to give you the best answer.” However, the context is not always clear, so when building and evaluating the accessibility of a pattern, some fundamental questions I ask include:

  • Is there already an established accessible pattern we can use?
  • What browsers and assistive technology (AT) devices are we supporting?
  • Are there any framework limitations or other integrations/factors to consider?

Of course, your specific questions may vary from mine, but the point is you need to start using your critical thinking skills when evaluating patterns. You can do this by first observing, analyzing, and then ranking each pattern for accessibility before you jump to a final decision. But before we get to that, let’s first delve into the initial questions a bit more.

Is There Already An Established Accessible Pattern?

Why does it seem that with each new framework, we get a whole new set of patterns? This constant reinvention of the wheel with new pattern choices can confuse and frustrate developers, especially since it is not usually necessary to do so.

Don’t believe me? Well, think about it this way: If we subscribe to the atomic design system, we understand that several small “atoms” of code come together to create a larger digital product. But in the scientific world, atoms are not the smallest component of life. Each atom is made of many subatomic particles like protons, neutrons, and electrons.

That same logic can be applied to our patterns. If we look deeper into all the patterns available in the various frameworks that exist, the core subatomic structure is essentially the same, regardless of the actual coding language used. This is why I appreciate streamlined coding libraries with accessible patterns that we can build upon based on technological and design needs.

Note: Some great reputable sources include Inclusive Components, Accessible Components, and the Gov.UK Design System, in addition to the list of accessible patterns Smashing Magazine recently published (plus a more detailed list of patterns and libraries at the end of the article).

What Browsers And Assistive Technology (AT) Devices Are We Supporting?

After researching a few base patterns that might work, we can move on to the question of browser and assistive technology (AT) device support. On its own, browser support is no joke. When you add in AT devices and ARIA specifications to the mix, things begin to get tricky...not impossible, just a lot more time, effort, and thought-process involved to figure it all out.

But it’s not all bad news. There are some fabulous resources like HTML5 Accessibility and Accessibility Support that help us build a greater understanding of current browser + AT device support. These websites outline the different HTML and ARIA pattern sub-elements available, include open source community tests, and provide some pattern examples — for both desktop and mobile browsers/AT devices.

Are There Any Framework Limitations Or Other Integrations/Factors To Consider?

Once we have chosen a few accessible base patterns and factored in the browser/AT device support, we can move on to more fine-grained contextual questions around the pattern and its environment. For example, if we are using a pattern in a content management system (CMS) or have legacy code considerations, there will be certain pattern limitations. In this case, a handful of pattern choices can quickly be slashed down to one or two. On the flip side, some frameworks are more forgiving and open to accepting any pattern, so we can worry less about framework restrictions and focus more on making the most accessible pattern choice we can make.

Besides all that we have discussed so far, there are many additional considerations to weigh when choosing a pattern, like performance, security, search engine optimization, language translation, third-party integration, and more. These factors will undoubtedly play into your accessible pattern choice, but you should also be thinking about the people creating the content. The accessible pattern you choose must be built in a robust enough way to handle any potential limitations around editor-generated and/or user-generated content.

Evaluating Patterns For Accessibility

Code often speaks louder than words, but before we jump into all of that, a quick note that the following pattern examples are not the only patterns available for each situation, nor is the one deemed “best” in the group the best option in the entire world of accessible patterns.

For the pattern demos below, we should imagine a hypothetical situation in which we are comparing each group of patterns against themselves. While this is not a realistic situation, running through these critical thinking exercises and evaluating the patterns for accessibility should help you be more prepared when you encounter pattern choice in the real world.

Accessible Button Patterns

The first group of patterns we will review for accessibility are ubiquitous to almost every website or app: buttons. The first button pattern uses the ARIA button role to mimic a button, while the second and third button patterns use the HTML <button> element. The third pattern also adds aria-describedby and CSS to hide things visually.

See the Pen Accessible Button Patterns by Carie Fisher.

Good: role="button"
<a role="button" href="[link]">Sign up</a>
Better: <button>
<button type="button">Sign up</button>
Best: <button> + visually hidden + aria-describedby
<button type="button" aria-describedby="button-example">Sign up</button>
<span id="button-example" class="visually-hidden"> for our monthly newsletter</span>

While the first patterns seem simple at first glance, they do evoke some accessibility questions. For example, on the first button pattern, we see ARIA role="button" is used on the “good” pattern instead of an HTML <button> element. Thinking in terms of accessibility, since we know the HTML <button> element was introduced in HTML4, we can reasonably speculate that it is fully supported by the latest versions of all the major browsers and will play nicely with most AT devices. But if we dig deeper and look at the accessibility support for ARIA role="button" we see a slight advantage from an assistive technology perspective, while the HTML <button> element is missing some areas of browser + AT coverage, especially when we consider voice control support.

So then why isn’t the ARIA pattern in the “better” category? Doesn’t ARIA make it more accessible? Nope. In fact, in cases like this, accessibility professionals often recite the first rule of ARIA — don’t use ARIA. This is a tongue-in-cheek way of saying use HTML elements whenever possible. ARIA is indeed powerful, but in the wrong hands, it can do more harm than good. In fact, the WebAIM Million report states that “pages with ARIA present averaged 60% more errors than those without.” As such, you must know what you are doing when using ARIA.

Another strike against using ARIA in this situation is that the button functionality we need would need to be built for the role="button" pattern, while that functionality is already pre-baked into the <button> element. Considering the <button> element also has 100% browser support and is an easy pattern to implement, it edges slightly ahead in the hierarchy when evaluating the first two patterns. Hopefully, this comparison helps bust the myth that adding ARIA makes a pattern more accessible — oftentimes the opposite is true.

The third button pattern shows the HTML <button> element coupled with aria-describedby linked to an ID element that is visually hidden with CSS. While this pattern is slightly more complex, it adds a lot in terms of context by creating a relationship between the button and the purpose. When in doubt, anytime we can add more context to the situation, the better, so we can assume if coded correctly, it is the best pattern when comparing only these specific button patterns.

Accessible Contextual Link Patterns

The second group of patterns we will review are contextual links. These patterns help give more information to AT users than what is visible on the screen. The first link pattern utilizes CSS to visually hide the additional contextual information. While the second and third link patterns add ARIA attributes into the mix: aria-labelledby and aria-label, respectively.

See the Pen Accessible Link Patterns by Carie Fisher.

Good: visually-hidden
<p>“My mother always used to say: The older you get, the better you get, unless you’re a banana.” — Rose (Betty White)<a href="[link]">Read More<span class="visually-hidden"> Golden Girl quotes</span></a></p>
Better: visually-hidden + aria-labelledby
<p>“I'm either going to get ice cream or commit a felony...I'll decide in the car.” — Blanche (Rue McClanahan)<a href="[link]" aria-labelledby="quote">Read More</a><span class="visually-hidden" id="quote">Read more Golden Girl quotes</span></p>
Best: aria-label
<p>“People waste their time pondering whether a glass is half empty or half full. Me, I just drink whatever’s in the glass.” — Sophia (Estelle Getty)<a href="[link]" aria-label="Read more Golden Girls quotes">Read More</a></p>

While all three of the contextual link patterns look the same, when we inspect the code or test them with AT devices, there are some obvious differences. The first pattern uses a CSS technique to hide the content visually for sighted users but still renders the hidden content to non-sighted AT users. And while this technique should work in most cases, there is no real relationship formed between the link and the additional information, so the connection is tentative at best. As such, the first link pattern is an OK choice but not the most robust link pattern of the three.

The next two link patterns are a bit more tricky to evaluate. According to the ARIA specs from the W3C “The purpose of aria-label is the same as that of aria-labelledby. It provides the user with a recognizable name of the object.” So, in theory, both attributes should have the same basic functionality.

However, the specs also point out that user agents give precedence to aria-labelledby over aria-label when deciding which accessible name to convey to the user. Research has also shown issues around automatic translation and aria-label attributes. So that means we should use aria-labelledby, right?

Well, not so fast. The same ARIA specs go on to say “If the interface is such that it is not possible to have a visible label on the screen (or if a visible label is not the desired user experience), authors should use aria-label and should not use aria-labelledby.” Talk about confusing — so which pattern should we choose?

If we had large-scale translation needs, we might decide to change the visual aspect and write out the links with the full context displayed (e.g. “Read more about this awesome thing”) or decide to use aria-labelledby. However, let’s assume we did not have large-scale translation needs or could address those needs in a reasonable/accessible way, and we didn’t want to change the visual — what then?

Based on the current ARIA 1.1 recommendations (with the promise of translation of aria-label in ARIA 1.2) plus the fact that aria-label is a bit easier for devs to implement versus aria-labelledby, we could decide to weight aria-label over aria-labelledby in our pattern evaluation. This is a clear example of when context weighs heavily in our accessible pattern choice.

Accessible <svg> Patterns

Last, but certainly not least, let’s investigate a group of SVG image patterns for accessibility. SVGs are a visual representation of code, but code nonetheless. This means an AT device might skip over a non-decorative SVG image unless the role="img" is added to the pattern.

Assuming the following SVG patterns are informational in nature, a role="img" has been included in each. The first SVG pattern uses the <title> and <text> in conjunction with CSS to visually hide content from sighted users. The next two SVG patterns involve the <title> and <desc> elements, but with an aria-labelledby attribute added to the last pattern.

See the Pen Accessible SVG Patterns by Carie Fisher.

Good: role="img" + <title> + <text>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" role="img" x="0px" y="0px" viewBox="0 0 511.997 511.997" style="enable-background:new 0 0 511.997 511.997;" xml:space="preserve">
    <title>The first little pig built a house out of straw.</title>
    <text class="visually-hidden">Sadly, he was eaten by the wolf.</text>...
</svg>
Better: role="img" + <title> + <desc>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" role="img" x="0px" y="0px" viewBox="0 0 511.997 511.997" style="enable-background:new 0 0 511.997 511.997;" xml:space="preserve">
    <title>The second little pig built a house out of sticks.</title>
    <desc>Sadly, he too was eaten by the big, bad wolf.</desc>...
</svg>
Best: role="img" + <title> + <desc> + aria-labelledby="[id]"
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" role="img" aria-labelledby="pig3house pig3wolf" x="0px" y="0px" viewBox="0 0 511.997 511.997" style="enable-background:new 0 0 511.997 511.997;" xml:space="preserve">
    <title id="pig3house">The third little pig built a house out of bricks.</title>
    <desc id="pig3wolf">Thankfully he wasn't eaten by the wolf.</desc>...
</svg>

Let’s first look at the first pattern using <title> and <text> and visually hidden CSS. Unlike previous visibly hidden text in patterns, there _is_ an inherent relationship between the <title> and <text> elements since they are grouped under the same SVG element umbrella. However, this relationship is not very strong. In fact, if you look back at my research on SVG patterns, we see that only 3 out of 8 browser/AT combinations heard the complete message. (Note: Pig pattern #1 is equivalent to light bulb pattern #7.)

This is true though the working W3C SVG specs define the <text> element as “a graphics element consisting of text…the characters to be drawn are expressed as character data. As a result, text data in SVG content is readily accessible to the visually impaired.” This first pattern is OK, but we can do better.

The second pattern removes the <text> element and replaces it with a <desc> element. The W3C SVG specs state:

“The <title> child element represents a short text alternative for the element... and the <desc> element represents more detailed textual information for the element such as a description.”

Meaning the <title> and <desc> elements in SVGs can be used similarly to image alternative text and long description options found traditionally in <img> elements. After adding the <desc> element to the second SVG, we see similar browser/AT support with 3 out of 8 combinations hearing the complete message. (Note: Pig pattern #2 is equivalent to light bulb pattern #10.) While these test results seem to mirror the first pattern, the reason this pattern gets a bump into the “better” category is it is slightly easier to implement code-wise and it impacts more AT users, as it worked on JAWS, VoiceOver desktop, and VoiceOver mobile, while the first pattern supported less popular browser/AT combinations.

The third pattern again uses the <title> and <desc> elements but now has an aria-labelledby plus ID added into the mix. According to the same SVG tests, adding this additional piece of code means we can fully support 7 out of 8 browser/AT combinations. (Note: Pig pattern #3 is equivalent to light bulb pattern #11.) Out of the three SVG patterns, this third one is the “best” since it supports the most AT devices. But this pattern does have a draw-back in using some browser/AT combinations; you will hear duplicate image title/description content for this pattern. While potentially annoying to users, I’d argue it is generally better to hear duplicated content than none at all.

Closing Thoughts

While we all certainly value choice in tech, I wonder if we’ve come to a point in time where the overabundance of options has left us paralyzed and confused about what to do next? In terms of picking accessible patterns, we can ask straight-forward questions around pattern/library options, browser/AT device support, framework limitations, and more.

With the right data in hand, these questions are easy enough to answer. However, it becomes a bit more complicated when we go beyond patterns and really consider the people using them. It is then that we realize the impact our choices have on our users’ ability to succeed. As Prof. George Dei eloquently states:

“Inclusion is not bringing people into what already exists — it is making a new space, a better space for everyone.”

By taking a bit more time to critically think about patterns and choose the most accessible ones, we will undoubtedly create a more inclusive space to reach more users — on their terms.

Related Resources

Tools
Pattern Libraries

Why Java Is so Young After 25 Years: An Architect’s Point of View

Java completes 25 years of programming life and remains closer to developer's minds; almost 69% of the worldwide developer community remains to code in Java, even now. Oracle recently released Java 15 with tonnes of features like Sealed Classes, Hidden Classes, Edward-Curve Digital Signature Algorithm (EdDSA), Text Blocks to name a few. This makes Java 15 to be 25 years young and not 25 years old programming language.

History and Evolution of Java

When there were dozens of programming language which were very stable in the early 1990s like FORTRAN, COBOL, Pascal, C++, and Visual Basic, many platforms like Windows, Mac, Unix, Linux, and Mobile platforms demanded a unified approach in program development and architecture design. James Gosling and his friends discussed these aspects under an Oak tree near James' office where they felt a new programming language to be developed to address these gaps. They were very particular on foundational aspects in developing a new language called Oak, which was then named as Green (as the team is named as Green team) and later Java (based on their favorite coffee from Indonesia called Java Coffee).

12 Effective Time Management Strategies to Get More Stuff Done

One of the trickiest things in life is to assume you have time. How often do you tell yourself “This shouldn’t take long” and then wonder why you only managed to finish half of what you had planned for the day? We are very good at getting busy but time doesn’t wait for us. It just passes, no matter if we manage to squeeze in some productivity or not. The best way to stay on top of things is to start employing efficient time management strategies!

How to Add Content Upgrades in WordPress and Grow Your Email List

Do you want to add content upgrades in WordPress to help grow your email list?

Content upgrades are specific bonus content that your readers can get by signing up for your email list.

In this article, we’ll show you how to add content upgrades in WordPress and grow your email list.

How to add content upgrades in WordPress and grow your email list

What is a Content Upgrade?

Content upgrades are where you offer your readers exclusive bonus content for signing up to your email list. This additional premium content offered for completing an action is also known as a content bribe.

What are some content upgrade ideas?

  • eBooks
  • Checklists
  • Excel Worksheets
  • Downloadable PDF version of your blog post
  • Exclusive video interview related to the post
  • Bonus how-to’s for the article

Basically content upgrades have to be highly relevant to the post you’re offering it on.

For example, on a post about content upgrades, we should offer a content upgrade checklist because readers of this post will find that highly useful.

Human psychology plays an important role in the effectiveness of content upgrades.

The psychology principle known as Zeigarnik Effect states that people are most likely to complete a task if they initiate it themselves.

For content upgrades, it works because users initiate it by clicking on a link or an image. This makes them more likely to complete the task by finishing the sign up.

Sounds too good to be true, right?

See these stats from Syed’s website comparing a regular popup and a MonsterLinks™ content upgrade.

Comparison of regular popup and a MonsterLink content upgrade

The generic popup was running across the site and was seen by nearly 26,000 users, out of which 744 signed up.

On the other hand, the targeted MonsterLink™ was placed on a single page. It was viewed by 270 people and 74 users signed up. That’s an insane conversion all from a single page without running any split-tests!

Now that you know what a content upgrade is, let’s see how you can use it on your own website to get more email subscribers.

How to Add Content Upgrades in WordPress?

The easiest way to add content upgrades to WordPress is using OptinMonster. It’s one of the best WordPress lead generation plugins in the market used by over 1.2 million sites.

OptinMonster

It allows you to add beautiful opt in forms like lightbox popups, scroll-triggered slide-in forms, floating bars, sidebar optins, below the content forms, and more.

It is super fast and works beautifully with WordPress powered websites.

Note: Our founder Syed started OptinMonster to use on WPBeginner, and we increased our email subscribers by 600%.

Adding content upgrades is a breeze with the MonsterLinks™ feature in OptinMonster.

If you don’t have an email list, then check out our guide on why you should start building your email list right away.

Step 1: Setting up OptinMonster

First you will need to install and activate the OptinMonster plugin on your WordPress site.

This plugin acts as a connector between your WordPress website and OptinMonster.

Upon activation, click on OptinMonster menu item in your WordPress admin bar.

OptinMonster setup page

Now you’ll need to connect your site to OptinMonster by clicking ‘Launch the Setup Wizard’.

Next, you’ll be prompted to connect to an existing account, or claim your free account.

OptinMonster setup wizard

Once you’ve finished going through the setup wizard your WordPress site will be connected to OptinMonster.

You can navigate to OptinMonster » Settings to double check that you’re connected.

OptinMonster account connected

Step 2: Create a New Popup Optin

Once you are successfully connected, navigate to OptinMonster » Campaigns.

Then click the ‘Add New’ button to create a new campaign.

Add new OptinMonster campaign

After that, you’ll need to select the Campaign Type, in this case it’s ‘Popup’.

Then, you can choose a popup template.

Choose type of OptinMonster campaign

Just hover over the template you like and click ‘Use Template’.

This will be the foundation for your popup design.

Choose OptinMonster template

Once you’ve done that enter your campaign name in the ‘Create Campaign’ popup and click ‘Start Building’.

The name of your campaign is to help you remember, it won’t appear in your design.

Name your OptinMonster campaign

This will open up the OptinMonster app where you can totally customize the appearance of your popup.

You can change virtually every part of your design including your background and font colors, text, subscribe button, and more.

Customize OptinMonster popup

After you’re happy with your design click on the ‘Display Rules’ tab.

This is where we’ll set your content upgrade display options.

OptinMonster display rules

First, we’ll set the conditions for when the popup will appear. To do this click type ‘MonsterLink’ into the ‘Search Display Rules’ search bar.

Then, click on ‘MonsterLink™ (On Click)’ to add the rule. After that, click ‘Next Step’.

Add MonsterLink next step

You can leave the default options on the next screen. But, feel free to add an animation effect or sound effect to the popup. Once you’re finished click ‘Next Step’.

On the ‘Summary’ page you’ll need to click the ‘Copy MonsterLink™ Code’.

Copy MonsterLink code

Now you need to open a plain text editor like Notepad and paste the code you copied. You will need this code later.

After that navigate to the ‘Publish’ tab and switch the ‘Publish Status’ from Draft to Publish. Then, you can click ‘Save’ and exit the screen.

Publish OptinMonster popup

Step 3: Enable MonsterLink™ Optin on Your Site

Once you exit the form builder screen, it’ll take you to the ‘WordPress Output Settings’ screen.

Here you can set which pages and posts you want MonsterLink™ to work on. You can leave the default settings. But, make sure the status is changed to Published under the ‘Visibility & Status’ box.

Make OptinMonster form visible

If you do make any changes, make sure you click ‘Save Changes’

Step 4: Add Your Monster Link in a WordPress Post or Page

Adding your MonsterLink™ in WordPress is very simple.

Simply edit the post or page where you want to display MonsterLink.

On the post edit screen, switch to the text editor and paste the MonsterLink™ code you copied earlier.

It will look like this:

<a href="https://app.monstercampaigns.com/c/your-code/" target="_blank" rel="noopener noreferrer">Subscribe Now!</a>

This code will show plain link to the users however it won’t really stand out.

So how do you make it stand out? You can add a box around it like this:

<p style="background: none repeat scroll 0 0 #fffecf; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #e5e597; padding: 13px;">

<strong>Exclusive Bonus:</strong> <a href="https://app.monstercampaigns.com/c/your-code/“ target="_blank" rel="noopener noreferrer">Download The Blog Post Checklist</a> to use before you hit publish.

</p>

Content upgrade popup example

You can also create a shortcode to make the box styling easy in the future.

Simply add this code in your theme’s functions.php file, in a site-specific plugin, or by using the code snippets plugin:

function wpb_make_yellowbox($atts, $content = null) {
   return '<p style="background: none repeat scroll 0 0 #fffecf; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #e5e597; padding: 13px;">' . do_shortcode($content) . '</p>';
}
add_shortcode('yellowbox', 'wpb_make_yellowbox');

You can now add your content upgrade link in your WordPress posts using the shortcode like this:

[yellowbox]

<strong>Exclusive Bonus:</strong> <a href="https://app.monstercampaigns.com/c/your-code/“ target="_blank" rel="noopener noreferrer">Download The Blog Post Checklist</a> to use before you hit publish.

[/yellowbox]

You can also show the link with an image. This way you can make it much more prominent and attractive.

Here is how you can add the image with MonsterLink™ in WordPress.

<a href="https://app.monstercampaigns.com/c/your-code/“ target="_blank" rel="noopener noreferrer"><img src="http://example.com/wp-content/uploads/2021/03/ebookdownload.png" alt="ebook download" /></a>

MonsterLink around an image will make it look more prominent

Step 5: Delivering the Content Upgrade in WordPress

Now we need to take a look at how to deliver the content upgrade that we promised to the user.

Your content upgrade could be anything. You can use PDF, video, audio, or any other kind of content.

Once users enter their email address, you can provide them the promised content upgrade. There are multiple ways to do this:

Show Download Link as Success Message

You can show a download link as a success message inside your popup.

Edit your optin in the OptinMonster form builder and click on the ‘Success’ tab.

Then, edit your success message text and include a URL to your downloadable content upgrade.

OptinMonster success message

Redirect to Thank You or Download Page

You can also redirect users to a thank you page that has the link to download the file. To do this you’ll need to be the ‘Success’ tab.

Next, we’ll add a button that says ‘Download Now’.

After that click ‘Action’ and select ‘Redirect to a URL’ from the drop-down list.

Then, enter the URL in the ‘Redirect URL’ box.

OptinMonster success redirect

Make sure you click ‘Save’ to save any changes you’ve made so far.

Send as an Email

Most email marketing software providers offer autoresponder features where you can send welcome emails to new users. You can use it to send the download link to the user.

You will have to check your email service provider’s documentation section for instructions on how to do this. OptinMonster offers a wide range of integrations with the most popular email marketing tools.

Conclusion

Content upgrades aren’t as popular as they once were. But, they’re still an extremely effective way to generate leads and grow your email list.

Brian Dean from Backlinko, Bryan Harris from Videofruit, Neil Patel from QuickSprout, Pat Flynn from SPI, and of course our own Syed Balkhi have seen phenomenal results from using content upgrades.

If you’re serious about growing your email list, then you should definitely try out content upgrades. It will take you anywhere from 30 minutes to 1.5 hours to build and add a content upgrade to your post, but it’s totally worth it.

We hope this article helped you add content upgrades in WordPress to grow your email list. You may also want to take a look at our guide on how to build an email list in WordPress and our list of 17 ways to grow your email list faster.

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 Content Upgrades in WordPress and Grow Your Email List appeared first on WPBeginner.

7 Creative Ways to Use Geometry in Web Design

Everyone had one of those subjects in school where they thought, “Why am I studying this? I’m never going to use it again.” 

Geometry, with its measuring of diameters and angles, might not have seemed very useful or exciting at the time. However, there’s actually a lot you can do with geometry on a website that will make your content easier to find as well as more engaging.

Today, we’re going to look at some creative ways to use geometry in web design. We’ll give you some examples of BeTheme pre-built sites and live websites that demonstrate how to do this.

1. Slice your sections on a diagonal so visitors naturally “fall” downwards

Many websites today are built with rectangular blocks, one on top of the other. However, by cutting key sections of your site at a diagonal as opposed to the expected horizontal line, visitors may feel a stronger inclination to keep moving downwards on a page. 

Part of this is due to the downward slope, though the “peekaboo” tease of what comes next certainly helps, too. 

Stripe is one such example of a website that uses this diagonal divider in its design: 

The dividing line allows visitors to get a sneak peek of what’s to come in the next section, building anticipation as they scroll further and further.

This is something you can easily build with BeData, one of BeTheme’s pre-built sites: 

There are a number of instances on this site where the dividing line between two sections sits at a 45-degree angle like in the example above. And it’s a great example of how to take a unique approach to the diagonal divider.

2. Use shapes that simplify decision-making

It’s not uncommon for consumers to feel decision fatigue when presented with yet another choice to make online. While it’s great to have so many options available, it can be quite exhausting always having to research and compare products or services. 

When you build a website that sells something, why not take some of that pressure off of your visitors? 

You can use recognizable geometric shapes to point prospective buyers to: 

  • Plans that offer the greatest value
  • Products that are the most popular with other shoppers
  • Options that have a special properties (like eco-friendliness)

Sephora, for instance, uses a number of circular seals to draw visitors’ attention to certain items:

The green circles indicate that they’re clean products while the ones in red are award winners. 

Your shapes don’t even need to contain text the way Sephora’s do. You can go the route of BeComputerShop, for instance, and use stars to point out where the top sellers are: 

The shape you use and how you design it all depends on what the site sells and what shoppers most commonly look for when choosing one option over the others.

3. Use shapes that open up a window to your brand

Consumers want transparency from brands today. While the words on your site help with this, the images you show can also help. 

Rather than go the usual route of adding images on top of your website’s background, why not design them to look like you’ve created a porthole or window into the brand’s world? 

You can use geometric shapes to carve out these “windows” and let your visitors see something or someone that will help them better connect to the brand on a personal level. 

Web3 shows us one way of handling this: 

Part of the homepage has been carved out to make room for this polygon. Within it, is a short video of the agency at work. 

BeInternet gives us another way to approach this technique: 

The circular hole contains an image as opposed to a video, but it has a similar effect as the Web3 example. Another difference is that this image doesn’t have a filter laid over it, which creates a more open and transparent feel to what the visitors are seeing.

4. Use images containing geometric figures to direct people’s attention

You can do more than just pair geometric figures with your text and imagery. You can select images that contain their own geometric figures and lines. 

Visitors might not overtly notice the geometry and that’s okay. Things like long vertical lines and arrows will subconsciously direct their attention on the page. 

Here’s an example from the Hyatt Place Hotel in Delaware: 

The alignment of the photo was definitely intentional. If we use the F-pattern that users’ eyes typically follow, they’ll start at the left side of the screen, stop to read the text in the middle, and then glance over to the right where the boardwalk then leads them downwards. 

BeFarm is a pre-built site that does something similar: 

The rows within the image will draw people’s eyes into the explainer products below. 

5. Make your content feel more alive by using different planes

When designing websites for activities and experiences, a flat design probably won’t properly convey what you’re selling. 

By placing key objects on different planes and giving the design a 3-dimensional feel, the site — and the experience it sells — will feel more exciting and adventurous, which, in turn, will increase engagement. 

Just be careful about overdoing it with this technique. It’s best to focus on one element instead of trying to make the whole banner or site 3D. For example, this is Ryan’s Island Cafe:

This wooden signpost is an item that’s commonly found on beaches, so it was a good choice to make it stand out as it helps recreate that beachy atmosphere online. 

BeFunFair offers another way to approach this: 

In this case, it’s the letters “JOY” that help visitors see the three-dimensional plane. The illustration of the fair rides behind, in front of, and going through it creatively demonstrate this.

6. Direct visitors with lines and arrows created from shapes

One way to implore visitors to keep moving down a page is to use lines and arrows. We’ve already seen how something like a diagonal divider can do this. 

But simply drawing lines and arrows seems a little too easy, doesn’t it? If you want to mix it up a little bit, consider combining geometric figures to form directional lines and arrowheads. 

HURU’s product pages, for instance, are full of these types of graphics: 

In this example, a bunch of triangles come together to form an arrowhead that points to one of the backpack’s main features. 

You might also follow BePhotography’s lead and use a series of circles or plus-signs to form lines: 

These directional cues effortlessly take visitors from one piece of content to another.

7. Use the psychology of shapes to inspire action

This last one has less to do about using a shape as a directional cue and more about using the psychology of a shape to convince a visitor to take action. 

For instance, here’s what the most common geometric figures mean: 

  • Square – Traditionalism and balance
  • Circle – Harmony, infinity, and protection
  • Triangle – Stability and energy
  • Rhombus – Contemporariness and excitement
  • Hexagon – Unity and strength

Choose the right shape and meaning and you can more easily persuade people to take the next forward step on your site.

Built by Buffalo, for instance, introduces people to its website with this beautiful array of hexagons:

This sends the message to people that this is a trustworthy design agency that can build a strong website on their behalf. 

BePrint, on the other hand, uses a Venn diagram-like set of circles behind various pieces of content on its homepage: 

It’s a subtle design, but it’s a good choice. For one, the design is part of the logo, so it helps reinforce branding. But there’s also the psychological undertones of harmony that it sends to people interested in high-quality, professional printing services. 

What creative ways will you use geometry in web design?

Geometry in web design is about more than placing colorful shapes on top of white space. If you consider the purpose of these figures, lines, and planes when designing with them, your site can play a more active role in driving visitors to the point of conversion.
As you’ve seen here today, many of BeTheme’s pre-built sites have many of these creative uses integrated into their designs. So, if you’re interested in taking advantage of this trend, this theme is a good place to start.

The post 7 Creative Ways to Use Geometry in Web Design appeared first on Codrops.