How To Create A Read More Toggle In Posts

If you would like to use a Read More Toggle in your post template, to display long content, credits, or other uses, all from the WP Block Editor for users and clients, you may do so using a Custom Field. In this example we will use the free version of Advanced Custom Fields. You may download this from the WP repository,  

Let’s Get Started

Follow along below. For this tutorial we will be leaving the default settings on most options for now. These can be modified later for more advanced customization.

Creating A Custom Field

  1. Create a new custom field group (example: Read More).
  2. Create one custom field (example: Read More Content).  Give this a unique Field Label. The Field Name should auto generate. This will be the permalink key.
  3. Select the WYSIWYG editor from the Field Type dropdown.
  4. Fill in a description and other requirements here. For your first one, it is safe to leave everything below the field type dropdown at the default. These can be modified as needed later.
  5. Publish your custom field by clicking the blue button in the grey right column.

Note: If the Label Name or Field Name is edited at a later time, you will need to re-link it as shown in the Single Post steps below.

Create New Post(s)

Create at least one new post in order to populate the custom fields for the next step. You will see your custom field editor at the bottom of the block editor content. You may use this just like the classic editor and insert text, headings and media. Publish or update your post(s).

Create Or Edit Your Single Post Template

In your single post template, insert a Toggle Widget just below the Post Content Widget. Set the description to the dynamic ACF field (example: Read More), by using the small dynamic icon , and in the settings we will choose the key we named in our steps above (example: Read More Content). Publish or Update your Single Post Template with the correct display conditions. For more info about the Single Post Template click here

View The New Post(s)

If you have gotten the steps correct you will now see the Read More Toggle in your posts. You may edit the Single Post Template from the admin bar for further styling modifications.

在社交網絡上分享它

今天開始使用Elemenor

加入數百萬專業人士,使用Elementor更快、更好地構建WordPress網站

本頁內容