Add Custom Formatting to WordPress: How Can You Do It Without Coding?

Add custom formatting to WordPress without coding: register block styles, paste safe PHP/CSS into functions.php, and get one-click accent and dark styles now.

Spread the love
Bikers rights gif via giphy
"bikers rights" portlandia gif via giphy

TL;DR

Add custom block styles by placing a small snippet in functions.php (no plugin required).

Let ChatGPT write the PHP + CSS, so you don’t need to learn either to get started.

Avoid the site-breaking mistake: don’t paste a full PHP script (with <?php) into functions.php.

Your formats appear as one-click style options in Gutenberg via the block’s Styles panel.

Have you ever wanted to add custom formatting to WordPress, like, beyond just bold and italics? 💡 I’m talking about clicking a button and instantly applying your own accent text style, a dark text highlight, whatever you want.

I was banging my head against the wall trying to figure this out for way too long, and the solution ended up being stupidly simple. That’s something that I was really looking to do but I didn’t know how to do it. 👋

If you’ve ever gone through the headache of manually styling text every single time you write a post, you already know why this matters. And if you’ve been intimidated by the idea of touching code, I get it, I was right there with you. I didn’t want to become a developer to get there.

https://www.youtube.com/watch?v=

Learn how to easily add custom formatting to WordPress with this step-by-step guide!

Why Default WordPress Formatting Isn’t Enough

WordPress gives you the basics. Bold, italics, strikethrough, maybe a highlight if your theme supports it. And for a lot of people that’s totally fine.

Engaging thumbnail promoting wordpress formatting tutorial
Learn how to easily add custom formatting to wordpress with this step-by-step guide!

But if you’re creating content regularly—blog posts, landing pages, product descriptions—you start to notice how generic everything looks. Every paragraph reads the same. Every heading feels identical to the last one.

It’s all the same vanilla formatting and it gets old fast. Everything starts to blend together.

I wanted everything to be as fast as when I highlight something and I click on the little bold icon, and then it just turns bold immediately. That’s exactly what I was after.

Not some complicated workaround where I’m manually adding CSS classes every time I write. I wanted a button. Click it, done.

The thing most guides won’t tell you is that WordPress already has this capability built in. It’s called custom block styles, and it’s been part of the Gutenberg editor since WordPress 5.3 introduced wider support for the Block Styles API.

The problem isn’t that WordPress can’t do it. The problem is that actually creating those styles requires PHP and CSS, which is where most of us content creators mentally tap out.

That’s where AI comes in.

How to Use ChatGPT to Write Your WordPress Code

So here’s the trick that changed everything for me. Instead of spending hours learning PHP syntax and figuring out the right WordPress hooks and functions, I just asked ChatGPT. I outsourced the syntax.

And I don’t even ask nicely. I misspell things. I use terrible grammar. Here’s basically what I typed: this was my actual prompt:

“In WordPress, you know how you can go to the top bar extension and click on the text to bullets or create headings? I often misspell things because I just don’t care when I’m talking to AI, it knows what I’m saying, and do custom formatting? I’d like that.”

That’s it. No fancy prompt engineering, no technical jargon. I told it what I wanted in plain English and ChatGPT came back with the exact code I needed: a register_block_style() function in PHP plus the matching CSS to make it look right. It connected the dots for me.

Info icon.

Fun Fact

The register_block_style() function is the official WordPress method for adding custom styles to blocks. When you register a style with the name “accent,” WordPress automatically generates the CSS class is-style-accent and attaches it to whatever block you apply it to.

You don’t need to know that to use it, but it’s cool that it’s not some hacky workaround—it’s literally how WordPress was designed to work. It’s a built-in feature.

ChatGPT gave me two custom styles: an accent text and a dark text option. Both show up in the editor’s Styles panel as one-click options, so applying them to any supported block takes about one second. It feels native.

Where to Put the Code (And the One Thing That Will Break Your Site)

Alright, this is the part where I need you to pay attention because this is where people mess up and then blame WordPress for “being broken.” This is where sites crash.

The code goes into your functions.php file. You can find it by going to Appearance → Theme File Editor in your WordPress dashboard. You’ll see a list of theme files on the right side, and functions.php will be right there. That’s the correct destination.

Error icon.

Critical Error

Don’t paste a complete PHP script into functions.php because it already includes the opening tag. When ChatGPT generates code, it often wraps it in <?php. Your functions.php file already starts with that tag.

If you paste in a second one, PHP throws a fatal error and you can end up with a white screen of death. Always strip out the opening <?php tag before pasting. Also skip the closing ?> tag—WordPress recommends omitting it to avoid issues from trailing whitespace (for example, header/output problems). See: official documentation.

So the process is dead simple. Do it in this order:

  1. Copy the code ChatGPT gave you
  2. Remove the <?php opening tag (the file already has one)
  3. Scroll to the bottom of your functions.php file
  4. Paste it in
  5. Hit “Update File”

That’s it. Go back to your post editor, click on a paragraph or heading block, and you’ll see your new styles in the Styles panel on the right sidebar. One click, instant formatting.

Warning callout icon.

Caution

Back up your site first. If you paste bad code into functions.php, your entire site can go down. If you’re nervous, use Code Snippets instead—it lets you add PHP without editing theme files directly and can prevent a broken snippet from taking your site offline. Two minutes of backup can save hours.

What the Result Actually Looks Like

Once the code is in, the magic is how boring the workflow becomes, and I mean that as a compliment. It becomes routine.

You’re writing a post. You select a block. You open the Styles panel in the right sidebar (or click the block styles button in the toolbar), and now there’s “Accent Text” and “Dark Text” sitting right there next to the default options. Click one. Done. It’s the same muscle memory as bold.

On the front end of the site, the accent text shows up with whatever styling you defined in the CSS—maybe it’s a different color, maybe it’s got a background highlight, maybe it’s a slightly different font weight. The dark text does its thing too.

And because it’s applied via CSS classes, it’s consistent across every single post and page you’ll ever write. Consistency becomes automatic.

No more manually changing text colors. No more copying and pasting inline styles. No more “wait, what hex code did I use last time?” That busywork disappears.

One snippet of code. Two new formatting options. Every post you write from now on, styled exactly the way you want, in one click.

Should You Put This in functions.php or a Plugin?

This is something I didn’t cover in the video but it matters depending on your situation. It depends on portability.

When you add code to functions.php, it’s tied to your theme. If you switch themes, those custom styles disappear. For purely visual stuff like accent text formatting, that’s probably fine—you’d likely want different styles for a different theme anyway. Theme change = style change.

But if you want your custom block styles to stick around no matter what theme you’re running, the better move is putting the code into a small custom plugin or using the Code Snippets plugin I mentioned earlier.

The official WordPress Theme Handbook recommends this approach for functionality that should be theme-independent. Plugins survive theme switches.

For most bloggers and small business owners, the functions.php method works great. Just know the trade-off. Simple now vs. portable later.

functions.php vs Plugin/Code Snippets

functions.php Method

  • Tied to your current theme
  • Disappears if you switch themes
  • Simpler, faster to set up
  • Good for visual/presentational styles

Plugin or Code Snippets Method

  • Works regardless of active theme
  • Survives theme changes
  • Slightly more setup
  • Better for long-term or functional code

The “C-Student With an A-Plus Cheat Sheet” Approach

Here’s my honest take on all of this. I’m not a developer. I’m not going to become one. And for what I need—making my content look less generic and saving myself time on repetitive formatting—I don’t need to be one. I’m optimizing for output.

ChatGPT is the cheat sheet. You tell it what you want in normal human language, it gives you the code, you paste it in the right place, and you move on with your life.

I used to spend way too much time on stuff that should’ve been simple. Now it takes five minutes and I’m done. Speed is the whole point.

The WordPress editor is more powerful than most people realize. Custom block styles, custom CSS, the whole Gutenberg system—it’s all there waiting. You just need someone (or some thing) to write the code for you, and now you’ve got that covered. The tooling already exists.

Have you ever struggled with adding custom styles in wordpress; felt overwhelmed by coding; wished it was as easy as one click? 🤔
Have you ever struggled with adding custom styles in wordpress; felt overwhelmed by coding; wished it was as easy as one click? 🤔

Frequently Asked Questions

Absolutely. You can register as many block styles as you want—just add another register_block_style() call for each one. I started with accent text and dark text, but you could add a highlight style, a quote style, a “warning” style, whatever makes sense for your content. Just don’t go overboard or your Styles panel becomes a cluttered mess. More isn’t always better.

No. The code you’re adding is tiny—just a few lines of PHP and maybe 10–15 lines of CSS. It has no measurable impact on page load time. The CSS gets loaded once and cached by the browser. This isn’t a plugin adding database queries or external scripts; it’s about as lightweight as WordPress customization gets. This is low overhead.

The register_block_style() function has been a stable part of the WordPress Block Editor API since WordPress 5.3, so it’s unlikely to break from a routine update. Theme updates are the bigger risk: if your theme update overwrites functions.php, your custom code disappears. This is another reason using a child theme or Code Snippets is smart insurance. Theme updates are the real risk.

Any AI chatbot that can generate code will work—Claude, Gemini, Copilot, whatever you prefer. The prompt is the same: describe what you want in plain English and ask for a WordPress register_block_style snippet with matching CSS. I used ChatGPT because it’s what I had open, but the code it generates is standard WordPress PHP. The output is portable.

Yes. You can register custom styles for any core block—lists, images, buttons, groups, columns, you name it. You just change the block name in the code from something like core/paragraph to core/list or core/image. The WordPress developer docs have examples for various block types, and Brian Coords has a great walkthrough for custom list styles. You’re not limited to text.

Final Thoughts

Adding custom formatting to WordPress doesn’t require a computer science degree or a web developer on retainer. It requires a conversation with an AI chatbot, one file in your WordPress dashboard, and about five minutes of your time.

The hardest part, honestly, is remembering to strip out that opening PHP tag before you paste. That’s the biggest hurdle.

So go open ChatGPT, describe the formatting styles you wish your editor had, grab the code it spits out, and drop it into your functions.php file. The next time you sit down to write a post, those one-click custom styles will be sitting right there waiting for you. And you’ll wonder why you didn’t do this months ago. You’ll feel it immediately.

Leave a Comment

Frequently asked questions (FAQ)

LiaisonLabs is your local partner for SEO & digital marketing services in Mount Vernon, Washington. Here are some answers to the most frequently asked questions about our SEO services.

SEO (Search Engine Optimization) is the process of improving your website's visibility in search engines like Google. When potential customers in Mount Vernon or Skagit County search for your products or services, SEO helps your business appear at the top of search results. This drives more qualified traffic to your website—people who are actively looking for what you offer. For local businesses, effective SEO means more phone calls, more foot traffic, and more revenue without paying for every click like traditional advertising.

A local SEO partner understands the unique market dynamics of Skagit Valley and the Pacific Northwest. We know the seasonal patterns that affect local businesses, from tulip festival tourism to agricultural cycles. Local expertise means we understand which keywords your neighbors are searching, which directories matter for your industry, and how to position your business against local competitors. Plus, we're available for in-person meetings and truly invested in the success of our Mount Vernon business community.

SEO is a long-term investment, and most businesses begin seeing meaningful results within 3 to 6 months. Some quick wins—like optimizing your Google Business Profile or fixing technical issues—can show improvements within weeks. However, building sustainable rankings that drive consistent traffic takes time. The good news? Unlike paid advertising that stops the moment you stop paying, SEO results compound over time. The work we do today continues delivering value for months and years to come.

SEO pricing varies based on your goals, competition, and current website health. Local SEO packages for small businesses typically range from $500 to $2,500 per month, while more comprehensive campaigns for competitive industries may require a larger investment. We offer customized proposals based on a thorough audit of your website and competitive landscape. During your free consultation, we'll discuss your budget and create a strategy that delivers measurable ROI—because effective SEO should pay for itself through increased revenue.

Both aim to improve search visibility, but the focus differs significantly. Local SEO targets customers in a specific geographic area—like Mount Vernon, Burlington, Anacortes, or greater Skagit County. It emphasizes Google Business Profile optimization, local citations, reviews, and location-based keywords. Traditional SEO focuses on broader, often national rankings and prioritizes content marketing, backlink building, and technical optimization. Most Mount Vernon businesses benefit from a local-first strategy, though many of our clients combine both approaches to capture customers at every stage of their search journey.

Absolutely! SEO and paid advertising work best as complementary strategies. Google Ads deliver immediate visibility and are great for testing keywords and driving quick traffic. SEO builds sustainable, long-term visibility that doesn't require ongoing ad spend. Together, they create a powerful combination—ads capture immediate demand while SEO builds your organic presence over time. Many of our Mount Vernon clients find that strong SEO actually improves their ad performance by increasing Quality Scores and reducing cost-per-click, ultimately lowering their total marketing costs while increasing results.