GeneratePress Control Via Filters And Code Snippets

I love the fact that GeneratePress, especially with the super-affordable $39 Premium addon*, gives users a great amount of control over nearly every aspect of the theme. Much of this control lies in the simple-to-use Customizer option panels, and yet, you can also add snippets of code to the various hooks that GP Premium provides.

*Yes, that is an affiliate link above.

Get Even More Super-Fine, Detailed Control With Filters And Custom Code

You can go even farther, however, by using filters or other code snippets to get some really fine-grain control over your GP theme. What are filters?

Filters allow you to use a simple function to overwrite values, whether they’re options or even text on your site.

— Tom Usborne, Using Filters – Documentation

Filters can be a bit tricky to grasp for non-coders, and they trip me up often, trust me!

Tom does a good job though of explaining by example in the Using Filters documentation I linked to above.

What Filters Are Available?

There are currently 70 filters available for you to manipulate as needed, and they are listed here in alphabetical order.  (Note that you can change the view on that list to show the Most Popular or the Most Recent filters. I find that the A-Z option is the most useful for me).

I Need A Different Google Font Than GeneratePress Lists In Customizer

This is a typical / common type of request that a filter can handle. Luckily, Tom Usborne, the developer of GeneratePress, and one of the most helpful developers on this planet, shares a solution for this problem and many others that people commonly wish for. You can find them all here.

When I discovered his sample filters, it felt like I’d stumbled into a room full of candy. I thought it might be useful to share a few that I find interesting, starting with the “add google font to the list” solution.

Filter Snippets

Add A Google Font To The Font Selections List – PHP

Set Elementor Pages To Full Width And No Title Automatically – PHP

Remove Sidebars and Footer Widgets From 404 Page – PHP


Miscellaneous Code Snippets

The snippets below are other miscellaneous bits of code that Tom shares that also do interesting things.

Body Background Image With Color Overlay (CSS)

Change The Width At Which The Mobile Header Kicks In From 768 To Something Else (CSS)

(Be sure to change 768px below to your desired width)


How Do I Add This Code?

If it’s CSS, then simply add it wherever you normally add CSS, such as  in Appearance > Customizer > Additional CSS or better yet, use Tom’s awesome Simple CSS plugin. One advantage Simple CSS has is that it adds a meta box to each page/post editor screen, so you can add CSS specific to that particular page or post.

A good, safe way to add any snippet of PHP code is to use the Code Snippets plugin. Just add a new snippet, and copy/paste the code you need into it.

Instead of mucking around in your functions.php file, Code Snippets lets you manage your bits of code in a more organized way, that’s less prone to bringing on any catastrophes. You can also activate or deactivate each snippet, just like you would a plugin, and you can import and export code snippets. So all in all, it’s a handy thing to use to manage all these bits of code.

Go off now and find the bits of code in Tom’s list that get you all excited. 🙂

P.S. I can’t help if these don’t work for you, but Tom and his crew are powerhouses of help, so I’m sure they’ll get you the help you need.

P.P.S.  Many thanks to Tom for diligently creating these and providing them for use by everyone.

 

 

Donna F. Cavalier is a woman of many interests, both online and off. A WordPress enthusiast since 2004, she fell in love with both GeneratePress theme and Elementor page builder. Together, they help create stunning WordPress websites. Hence, this site was born. She also has many other WordPress and web design related sites, such as WPLot.us (a WordPress maintenance service), CavalierWebDesign.com, DonnaFontenot.com, and others. She is also an author, with one novel, The Grave Blogger, and 2 children’s books Petal Pals: Swamp Adventure and Petal Pals: Off to Amarillo published, with others to be published soon. Finally, she is also a Southeast Louisiana Wedding Officiant, owner of Happy Life Weddings.

Share With Friends

Leave a Comment