{"id":138836,"date":"2015-03-27T08:00:26","date_gmt":"2015-03-27T12:00:26","guid":{"rendered":"http:\/\/premium.wpmudev.org\/blog\/?p=138836"},"modified":"2019-04-25T21:31:01","modified_gmt":"2019-04-25T21:31:01","slug":"post-page-tweaks","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/post-page-tweaks\/","title":{"rendered":"12 Not-So-Obvious WordPress Tweaks to Improve Posts and Pages"},"content":{"rendered":"<p>Posts and pages are the backbone of a WordPress environment.<\/p>\n<p>They can be filed under the umbrella term <em>singular page<\/em> 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.<\/p>\n<p>In this post we&#8217;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.<\/p>\n<h2>Changing Built-In Settings<\/h2>\n<p>If you look around on the edit page for your posts and pages you&#8217;ll notice a lot of settings you can change.<\/p>\n<p>I recommend going to the <strong>Screen Options<\/strong> tab at the top of the page and switching <em>everything<\/em> on. If you don&#8217;t know what something is, give it a go \u2013 you never know what you may find!<\/p>\n<h3>Changing Permalinks<\/h3>\n<p>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 &#8220;My New WordPress Post.&#8221; In this case, the slug will be &#8220;my-new-wordpress-post,&#8221; which means the URL will be &#8220;http:\/\/yourdomain.com\/2015\/03\/29\/my-new-wordpress-post&#8221;. This is not good at all \u2013 it should be changed.<\/p>\n<p>There&#8217;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 &#8211; the permalink will be generated anew from the title.<\/p>\n<div  class=\"wpdui-pic-regular  \">\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-138837\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/permalink.png\" alt=\"Editing permalinks\" width=\"700\" height=\"85\" \/><\/div>\n<\/div>\n<\/div>\n<p>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 &#8220;Top Tips To Establish And Improve Your WordPress SEO&#8221; you may want the permalink to omit all the unnecessary words \u2013 &#8220;improve-wordpress-seo.&#8221;<\/p>\n<h3>Image Metadata<\/h3>\n<p>When uploading images always make sure to add alt text and a description, even if you don&#8217;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.<\/p>\n<p>Each image has its own page called the attachment page, which exists even if you don&#8217;t link to it, even if you don&#8217;t use the image anywhere. Take a look at this <a href=\"https:\/\/twentyfifteendemo.wordpress.com\/image-alignment-and-styles\/mcm_2432-e1264268646918\/\" target=\"_blank\">example attachment page<\/a> from Twenty Fifteen.<\/p>\n<p>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.<\/p>\n<p>Regretfully, many themes overlook the attachment page. If you happen to use a theme which doesn&#8217;t have a great looking view you can follow our <a href=\"https:\/\/wpmudev.com\/blog\/creating-an-attachment-page\/\" target=\"_blank\">guide to creating attachment pages<\/a>.<\/p>\n<h3>Custom Excerpts<\/h3>\n<p>If you&#8217;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.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-138862\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/excerpt.png\" alt=\"Excerpt Box\" width=\"631\" height=\"185\" \/><\/div>\n<\/div>\n<p>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.<\/p>\n<h2>Plugin Enhancements<\/h2>\n<p>There are some great plugins available that can add even\u00a0greater\u00a0functionality to posts and pages, from improving commenting and SEO to adding polls and meta data.<\/p>\n<p>The plugins below include both free and premium options, as well as two from our own catalog of plugins.<\/p>\n<ul class=\"dev-tutorial-list\"><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Infinite SEO<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"171\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/infinite-seo-600x171.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Infinite SEO image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>Our Infinite SEO plugin offers some powerful settings for customizing meta options for posts and pages on your site. The optimization tools\u00a0integrate into the editor for powerful control over how search engines display your content.<\/p>\n<p>Easily boost your site&#8217;s rankings with thoughtful titles, previews and meta information.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Infinite SEO?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/all-in-one-seo-pack\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Jetpack<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"195\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/jetpack1-600x195.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Jetpack image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>It&#8217;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.<\/p>\n<p>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.<\/p>\n<p>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!<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Jetpack?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/jetpack\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Dreamgrow Scroll Triggered Box<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"195\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/dreamgrow-600x195.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Dreamgrow Scroll Triggered Box image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>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.<\/p>\n<p>Use the box to promote a product, a free eBook tied to registration, or any other content you&#8217;d like.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Dreamgrow Scroll Triggered Box?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/dreamgrow-scroll-triggered-box\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Disqus Comment System<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"193\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/disqus-600x193.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Disqus Comment System image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>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&#8217;m using Disqus more and more throughout multiple websites and I&#8217;ve found it to perform very well.<\/p>\n<p>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.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Disqus Comment System?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/disqus-comment-system\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Arconix Shortcodes<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"195\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/arconix-600x195.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Arconix Shortcodes image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>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.<\/p>\n<p>it offers buttons, tabs, icons, accordions, message styles and so on.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Arconix Shortcodes?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/arconix-shortcodes\/screenshots\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Search And Replace<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"172\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/search-replace-600x172.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Search And Replace image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>Search And Replace is \u2013 not surprisingly \u2013 a plugin which allows you to search and replace within your website&#8217;s content. If you need to remove certain sections from your posts or you&#8217;d like to mass-correct a spelling mistake you&#8217;ve been making, this plugin is for you.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Search And Replace?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/search-and-replace\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Membership Pro<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"171\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/lock-600x171.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Membership Pro image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>Our Protected Content plugin allows you to setup\u00a0subscription-based protection for the content on your site. You can have free content just the same, but also hide\u00a0key posts, pages and other content behind a paywall.<\/p>\n<p>&nbsp;<\/p>\n<p>If you&#8217;re making premium quality content, this is a great way to earn some money without having to resort to advertising.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Membership Pro?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wpmudev.com\/project\/membership\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Print Friendly And PDF Button<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"195\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/printfriendly-600x195.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Print Friendly And PDF Button image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p><a href=\"http:\/\/www.printfriendly.com\/\" target=\"_blank\">Print Friendly<\/a> 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.<\/p>\n<p>The plugin allows to output the buttons to initiate the process on your posts and pages.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Print Friendly And PDF Button?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/printfriendly\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Add Meta Tags<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"193\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/add-meta-tags-600x193.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Add Meta Tags image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>This plugin also won&#8217;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&#8217;s what.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Add Meta Tags?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/add-meta-tags\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Polldaddy Polls & Ratings<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"195\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/polldaddy-600x195.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Polldaddy Polls &amp; Ratings image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>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.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Polldaddy Polls & Ratings?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/polldaddy\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">NextGEN Facebook<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"194\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/ngfb-600x194.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"NextGEN Facebook image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>The full name of this plugin is &#8220;NextGEN Facebook &#8211; Advanced Social SEO for Facebook, Google+, Pinterest, Twitter &amp; More&#8221; which is awesome if you review plugins and you are paid based on word count but is a bit of a mouthful otherwise.<\/p>\n<p>This plugin &#8211; among other things &#8211; 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.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in NextGEN Facebook?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wordpress.org\/plugins\/nextgen-facebook\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><\/ul><!-- end dev-tutorial-list -->\n<h2>Code Enhancements<\/h2>\n<p>Of course the built-in settings and plugins just scratch the surface of what&#8217;s possible. Adding the\u00a0snippets below to your theme\/child theme or plugin, you can achieve some granular modifications.<\/p>\n<h3>Redirect Single Search Result<\/h3>\n<p>I really like this one \u2013 thanks <a href=\"http:\/\/wpsnipp.com\/index.php\/functions-php\/redirect-to-post-when-search-query-returns-single-result\/\" target=\"_blank\">WP Snipp<\/a>! 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.<\/p>\n<p>This improves\u00a0user experience, which leads to all sorts of benefits, including better statistics.<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"redirect.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=redirect.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<h3>Pretty Links<\/h3>\n<p>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.<\/p>\n<p>When creating the link in the back-end make sure to add a class, something like <code>prettylink-wpmudev<\/code>. You can then add a snippet like this to your stylesheet:<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"icon-link.css\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=icon-link.css\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<div  class=\"wpdui-pic-regular  \">\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-138879\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/icon.jpg\" alt=\"link with icon\" width=\"584\" height=\"84\" \/><\/div>\n<\/div>\n<\/div>\n<h3>Auto-Link Text<\/h3>\n<p>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 <code>the_content<\/code> to modify the content of the post.<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"replace-content.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=replace-content.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>This snippet replaces strings with links within the post content. If you&#8217;d like to do this in the excerpts as well, add another filter which hooks into <code>the_excerpt<\/code>.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<h3>Display All Images for a Post<\/h3>\n<p>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.<\/p>\n<p>Let&#8217;s do the latter \u2013 build a gallery shortcode out of images pulled from the database:<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"images.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=images.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>A query is performed, we make sure to only pull attachments which are linked to the current post. I made sure to specify <code>fields =&gt; 'ids'<\/code> 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.<\/p>\n<h3>Insert Content Between Paragraphs<\/h3>\n<p>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 <code>the_content<\/code> and using some regular expression magic.<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"insert.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=insert.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>The key here is the <code>$matches<\/code> array. Increment the second number to add content after later paragraphs. <code>$matches[0][3][1]<\/code> will add your content after the fourth paragraph for example.<\/p>\n<h3>Create Your Own Shortcodes<\/h3>\n<p>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.<\/p>\n<p>Here are two examples:<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"shortcodes.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=shortcodes.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>The first shortcode \u2013 iconlink \u2013 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 &#8220;premium-wpmudev-org.&#8221;<\/p>\n<p>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 &#8216;[update_notice url=&#8221;http:\/\/newcontent.com&#8221;]&#8217; into the editor and you have your notice.<\/p>\n<h3>Add Old Post Notices Automatically<\/h3>\n<p>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 <code>the_content<\/code> yet again.<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"outdated.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=outdated.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>You&#8217;ll need to style this yourself, but with just three rules added it already looks nice in Twenty Fifteen:<\/p>\n<div  class=\"wpdui-pic-regular  \">\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-138891\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/outdated.png\" alt=\"Outdated Post Notice\" width=\"662\" height=\"331\" \/><\/div>\n<\/div>\n<\/div>\n<h3>Redact Sensitive Content<\/h3>\n<p>If you have some authors prone to swearing but you don&#8217;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.<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"redact.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=redact.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>We look for instances of frak and replace it with <code>&lt;span class=\"redacted\"&gt;karf&lt;\/span&gt;<\/code>. We can then style the <code>.redacted<\/code> 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.<\/p>\n<p>If you want to enable this for guest users only wrap all the code within the function in <code>if ( !is_user_logged_in() ) <\/code>.<\/p>\n<h3>Change Your Excerpt&#8217;s Length<\/h3>\n<p>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&#8217;s content using the <code>excerpt_length<\/code> filter. It&#8217;s easy, the following will double the length of the excerpt to 110 words:<\/p>\n<div class=\"gist\" data-gist=\"c7e2f87de267f66edcb7\" data-gist-file=\"excerpt-length.php\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/c7e2f87de267f66edcb7.js?file=excerpt-length.php\">Loading gist c7e2f87de267f66edcb7<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<h2>Conclusion<\/h2>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Posts and pages are the backbone of a WordPress environment. In this post we&#8217;ll take a look at some of the things you can do to make your posts and pages better using built-in WordPress settings, plugins and code.<\/p>\n","protected":false},"author":344049,"featured_media":139303,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[131,655,709],"tutorials_categories":[],"class_list":["post-138836","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-developers","tag-pages","tag-premium-plugins"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/138836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/344049"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=138836"}],"version-history":[{"count":4,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/138836\/revisions"}],"predecessor-version":[{"id":218983,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/138836\/revisions\/218983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/139303"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=138836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=138836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=138836"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=138836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}