Podcast Episode

455 – Show Same Text on Every Page of a WordPress Site

Announcements

Is there a plugin for that?

With more than 50,000 plugins in the WordPress repository, it’s hard to find the perfect one. Each week, I will highlight an interesting plugin from the repository.

For more great plugins, download my 50 Most Useful Plugins eBook.

Cost Calculator Builder is a smart simple tool that allows you to create price estimation forms to give your clients the opportunity to get information about your services and product costs.

Show Same Text on Every Page of a WordPress Site

  • Create a text expander snippet to paste in the same content on every page
  • Create a reusable block and add the block to every page
  • Create a shortcode that will display the text where ever the short code is added
  • Put the content in a widget
  • Add the text to a header or footer code
  • Create a small plugin, that will add the text at the end of every blog post

Thank You!

Thank you to those who use my affiliate links. As you know I make a small commission when someone uses my link and I want to say thank you to the following people. For all my recommended resources, go to my Resources Page

Full Transcript

Business Transcription is provided by GMR Transcription.

On today’s episode, we are going to talk about how can display the same text in the same way on many pages across our WordPress website right here on Your Website Engineer podcast episode number 455.

Hello and welcome to another episode of Your Website Engineer podcast. My name is Dustin Hartzler, and today we’re going to be talking about some code or some tweaks or some ways that we can do some things around our WordPress website, specifically showing the same type of text on every single page or multiple pages across your WordPress website.

So let’s go ahead and before we get to there, let’s dive in and talk about the announcement of the week. It’s another week, and last week we talked about an acquisition when Automatic acquired Tumbler, and it was a huge kind of shock, and now here come this week there’s another announcement where Automatic acquires a company called Zero BS CRM. CRM stands for Customer Relationship Management, so it’s a tool that you can track your customers, and if they’ve purchased things or they’ve been on your website or you’ve sent them emails, all the great stuff, you can keep all of this information in one place.

This is good too if you are a sales rep and you’re calling people all the time, this is a good way that you can manage all of these contacts, and usually there’s a standalone application for this. But Zero BS CRM is a plugin that was on the WordPress repository, had more that 1,000 active installs, and it wasn’t a well, well-know product, and I’d never heard of it before, but it caught Automatic’s attention.

And so, the company was acquired. There were two developers that have joined the team, and basically it’s a plugin that’s probably going to be rebranded and built into the Jetpack plugin.

So, that’s just some news that I’ve got. There is an article on WP Tavern that’s got a bunch of detail about what went down and a little bit more about the whole process and whatnot. And so, if you’re interested in some of the details, you can head on over to the WP Tavern and look for Zero BS CRM, or you can just go ahead and use this link in the show notes for episode number 455.

The next thing that I want to share is about the plugin of the week, and this one is called Cost Calculator Builder. And it is a free plugin on the WordPress repository. It’s brand-new. It’s by a company called StylemixThemes. And it is a plugin that will allow you to create an easy to create form I guess. It is a price-estimation form, so you can give your clients the opportunity to get the right information about your services, products, costs, all that good stuff in the right place.

So, think about like maybe an irrigation company. They could set up and you could say oh, here’s how big my yard is, or this is how many zones I want or you can have estimates calculated based on form fields. And so, I think that’s kinda neat. There’re different calculator elements like an input box or drop-down box, a switch box, all kinds of things. So, if you’re interested in having some sort of price calculator on your website, I would recommend checking out Cost Calculator Builder. There’s a link in the show notes for this, or you can just search for that on the WordPress repository.

There're over 55,000 plugins now, and so this is just one that stood out to me this week, and it’s hard to believe. I'd have to scroll back all the way to the beginning of the archives to see when I first started doing the “Is There a Plug in for That” section like how many plugins that were there. Certainly we’re probably under 10,000 is my guess, but that is the plugin of the week.

All right. Today, I want to talk a little bit about how we would go about displaying the same type of text on every page in our WordPress site. This came to me when I was going on a walk this week listening to another podcast when they were talking about updating and making changes. And I was like huh. That’s kinda neat. Maybe they were talking about A Strong Call to Action on the bottom of each post. I think that’s what it was. I was listening to the late-night Internet marketing podcast by my friend, Mark Mason, and they were talking about – I think he had a podcast that was like 12 or 20 or something steps that you could take to kinda move your online business in the next direction like maybe they were 20-minutes steps that you could do. So, you could spend a little bit of time each night figuring out and working on your late-night Internet business. That’s what the name of his podcast was about.

And one of them was talking about having a call to action as part of every post. And then I got to thinking oh well, that would be kinda neat to do, and how would I do that? And I'm just kinda thinking through what that would look like, and here’s what I came up with a few different ways that you can display some of those texts.

And so, the first way is a fairly easy way, and if you already have this tool, then it would be really easy to do, but this is to use text expander, and you could create a snippet to post the same content on every page.

So for example, like my show notes are very similar week to week, because I have a text expander snippet, and because it lays out the style or the formatting I mean basically puts the announcements. There’s a plug in for that. It does all of the outlines. Outlines is the word that I'm looking for. It does the outline, and so every week, the outline is exactly the same. And if I make a tweak, then I change the text expander snippet.

And you could do this for certain sections on your website. Maybe you have a thank you section at the bottom of every post or whatnot, and you could just create a text expander snippet, and so every time create an outline or a blog post or a page or post or whatever on your website, or even you could put it in a sidebar or anywhere you wanted it, you could just use the text expander snippet, and then it would expand out, and you could put HTML in there so it would have the right formatting and whatnot.

And so, that’s the first way you could do them. It would be very tedious, because it’s only going to work on the posts that you have put it on. So for example, like you did it for episodes number – you have 100 podcasts, but you did it on the last three, then the first 97 are not going to have that text expander snippet, because you’d have to manually go and do that and add that to each one. So, it’s really not the best option. It would be something that you can do going forward and if you’re okay with that, that would be definitely an option, but probably not the best option.

Another thing that you could do is create a reusable block and add that block to every single page. And this would be perfect if again you want to use it from this point forward and going forward on all your new blog posts or pages, but it would take a long time to – you add those blocks to all of the rest of your posts and pages.

And what a reusable block is, it essentially is you’re creating exactly what you want to appear, and then you save it as a reusable block. And a good example of this is on the show notes for Your Website Engineer. What I do is I have a reusable block for the little snippet that goes above the “Is There a Plug in for That” section and it highlights and says how many plugins are in the WordPress repository.

And what’s really nice about this is wherever I used the reusable block, I can go and update that text, and I can change it. So, if it says 50,000 plugins in the WordPress repository, I can go and I can update that to 55,000 plugins on the WordPress repository. So as kind of anything that you could do, and a reusable block would be a really good way to add something to maybe the middle of a blog post or the bottom of the blog post or just anywhere inside of a post or a page.

Reusable blocks won’t work for content if you want it in the footer or if you want it in the widget or the sidebar or whatnot. So, it’s a mediocre solution. It works really well. It allows you to update in the future, but then you have to go and manually add it to every single page.

Another option when it comes to getting content correctly placed for that content in the exact same way, is what you could do is you could create a short code, and that will display the text wherever your short code is added. And so, what this is, is this is a good example. I had a short code for a while for that section on YourWebsiteEngineer.com for “Is There a Plug in for That”, and it was the short code ebook. And that basically would go and it would grab text – I had to write a custom function to do that, and it would go and grab the information and display it on the website on the page where that block is or where that short code was placed.

And this is probably the best option before the Block Editor came, but this is something that you could also do as well. You know, maybe you want to move it around a lot. I created a short code for my wife for her website, and she just types a bracket and then DRH and then bracket for Dr. Hartzler, and then it signs it Dr. Hartzler. It’s in a special font and whatnot, and then that way, she doesn’t have to figure out how to do that every time. I just taught her to put the short code there, and then that she can put at the bottom of every single one of her posts. And so, that is a way that you could do that as well. You can create that short code. It displays the text wherever you put the short code, and you can do that – the short codes with the right function enabled can be run in footers or headers or in the sidebar or whatnot, so that would be something that you could do to get things set up.

Speaking of widgets, another thing you can do is you could just put the code in the widget or the text in a widget, and then that’s going to show up on every single page. Now you have to kinda determine what type of content it is, if it’s like your contact information or if it’s something that you want on every page like that makes sense, but you probably don’t want to have something that’s not related to post or page, you know, you might not want to put that in a widget content area.

You could also create a widget area. This would be something that is kinda along with that, so every theme has some widget areas built in. You know, sometimes they’re at the top, most of the time they’re on the sidebar, and then a lot of times there in the footer as well.

But you could create a widget area that goes right in the bottom of a page or the top of a page, and then you could dump your content that you want to have on every single page, you could dump them in those widget areas, and so it gives you the access to update and change the content based on changing it from a widget block, which would be really handy, and then this would be something like maybe at the bottom of every post you want, “Subscribe to my email newsletter.” Or “Here’s my social accounts.” Or you know, whatever. You could do that, and you could put that in a widget.

First you have to define the widget in the specific area that you want the text to appear, and then you could customize it and change it right from the WordPress Customizer, which would be really handy. And so, you wouldn’t have to dig into any code to make a simple tweak or a change to the text in that widget or the sidebar.

Another thing that you could do is you could add that text to a header or a footer code. And so if it’s something that you want to display at the very top, maybe it’s a banner across the top or maybe a banner across the footer, you could just create – you know, go into footer.php or header.php and add that code right there, that text right there, so it’s going to display. And then it will display on every single page, because every page loads the header, and every page loads the footer.

Probably not the best option just because from the placement of it, the footer usually is a different color than the rest of the body and sometimes the top is as well. So, it might not be a good solution for texts like, “Sign up for my newsletter,” to be in areas like that, but then on the other hand, maybe it could be. Maybe that is the right place to put that. Maybe that is a good place then you guarantee it to show up on every single page.

And then the last one on my list here is to create a small plugin, and this could be just a small custom functionality plugin that could add the text to the end of every blog post. And so, maybe this is something that you’d be looking for instead of having to manually remember to add a certain block or use a short code or use text expander to add it directly to the bottom of the post, you could write a little bit of code that says basically if it is a post, if the content is a post, then at the bottom of this section – you could put it in your template file or whatnot – then it would run this code at the very bottom.

So, I’ve run this a couple times, and this is a good place if you wanted to have something like, “Sign up for my email newsletter” or something along those lines that you wanted to show up at the bottom of every post. If you need content in the middle of a post, it’s really hard to do some of this automation type stuff, because WordPress is smart enough to say like you can do it before the body content or beneath the body content, but there’re no filters or actions that you can say insert this at a random spot in the middle of my content. So, that really wouldn’t work, but you could create something like this.

This would be a little bit harder to set up, because it would take some custom code, and it would be a little harder to change if you wanted to update that text later. Granted it’s all – it’s just all code, but you’d have to go into your code editor and then upload it manually and that sort of thing.

So, some of the other options are little bit nicer, a little bit cleaner if you don’t want to have to dig into the code every time that you want to do it.

One reason that’s really nice to insert the content in the exact same way is it makes it really for finding and replacing. I know in the past I used to try to run a script to look through the WordPress posts, all the posts, look for a specific number so like 35,000 for the “Is There a Plugin for That” section, and then run some code to update all of the posts that have the exact same copy.

And it makes it really easy when everything is identical, and then that way when you’re finding and replacing and doing all that, you can do that really, really easily. So maybe in the past you’ve used the same code. Say for example, you have a podcast and in the first 10 episodes, you didn’t do anything, you didn’t have any of your “custom code,” and then from episode 11 to 50, you manually typed something in or you copied and pasted every week to make sure it was identical, and then you started on 51 to 72 or whatever, you did something a little bit different.

Then what you could do is you could find and replace and then give them all the same, and so you could find and replace a small chunk of them from 11 to 50 and get that all the same as our content throughout your entire site, and then do the other batch, and then eventually if they’re all the same on every single page, then a find and replace will replace it site-wide, and then you could just manage it one time.

And you can even do this if you are – even if you haven’t had the Block Editor enabled. You could create a reusable block, use the code from the reusable block, and then do a find and replace on that, and that should work site-wide, so then everything is in a block. Then you can update it in a block.

I’m just getting – I didn’t really think this through, but as I'm explaining it, I think that would really work. So, if you have some content that’s not in a reusable block but you have some that is, you can find and replace and then replace that with the HTML tags around it, and then that would actually turn it into a reusable block, and then you can update it right from the dashboard, which would make it really simple.

So, it would take a little bit of finagling to get all of the areas the same, but then once they are, then you’ve got the reusable block, and then you can make the tweaks and adjustments that you need to write from the WordPress dashboard.

I think I really like that last feature or the last one, and I’m going to try to do that on a couple areas of my website, because there’re some that haven’t had the reusable block added yet, and so that would be a really good project to make sure that all of my sites or all of the posts in your YourWebsiteEngineer.com is now using the Block Editor just to make everything consistent and whatnot, and so when I change a theme or update the formatting, it’s going to look the same everywhere.

So, that’s what I want to share with you this week. I’m getting excited to talk more about code and just try some of these things myself. I’ve been out of the WordPress loop, like I said, for a while because of the sabbatical at Automatic. But now that’s over. I’m back into the swing of things. I’m working, and join the projects and the things that I’ve got going on every day, and it’s just great to be back in the WordPress space.

So, until next week, take care, and we’ll talk about more WordPress cool stuff next week. Bye-bye.