One place for hosting & domains


      How to Add Custom Fields to Your WordPress Posts

      As you become comfortable with WordPress, you may want to start pushing its boundaries. This means experimenting with some of the platform’s more advanced options, which includes learning how to create custom fields.

      Adding a custom field to your WordPress post enables you to assign extra data to it. In turn, this helps you add specific information or features only to particular posts. As an example, you could use a custom field to tell WordPress which of your posts are sponsored, then add some code to your theme file that will display a disclosure statement only on those posts.

      An Introduction to Custom Fields

      The WordPress Block Editor is pretty flexible by default and enables you to customize your content to the Nth degree. You can add just about anything you like to your posts. However, the more content you have, the more you may start wishing for better ways to organize and manage it.

      Custom fields are a somewhat more advanced WordPress feature that lets you add extra information to specific posts. That information is called ‘metadata’. Custom fields and metadata are of particular use to developers, who can use them to extend posts with all sorts of additional coding. However, they can still be beneficial for the more general WordPress users.

      For example, let’s say you wanted to indicate which of the posts on your blog are sponsored to ensure you’re being transparent with your audience. You could add a short disclosure statement to each relevant post individually. Alternatively, you could save time by using a custom field that displays a relevant message. Then, you could add code to your theme file to make your disclosure statement appear on the correct posts.

      If this sounds complex, don’t worry. Using custom fields is more straightforward than it looks. In fact, we’ll show you exactly how to implement this example below. If you’re interested in other potential applications for custom fields and metadata, you may also want to check out the WordPress Codex entry on the topic.

      How to Add Custom Fields to Your WordPress Posts (In 2 Steps)

      The concept of custom fields might seem a bit abstract, so let’s walk through an example to see exactly how this feature works in action. This general custom field process can be used for a wide variety of applications. You could add status updates to your posts, include a disclosure notice on sponsored content, and much more.

      However, you’ll first want to take a moment and back up your website. If you’re following these instructions, you’ll be implementing changes to your theme’s primary file, and you don’t want to risk making any permanent mistakes. For extra security, creating a child theme and using it instead of your base theme is also advisable.

      Step 1: Enable Custom Fields and Assign New Metadata to Your Post

      The first thing you’ll need to do is open up a post to which you would like to add a custom field. It can be an old post or a new one.

      Click on the three dots in the top right corner and select Preferences from the dropdown list:

      Accessing Preferences from the WordPress Block Editor

      Then, select Panels from the popup menu and enable Custom fields. You’ll now be prompted to Enable & Reload:

      Enabling custom fields with the WordPress Block Editor

      Now, if you scroll down below the post, you’ll find a new section:

      Adding custom fields to a post in WordPress

      Under Name and Value, you’ll add some metadata describing the information you want to add to this post. Depending on the themes and plugins you have installed, you may already have some options listed under Name. Regardless, you’ll want to create new metadata in this instance.

      Get Content Delivered Straight to Your Inbox

      Subscribe to our blog and receive great content just like this delivered straight to your inbox.

      Choose a name for your metadata. It can be anything, although it’s best to keep it short and descriptive. Continuing our example from above about displaying a disclosure statement on specific posts, we’ll call it Sponsored Post. Then we’ll add a simple “Yes” to the Value box, indicating that this particular post is sponsored:

      Click on Add Custom Field, and this metadata will now be assigned to your post. Don’t forget to save or update the post itself too.

      Step 2: Add Conditional Code to Your Theme File

      The previous step told WordPress a critical piece of information about your post: whether or not it is sponsored content. Now, you need to add directions so that your site knows what to do about that. As we mentioned earlier, this does involve a bit of coding. However, don’t let that scare you off. Even if you aren’t a developer, you should find the process relatively straightforward.

      Within WordPress, you’ll want to navigate to Tools > Theme File Editor. Here, you can look through and make changes to the files that make up your site. You’ll want to check out the sidebar on the right-hand side and find the Single Post file (also known as single.php):

      This is where you’ll add the code that will tell WordPress what to do in response to your custom fields. The exact code you’ll use will vary somewhat, depending on what you want to do. In our example, you’d want to add this snippet:

      $meta = get_post_meta( get_the_ID(), 'Sponsored Post' );
      if( $meta[0] == 'Yes' ) {
      <p>This post is sponsored content, and we received a free copy of the product in order to conduct our review.</p>
      <?php } ?>

      Then, click on the Update File button. This code tells WordPress to check and see if a post has the Sponsored Post custom field and if the value is set to “Yes”. If so, it will display the message. If there is no custom field or the Sponsored Post value is set to “No”, nothing extra will be added to the post.

      Also, where you place the code will determine when it appears in the post. For example, to get it to appear at the top of the page, you would add it before this line in the single.php file:

      while ( have_posts() ) : the_post();

      Hopefully, you are beginning to see how custom fields can be useful. There are a lot of possibilities when using this feature, so don’t be afraid to play around a little and see what you can accomplish with it.

      Using Plugins to Manage Your Custom Fields

      You now know how to add custom fields and metadata to your WordPress posts. However, what if you want to get more flexibility from this feature or just want to simplify the process?

      This is WordPress we’re talking about, so of course, there are plugins that can help you out. There may not be a lot of plugins related to custom fields, but you can find a few quality options. For a great example, check out Advanced Custom Fields:

      Advanced Custom Fields plugin.

      This very popular, free plugin streamlines the process of adding custom fields to WordPress. It also gives you more choices for where metadata can be added, such as users, media, and comments. Finally, it adds tools to provide more options for displaying custom field values within your theme files. There’s even a premium version with even more functionality.

      If that plugin seems like overkill — and it can be for non-developers — Custom Field Suite is a solid alternative:

      Custom Field Suite WordPress plugin

      This tool is essentially a lightweight version of Advanced Custom Fields. It adds a handful of useful new custom field types to your site. Plus, it simplifies adding and managing custom fields without overwhelming you with too many new options.

      This can be a smart plugin to start with if you’re looking to get more out of your custom fields. What’s more, you can always switch to a more robust solution once you feel more confident with the process.

      Add Custom Fields to WordPress Content

      Custom fields and metadata are concepts that might seem a smidge confusing at first. However, with time and patience, you’ll find that they enable you to get even more out of the WordPress platform.

      Want a Free Theme?

      When you host with DreamHost you get access to our WP Website Builder tool and more than 200+ industry-specific starter sites for free!

      custom website design

      Source link

      WordPress Posts: Here’s Everything You Need to Know

      Posts are one of the two main content types in WordPress, so it’s crucial to understand how they work. Along with pages, posts are your primary vehicle for creating content and sharing it with your visitors. This holds true even if you aren’t building a blog.

      In this beginner’s guide, we’ll explain what WordPress posts are and how they can be used. Then we’ll show you how to create, organize, and manage them. Finally, we’ll wrap up with a list of formatting tips to help you improve your posts. There’s a lot to cover, so let’s jump in!

      An Introduction to WordPress Posts

      top posts widget in WordPress

      Posts are an inherent part of any WordPress website’s blog.

      In WordPress, there are two main formats for creating content. The first is your pages, which are primarily static and will likely form the structure of your website. Typical examples include a site’s Home page, About page, Contact page, and so on.

      WordPress posts are similar in a lot of ways. You use the same editor to create them, and they can include text, media, and much more. However, they’re designed for more timely content. This is why they are so useful for blogs. They also work well for updates, news articles, and other types of new content published on a regular basis.

      Typically, posts are dated and listed in chronological order, and they’re organized using a system of categories and tags (which we’ll discuss soon). By default, the front page of your WordPress site will be a list of your latest posts, although you can change that static page if you’d like.

      You’ll find that posts are a versatile content type, capable of doing a lot on your site. What’s more, they’re easy to create and manage. Let’s go over the basics now.

      How to Manage Posts in WordPress (In 3 Simple Steps)

      Throughout the next few sections, we’ll discuss how to create posts, organize them, and manage them on your WordPress site. You’ll first need to log in to your dashboard before proceeding to the first step.

      Step 1: Create Your First Post

      To create a post in WordPress, navigate to Posts > Add New in your dashboard. You’ll find the WordPress editor, where you can design your post:

      WordPress create a new post

      Note that as of WordPress 5.0, the default editor is the Block Editor. Your screen may look a bit different if you’re using an outdated version of the Content Management System (CMS) or the Classic Editor plugin.

      You can add text by clicking in the text field (set the Paragraph block by default). When you add your text, a toolbar menu will appear along the top of the block with your standard formatting options:

      adding blocks of text in the WordPress post editor

      You can also select the Add Block button (the + icon) to insert other blocks, such as Heading, Image, and so on:

      Choose a block for your WordPress post

      If you want to rearrange the order of your content, you can simply drag and drop the blocks to place them in your preferred order.

      To the right, you’ll find a panel of settings and options, including Featured Image. Here, you can upload an image that will be used as the header for this particular post.

      At the top-right of the screen, you’ll notice settings for saving and publishing your post. You can save your post as a draft to work on later, schedule it to go live at a later time, or hit the Publish button:

      Publish your WordPress post

      In addition, you can use the Preview button to see what your post will look like on the front end of your site. It is always recommended to preview your post before you publish, so you can rapidly identify elements that need changing before it goes live.

      That’s the basics of creating and editing your WordPress posts. However, you’ll also want to make sure they’re neatly organized.

      Step 2: Organize Your Posts With Categories and Tags

      If you intend on publishing a lot of posts — for example, if you’re creating a blog or news site — you’ll want to keep them organized. If you don’t, both you and your readers may have a hard time sorting through the backlogs to find specific entries or topics of interest.

      WordPress provides two main features for organizing posts: categories and tags. Both can be added to a post on the editing screen:

      edit categories and tags in the WordPress post editor

      Assigning categories and tags to your posts is a way to sort them. Categories are generally high-level descriptors of a post’s topic. For example, if you run a health blog, you might have categories called “nutrition” and “fitness.”

      Tags, on the other hand, are words or short phrases that describe a particular post’s subject in more detail. If you write a post about how to start a running habit for your health blog, you might assign it tags such as “cardio exercise” and “running tips.”

      The biggest difference? Categories can be hierarchical, and tags cannot.

      It’s worth noting that you can see all of the categories and tags you’ve been creating by navigating to either Posts > Categories or Posts > Tags, respectively. In those screens, you can set up and optimize these elements before you ever use them in a post:

      edit categories for WordPress posts

      You should use categories and tags in a way that makes sense to you and your readers, although there are a few best practices to keep in mind. In general, it’s smart to stick with a handful of categories for your site and assign only one to each post. Then, each post can receive a handful of tags (we suggest two to five) to explain the topic.

      Above all, the number one rule for using these features is consistency. Having a few distinct categories and some descriptive tags is a perfect way to ensure that people can easily find posts that interest them.

      Get Content Delivered Straight to Your Inbox

      Subscribe to our blog and receive great content just like this delivered straight to your inbox.

      Step 3: Manage Your WordPress Posts

      Once you have some posts under your belt, you may need to manage them from time to time. If you head to the Posts tab in your dashboard, you’ll see a list of all your current entries:

      view all posts in WordPress

      You can use the links and drop-down menus at the top of the screen to sort through your posts by type, category, date, and so on. This is helpful if you’re looking for specific kinds of posts. Of course, you can also use the Search Posts box to find one in particular.

      If you hover over a specific post’s title, you’ll see a few additional options:

      edit your post in WordPress

      You can edit the post, view it, or send it to the trash to delete it. You can also choose Quick Edit, which will enable you to make a few basic changes without taking you to the full post editor.

      Finally, you may notice the checkboxes to the right of each post. If you select several posts, you can edit or delete them all at once by choosing the corresponding action from the Bulk Actions drop-down menu:

      use bulk actions for editing multiple WordPress posts

      Overall, you’ll find that this screen is handy when it comes to keeping track of your posts. You can see each one’s author, tags, categories, and published date, all without having to visit the posts individually. We recommend becoming familiar with the entire Posts tab since it can be a huge time saver.

      Tips for Formatting Your WordPress Posts Effectively

      We’ve now covered how to create posts in WordPress, keep them organized, and manage them over time. However, none of that tells you how to actually write and design your posts for maximum effect. The following tips should help you make them as accessible and reader-friendly as possible!

      Use Headings and Subheadings

      First, let’s return to the post editor within WordPress. The blog post title you enter will always be your Heading 1. When you insert the Heading block, you can choose subsequent headings (ranging from H2 to H6):

      style heading structure in WordPress block editor

      Headers are a smart idea for a variety of reasons. At the most basic level, they help to break up content, making it easier for readers to scan and understand.

      The Heading block comes with established formatting and a hierarchy. You can use the higher-level headers (with large, bolded text) for significant sections while reserving the lower-level options for subheadings.

      For instance, Heading 1 would be used for the title of a post, Heading 2 for main subheadings, Heading 3 for sub-subheadings, and so on. Just keep in mind that the exact formatting of these headers will depend on your theme.

      Additionally, using these header options is good practice for Search Engine Optimization (SEO). The way they’re coded communicates clearly to search engine bots how your posts are organized, helping the bots learn what they’re about and promote them to the right searchers.

      Finally, WordPress headers help you keep your post formatting consistent. For best results, determine a heading structure for your first post, then use a similar structure in future content.

      Apply Formatting Options Sparingly

      If you’ve ever used a text editing program on a computer, WordPress’ standard formatting options should feel pretty familiar. You’ll see basic choices such as bolding, italics, and lists:

      modify text styles in the WordPress block editor

      You can also use this toolbar to link and highlight text, as well as apply other formatting styles, such as subscript. It’s best to establish a consistent way to format your WordPress posts.

      For example, you may choose to use bold for emphasis and italics for website names and other titles. If you want to add more customization to the formatting, you can try experimenting with HTML.

      Keep Your Paragraphs Short

      In today’s digital world, people have a lot of content to choose from and sift through. To make yours stand out, you should start by ensuring that it’s easy to read. One excellent way to do that is through headers, which we’ve already discussed. Another is to keep your paragraphs short:

      WordPress platform

      Short paragraphs are a major aspect of writing for the web.

      Readers are drawn to content with lots of short, digestible paragraphs (especially when browsing websites). This makes content easier to skim and leaves plenty of white space.

      Avoid Walls of Text

      Have you ever heard of the dreaded ‘wall of text’? It is precisely what it sounds like — content that is line after line of unbroken text:

      the dreaded wall of text

      Walls of text can be difficult to read and off-putting to visitors. It will be a lot easier for them to lose their place or become overwhelmed and simply leave the site. To avoid this, you can break up text with other elements, both to give readers a break and provide extra value.

      Some of the ways you can break up walls of text within your posts are to use:

      • Bulleted and numbered lists
      • Images, videos, and other media
      • Block quotes
      • Social media callouts

      The best posts are usually a multimedia experience, so don’t be afraid to get creative! Even the most text-heavy content can be made reader-friendly with the strategic inclusion of some images and lists. Fortunately, WordPress formatting makes this process quick and easy.

      Start Creating WordPress Posts

      If you’re running a WordPress blog or news site, understanding how posts work is a necessity. However, even if your site has a different focus, posts can still come in handy. This flexible content type is easy to create, manage, and organize, so learning how to do those things should be one of your first goals.

      Do More with DreamPress

      DreamPress Plus and Pro users get access to Jetpack Professional (and 200+ premium themes) at no added cost!

      Managed WordPress Hosting - DreamPress

      Source link

      How to Update Your Old WordPress Posts With the Block Editor

      Since the Block Editor is now the default tool for creating new WordPress content, site owners are having to address the question of what will happen to their older posts and pages. This content will inevitably need updating since the Classic Editor plugin won’t be around forever.

      Fortunately, there are methods in place for handling this exact situation. If you need to make changes to an old post, you can easily do so without any help from the Classic Editor. This makes it much easier to bring your old and new content into alignment.

      In this post, we’ll discuss the Block Editor (you might know it by its nickname: Gutenberg) and then we’ll show you two methods for updating your old posts using this new tool. Let’s get started!

      Understanding the Differences Between the Classic and Block Editors

      For many years, WordPress users created new content for their websites in a visual editor, now known as the Classic Editor. It consisted primarily of one large field where you could add text, images, and other media.

      The WordPress Classic Editor.

      The main downside to the Classic Editor was that some elements — such as tables and content columns — required coding or extra plugins to implement. This arguably made the publishing process more complicated and time-consuming than it needed to be.

      To address that issue, the Block Editor was created. It enables you to use a system of ‘blocks’ to create content in WordPress. Each block holds a specific type of content, such as a paragraph, an image, a table, a list, or just about any other element you might want to add to a post or page.

      The WordPress Block Editor.

      With blocks, WordPress users can create more complex content without the need for coding. Each block has individual settings so you can customize specific elements. Additionally, you can more easily move content around the page to create columns or other unique layouts.

      Generally speaking, the Classic Editor is considered the ‘simpler’ of the two options because of its interface. There’s just one field where all of your content goes, as opposed to many separate blocks. However, the Block Editor is built for ease-of-use and can be more user-friendly — especially for those new to WordPress.

      Get More with DreamPress

      DreamPress Plus and Pro users get access to Jetpack Professional (and 200+ premium themes) at no added cost!

      Switching Over from the Classic Editor to the Block Editor

      The Block Editor has been ‘live’ since December 2018 and now serves as the default editor for anyone running WordPress 5.0 or later. However, some users have chosen to disable it in order to continue using the old – or Classic – editor.

      If you’ve been using WordPress for some time and are familiar with the Classic Editor, using the Block Editor may not seem very appealing. After all, it still has compatibility issues with some plugins and themes, and learning a new interface isn’t the most fun way to use your time.

      However, there are a few reasons to embrace the change. To start with, the Block Editor should streamline your content creation. Once you get past the learning curve, adding blocks can be much faster than stopping to code a table or columns by hand. More importantly, you may want to make this transition for the sake of your site in the long term. While right now you can keep the Classic Editor in place using a plugin, WordPress plans to stop support for that system eventually.

      For now, support is promised until 2022. However, once updates are no longer being released, having this plugin installed on your site could pose a security risk. At a certain point, moving over to the Block Editor will be in the best interests of your website.

      What the Block Editor Means for Your Existing Content

      Fortunately, old posts and pages created in the Classic Editor are preserved in their current format with the Block Editor. Each one features a single, large block called a Classic block. All of your text, images, and other content will be found inside this block, unchanged.

      A Classic block in the WordPress Block Editor.

      The Block Editor’s effect on your theme and plugins is a little more complicated. There have been compatibility issues between the new editor and some themes and plugins, so it’s possible that enabling it will cause problems on your site.

      In particular, page builders and other plugins that affect the way the WordPress editor looks and functions tend to have trouble with the Block Editor. However, updates have been released for many of these plugins to fix these issues. It’s a good idea to check each of your major plugins (especially any that affect the editor) to see if they are compatible.

      The Block Editor should be useable with just about any theme. That said, it works better with some than with others. Ideally, you’ll want to use a theme that has been updated for use with the Block Editor or a theme that was created after the new editor’s release and built with compatibility in mind.

      The best way to avoid any potential issues is to create a staging version of your site. Then you can thoroughly test for any problems before updating your live site.

      How to Update Your Old WordPress Posts With the Block Editor (2 Methods)

      Of course, you may not want to leave your old WordPress content as-is. Fortunately, you can update your old posts, pages, and other content types in the Block Editor. There are two primary methods you can use, and each has its pros and cons.

      Before you can use either of them, you’ll need to make sure you have the Block Editor enabled. For most sites, this is already the case.  In other words, if your site is up-to-date and you haven’t done anything to disable the Block Editor, it should be currently active. Therefore, you won’t need to do anything.

      Otherwise, either deactivate the Classic Editor plugin or upgrade to WordPress 5.0 or above to automatically switch your site over to the new editor. Then, you can use one of the following two techniques to work on your existing content.

      Method 1: Continue Editing Your Posts in a Classic Block

      As we described earlier, existing posts and pages will be converted into Classic blocks. If you want, you can edit your content inside these blocks, just as you would in the Classic Editor.

      All you have to do is open the post you wish to update, and click on the Classic block. When you do, you’ll see the TinyMCE toolbar appear at the top of the block. It should look very familiar.

      A Classic block in the Block Editor with the TinyMCE toolbar.

      You can edit within this block exactly as you would in the Classic Editor. If you need to access the Text Editor, you can do so by clicking on the three-dot icon to the right of the toolbar, and selecting Edit as HTML.

      The Edit as HTML option in the Classic block.

      When you select this option, the block’s content will be shown as code, and you can edit it as needed.

      Editing a Classic block in HTML.

      To return to the Visual Editor, simply click on the three-dot icon again and select Edit Visually. That should be all you need to update your old posts using the Classic block.

      Method 2: Convert Your Old Content into Blocks

      The other option you have available is to convert a post or page’s Classic block into new blocks. This will divide up your content up into individual elements, just as if you had created it using the Block Editor.

      To do this, click on the three-dot icon and select Convert to Blocks.

      Selecting the Convert to Blocks option in a Classic block.

      Your post should then split up into separate pieces. Each paragraph will become its own block, as will every heading, image, list, video, button, and element.

      An old Classic Editor post converted into new blocks.

      You can click on an individual block to edit the content within it. While this process usually goes off without a hitch, you’ll want to make sure that each element of your post has converted to the correct type of block.

      For example, if a pull quote from your old post has converted into a regular paragraph block, you can change it by clicking on the leftmost icon in the block toolbar.

      The Change Block Type option in a block.

      You can then select the correct block type from the options listed. Once all of your blocks are set to the correct types, you can use the toolbar at the top of each to make any specific changes related to alignment and placement within the post. You can also make edits related to each block’s type, such as by altering text styling or image size. In other words, you can now use the Block Editor’s full range of capabilities to work on your content.

      New Kid on the Block (Editor)

      Updating old posts is a smart way to freshen up your content and give your site a facelift. If you’re worried about how your old posts will fare in the age of the Block Editor, however, never fear. You can easily make changes to your old posts and pages.

      While you’re updating your WordPress site, why not upgrade your hosting service too? Our DreamPress plans include 24/7 WordPress support to help with all your Block Editor questions.

      Source link