12 Not-So-Obvious WordPress Tweaks to Improve Posts and Pages
12 Not-So-Obvious WordPress Tweaks to Improve Posts and Pages
Posts and pages are the backbone of a WordPress environment.
They can be filed under the umbrella term singular page because they show a single piece of content from your database. Optimizing these can increase your click through rates, time spent on page and various other statistics.
In this post we’ll take a look at some of the things you can do to make your posts and pages better. This includes changing built-in settings, using plugins and using code to get things done.
Changing Built-In Settings
If you look around on the edit page for your posts and pages you’ll notice a lot of settings you can change.
I recommend going to the Screen Options tab at the top of the page and switching everything on. If you don’t know what something is, give it a go – you never know what you may find!
Editing permalinks is a common practice for a number of reasons. When you start an article you may have given it a placeholder title like “My New WordPress Post.” In this case, the slug will be “my-new-wordpress-post,” which means the URL will be “http://yourdomain.com/2015/03/29/my-new-wordpress-post”. This is not good at all – it should be changed.
There’s an edit button next to the permalink, but you can also click on the end bit (highlighted in yellow) to edit it. A neat trick I use often: delete the string completely and press enter or click ok – the permalink will be generated anew from the title.
Another useful scenario can be seen in the image above. Sometimes you may want the article title and the permalink to differ for SEO reasons. If your title is “Top Tips To Establish And Improve Your WordPress SEO” you may want the permalink to omit all the unnecessary words – “improve-wordpress-seo.”
When uploading images always make sure to add alt text and a description, even if you don’t use the image. This can be a nuisance at times but it may increase your search engine rankings and it makes your website more complete.
Each image has its own page called the attachment page, which exists even if you don’t link to it, even if you don’t use the image anywhere. Take a look at this example attachment page from Twenty Fifteen.
The title and description of your image show up, giving you additional content, which can be targeted just like any other content. It also gives you the opportunity to create useful functionality like download links, RAW image information and more.
Regretfully, many themes overlook the attachment page. If you happen to use a theme which doesn’t have a great looking view you can follow our guide to creating attachment pages.
If you’re displaying excerpts on your website I highly suggest using the dedicated excerpt field in the editor. This may be hidden so you will need to go to the screen options to get it to show up.
The theme will display your hand-crafted excerpt instead of the automatically generated one. This allows you to create more enticing excerpts without having to worry about the 55 word cutoff point of auto-generated ones.
There are some great plugins available that can add even greater functionality to posts and pages, from improving commenting and SEO to adding polls and meta data.
The plugins below include both free and premium options, as well as two from our own catalog of plugins.
Our Infinite SEO plugin offers some powerful settings for customizing meta options for posts and pages on your site. The optimization tools integrate into the editor for powerful control over how search engines display your content.
Easily boost your site’s rankings with thoughtful titles, previews and meta information.
It’s pretty hard to create a plugin list without Jetpack, it just has so many modules now. Some of them are specifically designed to make your posts and pages awesome.
The related posts module generates links to related content below posts. This is essential for getting more page views per visitor. I also feel more comfortable with Jetpack offering this feature than anyone else. Related posts can be done in a very wasteful, database-intensive way. Jetpack is made by Automattic, the company behind WordPress, s the code is optimized for sure.
Other great modules include sharing (which allows you to add sharing buttons below your posts), publicize (autopost content to social sites), tiled galleries, likes and more!
Ever wanted to have one of those promo boxes that pop up when you scroll a certain distance, or you reach the bottom of a page? Dreamgrow Social Triggered Box offers this functionality in a highly customizable plugin.
Use the box to promote a product, a free eBook tied to registration, or any other content you’d like.
I used to feel an aversion to Disqus back in the day but it has progressed so much recently it has become a great way to handle your comments. I’m using Disqus more and more throughout multiple websites and I’ve found it to perform very well.
Disquss offers a centrally managed commenting system with tons and tons of benefits. When someone comments on your content via Disqus the comment is also saved to your regular WordPress comments, so should you ever disable the plugin, the comments will still be there.
Shortcodes are a great way to add content. Type [button] to get a nicely formatted button for example. Arconix is just one of many plugins offering a bundle of shortcodes.
it offers buttons, tabs, icons, accordions, message styles and so on.
Search And Replace is – not surprisingly – a plugin which allows you to search and replace within your website’s content. If you need to remove certain sections from your posts or you’d like to mass-correct a spelling mistake you’ve been making, this plugin is for you.
Our Protected Content plugin allows you to setup subscription-based protection for the content on your site. You can have free content just the same, but also hide key posts, pages and other content behind a paywall.
If you’re making premium quality content, this is a great way to earn some money without having to resort to advertising.
Print Friendly is a we service which puts the control over what is printed in the hands of the user. You can remove images, remove specific paragraphs and other elements from the web page. This saves on paper which is great and saves users time by allowing them to truly print what they want.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
The plugin allows to output the buttons to initiate the process on your posts and pages.
This plugin also won’t make your website visually different but can increase your SEO rating many-fold. It adds support for microdata throughout your website. This means that Google, and other search engines, will be able to read your website more efficiently and know what’s what.
If you want to add a poll to a website Polldaddy is your best bet. You can compile and customize your polls, display results and store answers in the backend. Polldaddy also has support for ratings which you can output on each post or page if you like.
The full name of this plugin is “NextGEN Facebook – Advanced Social SEO for Facebook, Google+, Pinterest, Twitter & More” which is awesome if you review plugins and you are paid based on word count but is a bit of a mouthful otherwise.
This plugin – among other things – adds open graph tags to your website which make sure that your content sharing experience is better on Facebook. You should see nice thumbnails and page descriptions and perhaps an increase in content sharing.
Of course the built-in settings and plugins just scratch the surface of what’s possible. Adding the snippets below to your theme/child theme or plugin, you can achieve some granular modifications.
Redirect Single Search Result
I really like this one – thanks WP Snipp! When a user searches your website and there is only one result the user is taken straight to the single post, no need to click again in the search results.
This improves user experience, which leads to all sorts of benefits, including better statistics.
If you link to various sources frequently you could create a special link formatting to make them easily visible. For example: You could output the WPMU DEV icon each time you link to an article.
When creating the link in the back-end make sure to add a class, something like
prettylink-wpmudev. You can then add a snippet like this to your stylesheet:
While on the subject of links, we can also create links from specific text. For example, whenever you mention WordPress you can convert the word to a link to the WordPress website. All you need to do is hook into
the_content to modify the content of the post.
This snippet replaces strings with links within the post content. If you’d like to do this in the excerpts as well, add another filter which hooks into
Beware when using this method as it will convert text which is already contained in a link. If you occasionally link to WordPress anyway you will end up with broken HTML.
You could use some advanced regular expressions to make this happen but I would suggest creating links whenever you need one, only use this snippet as an interim solution.
Display All Images for a Post
There are a few ways you can display all the image for a post. You could query for the images and do what you like with the data, or use the built-in gallery functionality.
Let’s do the latter – build a gallery shortcode out of images pulled from the database:
A query is performed, we make sure to only pull attachments which are linked to the current post. I made sure to specify
fields => 'ids' which will make the function return an array of image ids instead of image objects. Finally, we echo a shortcode, putting the ids in their right place.
Insert Content Between Paragraphs
In some scenarios you may want to insert your featured image after the first paragraph, or perhaps an ad after the second paragraph. This can be done by hooking into
the_content and using some regular expression magic.
The key here is the
$matches array. Increment the second number to add content after later paragraphs.
$matches will add your content after the fourth paragraph for example.
Create Your Own Shortcodes
Shortcodes are a cinch to make and could make your life so much easier. You could use them to create the iconed links more easily, or to add more elaborate content with minimal effort.
Here are two examples:
The first shortcode – iconlink – creates a link with a class which we can style with CSS, just like we did before. Here the class is generated automatically from the URL. The domain name is parsed out and dots are replaced with dashes so the WPMU DEV would become “premium-wpmudev-org.”
The second shortcode is a way to tell users to look at a new version of the post without having to type the notice each and every time. This is essentially a snippet, you just type ‘[update_notice url=”http://newcontent.com”]’ into the editor and you have your notice.
Add Old Post Notices Automatically
Some websites write about rapidly growing and changing industries so posts from a year ago may well be outdated. In these cases you may want to add an outdated notice without having to go to each post and adding the shortcode. This can be done by hooking into
the_content yet again.
You’ll need to style this yourself, but with just three rules added it already looks nice in Twenty Fifteen:
Redact Sensitive Content
If you have some authors prone to swearing but you don’t want to dictate their style you can create a neat little redactor by filtering the post content. You can enable this filter for guests only to make sure your logged in users see everything.
We look for instances of frak and replace it with
<span class="redacted">karf</span>. We can then style the
.redacted class however we like, making it look like an actual redaction. I also jumbled up the letters because the word would otherwise still be visible in the source code, or if highlighted.
If you want to enable this for guest users only wrap all the code within the function in
if ( !is_user_logged_in() ) .
Change Your Excerpt’s Length
Would you like to use an excerpt but you find the 55 word default a bit on the short side? You can modify it to your heart’s content using the
excerpt_length filter. It’s easy, the following will double the length of the excerpt to 110 words:
The list of what you can do to enhance your pages is truly endless because your imagination and coding prowess is the limit. You can accomplish a lot with built-in settings and plugins and if you want complete control, code is your friend.
Do you have any favourite techniques to make your posts and pages better? Let us know in the comments below.