Adding a Custom Class to Your WordPress Page

You pick a WordPress theme because you want most of the design to be taken care of for you. However, you may have something that you want to be an exception to your design within a particular page. The solution to your problem is adding a custom class to your WordPress page.

Why Add a Custom Class to Your WordPress Page?

You can make small modifications to your site’s CSS when you add your own custom classes. WordPress offers a lot of controls in its user interface that allow you to make changes to specific blocks, and theme developers will often add custom styling to enhance those options. But it is inevitable that you will eventually want something that is not provided for you by the user interface options.

Assumptions

This tutorial assumes that you already know how to set up a WordPress site, and install a WordPress theme, and you are familiar with the block editor.

Understanding Basic CSS

Nobody knows everything that there is to know about CSS. There are entire websites and books that are devoted to teaching people the subject. Fortunately, you don’t need to learn most of what there is to know about CSS to use it. You don’t need a computer science degree, and you don’t need to be a full on hardcore developer.

How to Determine Existing CSS

If you want to update existing CSS, then you first need to learn how to use your browser’s developer tools. If you want to follow along with what I am doing you can open up a copy of the Big Lights theme, then add some block patterns. Once you have added something with images, you can open up a preview page or a published page, then right click on one of the images and select inspect. It should produce a screen that looks something like this:

Screenshot of the developer tools.

Highlight the img tag the same way as it is shown in the image above, then click on the checkmark next to the attribute that reads “box-shadow.” Do you see how the lights surrounding the images disappear? You can use this technique to see how different attributes are assigned to different classes. So you can add your own classes and write your own updates.

Adding a Custom Class

Next go into the block editor and add a new image, then add a new class name by selecting a block, then open up the settings panel, then select the block tab, then go into advanced and add a new class name:

Adding a new class name in the block editor

Finally, you want to go into the customizer and add your custom CSS to make your update:

.bb-no-highlight-image img {
	box-shadow: none;
}
Lights out for the chicken sandwich

You can now add this same class to other images if you want them to share the update.

It’s okay if you don’t know what the exact syntax is to make the update. It isn’t something that most people try to memorize. If you need to look something up, you can find pretty much everything that you might need need at W3 Schools.

Less is More

You should use the tools provided to you by WordPress and your theme developer. Get familiar with all the existing controls before you start adding custom classes. Some people will use this new found knowledge to try to completely overhaul their site. If you are reading this tutorial, then it is expected that you are not an experienced web developer, so I would discourage you from trying this. I’ve seen a few people try it, and they always end up ruining their site. However, it’s pretty safe to do this for single blocks because the area that you are updating is small, and you can always remove the CSS if you don’t like it.

Questions?

If you have any questions, then feel free to leave them in the comments section.

Convert Your Images to WebP

The WebP image file type is a way for you to set higher quality images onto your website. WebP images look better at smaller file sizes than other image file types. This means that your images will look better and load faster when you convert them to WebP. WebP was actually invented by Google over a decade ago. But it took quite a while for it to catch on because it needed time for browsers to become WebP compatible.

How Important is it to Convert Your Images to WebP?

If you have already been doing a good job of setting web friendly images, and your site contains a lot of images, then I wouldn’t go through every image and convert each one to WebP. However, you should consider converting all of your new images to WebP. However, if your site is running slow, and you have already done a good job of caching your site, then you may find that reducing the dimensions of your images and converting them to WebP may improve your loading times.

WebP and WordPress Compatibility

This tutorial will reference WordPress, however it will show you how to convert your images to WebP without using WordPress tools.

WebP has been compatible with WordPress since version 5.8. So if you don’t have WordPress 5.8 or higher then you will need to update if you want to use WebP images.

In addition to WordPress version compatibility, you should also consider WordPress theme compatibility. Some themes do a better job of managing image sizes than others. You want to pick a theme like one of the latest Big Themes that sets clear limits on how big an image can be. That way you can set your image to a maximum size that you know won’t get so large that it becomes distorted.

Update Your Images to WebP with GIMP

GIMP is free software that you can use to amplify compression and convert file types.

GIMP is a full service image editor that has capabilities that extend well beyond what you will probably need for WordPress. But if you are just using GIMP to compress your images, then it isn’t that difficult to use. Just follow these instructions:

  1. Download GIMP if you haven’t already.
  2. In Gimp, go to File > Open, then choose the file you want to open.
  3. Go to Image > Scale Image. A good rule of thumb is if you are using one of the Big Themes, then set the width of your images to one of the following sizes:
    • 900 for images half the body or smaller.
    • 1200 if you are using a standard page width and you have an image that traverses the entire body width.
    • 1800 for full body width when using Big Pages.
    • 2560 if you are using a background image, a header image, or a featured image.
Using image scaling to convert your images to WebP
Screenshot of image scaling
  1. Once you have set your image width, go to File > Export As.
  2. Replace the current image file extension (probably .jpg or .png) with .webp. You may also want to rename the file so that it includes a reference to the width.
  3. Click export, then lower the image quality to 50 percent. You can experiment with even lower image quality if you think the image’s appearance won’t suffer too much.
  4. Click Export.
convert your images to WebP
Screenshot of exporting to WebP

That’s it. If you have any questions, then feel free to post them to the comments section.

Building a WordPress Site with Block Patterns

Using block patterns with the right theme can make building a website a lot easier, but using block patterns with the wrong theme can make building a website a lot harder.

What’s a Block Pattern?

If you’re reading this, then you probably already know what a WordPress block is. It’s a piece of content, like a paragraph or an image. A block pattern is just a preformed arrangement of those different pieces of content into a section.

The Advantage of Using Block Patterns

You can build a site a lot faster with block patterns, and it often looks a lot better than something you may have tried to build from scratch. You can build patterns on your own using blocks, and this may be a good idea if you have something specific in mind. But if you have a lot of content, then it is often more effective to just set your content into block patterns.

Pick the Right Theme for Block Patterns

There are a lot of themes out there, and it may be difficult to discern which ones do a good job of supporting block patterns. Don’t assume that every theme does a good job with this. If you pick the wrong theme, then you may find yourself spending as much time updating the pattern as you would if you had built the pattern yourself from scratch.

I recommend using the latest Big Theme. For example, you can download Big Chill by going into to your WordPress admin center, then select Appearance > Themes > Add New, then type “Big Chill” into the search box.

Set Your Header, Footer, Background, and Colors

It’s a good idea to set up your header and footer before you set up your page body because you’re going to see your header and footer on every page, so it will impact how the body of your page looks.

Once you have turned on your theme, you will probably find that it is most efficient to open up three tabs on your browser. First, open a tab for your admin center. Second, open a tab for the page that you want to work on. Third, open a tab for your customizer. Right now, you are going to work in your customizer tab.

It may be difficult to decide exactly how you want your site to look. It’s fine if you just want to stick with the default setup for now. But there are four key areas that you should look at and consider for experimentation:

  1. Background Image: If you have an image that you think would make a good background image, then this can serve as a great foundation for the look of your site.
  2. Colors: There a bunch of color options. Don’t be afraid to change the colors to something more consistent with your message. The colors you pick will influence how your block patterns colors are chosen.
  3. Header: Think about how big your navbar will be. You can try reducing the navbar size by turning off the center control in the navigation section. If you turn off the center control, then I recommend experimenting with menu sizes. If you change the navbar size or add a background image, then you may want to experiment with how far you want to set the body from the top of the page. You can do this in the layout section (see image below).
  4. Footer: It’s okay if you wait until later to fill out the footer. For now, just be aware that’s it’s there, so you can see how it looks juxtaposed with the body.
customizer screenshot

Building a Page Body

This is where the efficiency of block patterns comes into play. To add block patterns go to the block editor in your new page tab. You can set a new block pattern by setting a paragraph block in the block editor in the location where you want to add the pattern. Don’t add any text. It should read “Type / to choose a block”. Next, hit the “+” button in the upper left hand corner, then select the patterns tab.

block editor screenshot

I recommend just trying a bunch of random patterns, then throw your content in to see how it looks. Consider using spacer blocks to add space between patterns.

Consider a More Advanced Footer

Some footers need to hold more content than others. You can build a three column footer pattern in the block editor than paste it into the customizer. The easiest way is to open up a block editor page in one tab and a customizer page in another tab. You can create the block pattern in the block editor, then copy the pattern from the block editor (make sure you select the entire pattern), then add a new block area to the footer in the customizer by selecting a new paragraph block in the same manner discussed earlier.

Then paste the pattern into the new area. It is usually easiest to build the block pattern in a block editor draft page while keeping a customizer tab open and pasting and deleting the entire pattern until it looks the way you want it to. Keep in mind that the styling is distinct in the footer as compared to the body. So you probably want to avoid testing your footer in the body on the preview page.

Any Questions about Block Patterns?

If you have any questions about what you have just learned, then please post them in the comments section.

Adding a Section Block to Your WordPress Page

Adding a section block to your WordPress page is a great way to make content stand out. It can also break up the monotony of a page and make the page easier to read. Section blocks look best on pages with wide screens (as opposed to blog pages with sidebars like the page that you’re reading right now).

Pick the Right Theme

You should pick a theme that provides options to create a layout that is good for expressing a section block. Some themes give you very little control over blocks. Other themes give so much control over blocks that the process of building them becomes confusing and tedious

The Big Media theme tries to strike a balance in block control. The Big Media theme is a free theme and you can download it directly from your WordPress admin center by selecting Appearance > Themes > Add New. Then type “Big Media” into the search box.

This is Just a Demo

This blog post will provide a demonstration of how to add a new section to a website designed to promote an arcade, but you can use the techniques that you learn and apply it to all kinds of content. All you will need to create this section are images and text. If you don’t have any images, then I recommend the following resources:

This a demo of a section block for a website used to promote an arcade. It is set near the bottom of the page. When you are done reading this blog, you will know how to build a section just like it.

Adding a Section Block to Your WordPress Page

This section demo contains a typing feature. You can click on the image to see the page in action.

Picking a Color Scheme Before Adding a Section Block to Your WordPress Page

One of the simplest and most effective ways to make your new section stand out is to update the colors of the background and fonts. I recently wrote an article on how to build foundational colors and fonts for your website. This tutorial will extend upon that lesson by teaching you how to update the inner parts of the page.

When you are deciding what colors to choose, it is often a good idea to pick colors that you are already using and set them as inverse values. For example, if you are currently using yellow for your links and black for your foreground color, you can make the background color of your new section yellow and the text color of your new section black.

Determining Layout and Content Before Adding a Section Block to Your WordPress Page

Before you actually build your new section, you should consider how the layout and font will look. You can do this by looking at the example images above. I could write a whole article on how to set different section layouts, but for now, it’s probably a good idea to use something like the above sample because it is a good way to condense content that could serve a variety of different purposes.

Resizing Images

You can try to rely on WordPress to resize your images for you, but if you are using multiple images, it is usually a good idea to use image compression software.

GIMP is free software that you can use to amplify compression and convert file types.

GIMP is a beast and is not the most user friendly. It is a full service image editor that has capabilities that extend well beyond what you will probably need for WordPress. However, if you are just using it to compress your images, then it isn’t that difficult to use. Just follow these instructions:

  1. In Gimp, go to File > Open, then choose the file you want to open. Gimp can be slow.
  2. Go to Image > Scale Image. Then reduce the width to 900 for images inside media and text blocks and 600 for images inside columns.
  3. Go to File > Export As
  4. If the file type reads .png then delete the .png and replace it with .jpg. You may also want to rename the file.
  5. Click export, then lower the image quality to 50 percent or whatever value you think is best. You can check the box that reads “Show preview in image window”, and it will tell you what the file size will be.
  6. Click Export.

Creating a Group Block Foundation

You will use the block editor. You should start by adding a group block, then set the background color to the color that you want.

A group block with a yellow background with a media and text block at the top.

Adding Inner Blocks

Next add more blocks inside the group block. The top block in the example group block is a media and text block. With each section of text that you add, you will want to select the new text color.

The best way to make sure that your text color comes out right is to update each block of text.

Adding More Group Blocks

Adding inner group blocks makes it easier to update inner sections in the future. Next, add another group block below the media and text block.

Adding More Inner Blocks

Finally, since you are using the Big Media you can add ten blocks at once. Type “bb” into the block search then select “Information Columns Triple”.

Without the Big Media theme, you will have to manually set a three column block then add three blocks inside each block.

Finally, add the Information Columns into the inner group block.

That’s it. You’re done.

Do You Have Questions About Adding a Section Block to Your WordPress Page?

If you have any questions, then feel free to post them in the comments below.

Adding Sticky Sidebars to Your WordPress Site

Adding sticky sidebars to your WordPress site is an outstanding way to improve your website’s navigation. Big websites can become confusing to search through. But when you combine a well developed sticky sidebar with a well developed sticky navbar, you can create a website that links every page on your site to every other page on your site.

Assumptions

This post assumes that you are familiar with WordPress and WordPress themes and that you know how to set up a website. It also assumes that you are familiar with widgets and menus.

Uses for a Sticky Sidebar

There are three primary ways that a sticky sidebar can be utilized:

  1. Listing Blog Posts for a Blog: The most common place that a sticky sidebar is used is on a blog or news site for the purpose of featuring posts.
  2. A Table of Contents for a Large Page: Another great use for a sticky sidebar is a table of contents used to define sections of your page.
  3. Extending Your Navigation Bar: Your users’ computer screens can only provide so much space. You can use the sidebar to add links that you can’t fit into your navbar.

Pick the Right Theme for Adding Sticky Sidebars to Your WordPress Site

You can get everything that you need for adding sticky sidebars to your WordPress site by downloading the Big Media theme. Just go to your WordPress admin center Appearance > Themes > Add New, then type “Big Media” into the search bar.

The reason that the Big Media theme is the ideal theme is that it not only has everything that you need to set up sticky sidebar navigation, it also has all of the complementary navigation necessary such as a sticky navbar, a back to top button, and mobile compatibility.

Adding a Sticky Sidebar with a List of Blog Posts

A classic use case for a sticky sidebar is to use it as a way to display a list of posts for your blog. To accomplish this, all you have to do is go to the customizer of the Big Media theme (from the admin center go to Appearance > Customize), then go to “Sidebar and Footer Blocks”, then go to “Post (Blog) Sidebar 1” and add a Heading block, then go to “Post (Blog) Sidebar 2” and add a latest posts block. By using two sidebars stacked on top of each other, it will cause the heading to stay in a relative position while the latest posts block will continue to stick as you scroll down screen.

Adding a Sticky Sidebar with a Table of Contents

You may have read my previous post about how to build a table of contents without a plugin. This is still an effective way to add a table of contents, but the Big Media theme offers you an even simpler way. You can still follow the old instructions to set all of your page’s anchors; but with the Big Media theme, instead of using a custom html block and additional CSS, you can add your menu as a regular menu through the menu controls in the admin center or the customizer, then you can use the menu controls in the customizer to add your table of contents to your pages, then you can turn off its use on any pages that you don’t want it featured by selecting “no sidebar” in the block editor by selecting the settings gear then select the page tab then select “no sidebar” from the template dropdown. You can also use the “No Sidebar for Static Pages” control in the Layout section of the customizer to turn off the menu on every page but the homepage.

Adding a Sticky Sidebar by Extending the Navigation Menu

If you have a very large navigation menu, then it also isn’t a bad idea to extend your menu into the sidebar so that it doesn’t get squashed on small screens. What you do is create two menus. The first menu is all of the links that go into your navbar. The second menu is for all of the links that go into your sidebar. Once you have done this, go to the menu section of the customizer (or the admin center) and assign the navbar menu to the navbar and the sidebar menu to both of the sidebars. Note that when you do this with the Big Media theme, your navigation menu gets moved into the slide panel for mobile viewports, and the sidebar portion of your extended menu is moved directly under the main navigation menu.

Got Questions About Adding Sticky Sidebars to Your WordPress Site?

If you have any questions, then feel free to post them in the comments below.