banner



How To Remove Read More In Wordpress

In this article, nosotros'll show you how to edit the Read More push button in WordPress and create post excerpts. Equally with most customizations, the way you customize the Read More link depends on your WordPress version and theme. The examples in this commodity are using WordPress version 4.8 with the 20 Seventeen theme.

Note : Some of the customizations explained in this article crave you to edit WordPress configuration files. Always brand backup copies of files earlier editing.

Information technology's besides best do to only make one change before each examination of your site, so if an error occurs, yous'll know the most recent modify likely caused it. At that place are 3 methods you lot can utilise to edit files:

  • Some files can be edited straight in WordPress. Log in to WordPress via the HostPapa Dashboard. Go to Advent > Editor . Locate the file, then click the file proper name to open it in the editor.
  • If the file you lot demand to edit isn't available in the WordPress dashboard, yous can download it using an FTP client , then edit it with your preferred text editor. When you've made the changes in the file, save and upload information technology.
  • Yous can also edit the file in the cPanel File Managing director .

About WordPress excerpts

A WordPress excerpt is a post summary or teaser displayed on your site'due south home page, athenaeum, categories, and site search results. The excerpt should allow your reader know what the post is about and entice them to read the full text. A Read More link is displayed at the bottom of the extract, and when clicked, the entire postal service is opened on its own page.

Creating excerpts

There are three ways to create mail excerpts:

  • Manually inserting a Read More tag in the post
  • Automatically creating an extract from the first 55 words of the post
  • Manually adding a custom excerpt in the WordPress editor

The first method, inserting a Read More tag, is the simplest and most common, so let's start there.

1. Insert a Read More tag

When you're writing or editing a post in the editor, you lot tin can insert a Read More tag at any indicate in the post. This method allows y'all to choose which posts have excerpts, and y'all can make the excerpt any length you want.

  1. If you're using the Visual editor, place your cursor at the end of the text that you desire to be the excerpt.
  2. Click Insert Read More tag in the toolbar. A dashed line and 'More' is displayed at the end of the excerpt.

3. If y'all're using the Text editor, place your cursor at the stop of the text you want to be the extract and click more . The more tag is inserted at the end of the excerpt.

The published post displays only the excerpt on your home page, with a link to view the total postal service. In this case, the link text is Continue reading .

2. Automatically create excerpts

The 2d method automatically creates and displays excerpts from the first 55 words of all posts. This method requires editing configuration files and an understanding of template tags, so brand sure you lot have backup copies of the files before you begin. For more information, see the_content and the_excerpt in the WordPress Code Reference.

To automatically create excerpts, you lot demand to supervene upon the the_content template tag with the the_excerpt template tag in your theme template files. The files you need to edit depends on the theme you lot're using, only it'south oft index.php , athenaeum.php , and category.php . Check your theme'southward help documentation for more information.

3. Manually add a custom excerpt

This method displays an excerpt manually added in the Excerpt field in the post editor.

  1. To utilize this method, y'all get-go need to replace the the_content template tag with the the_excerpt template tag in your theme template files, as described in the Automatically create excerpts method above.
  2. Then, write your excerpts in the Excerpt field below your mail service in the WordPress mail editor. If the Extract field is empty, an excerpt is automatically created using the kickoff 55 words of the post.

The default Read More than link text depends on the theme you're using on your site. In our example, it's 'Proceed reading.' If you want to change the default text, there are a few means to do it, depending on how you create excerpts and whether you want the aforementioned link text for all excerpts.

Change the default Read More text for excerpts

You lot can change the default Read More link text by adding the post-obit lines of lawmaking to wp-content/themes/[your_theme]/functions.php :

part modify_read_more_link() {  return '<a form="more than-link" href="' . get_permalink() . '">Your Read More Link Text</a>'; } add_filter( 'the_content_more_link', 'modify_read_more_link' );

Change Your Read More Link Text to the text y'all desire to display. In our example, we changed it to Click for more than, and our excerpt at present looks like this:

Note: This code will not work if you lot're using a child theme and the parent theme has its own 'read more than link' filters. In that example, you'll need to add a remove_filter() role to remove the parent filter. For more information, see Modify the Read More than text when using the the_excerpt()

Change the Read More than text for automatically created excerpts

If you automatically create excerpts using the the_excerpt tag, add the following lines of code to wp-content/themes/[your_theme]/functions.php and change Your Read More Link Text to the text yous want to display.

function new_excerpt_more($more) {  global $mail service;  return '<a form="moretag"   href="'. get_permalink($postal service->ID) . '">Your Read More Link Text</a>'; } add_filter('excerpt_more', 'new_excerpt_more');

Note : This code will not piece of work if y'all're using a child theme and the parent theme has its own 'read more than link' filters. In that instance, you'll need to add a remove_filter() office to remove the parent filter. For more data, come across Change the Read More text when using the the_excerpt() .

Utilize custom Read More text for private excerpts

Instead of having the same Read More link text on every excerpt, yous can add custom link text directly from the WordPress editor.

Note : Use this method but if y'all didn't add together code to functions.php as described in the previous ii methods.

  1. When yous're writing or updating your post, open up the Text editor.
  2. Locate the <!–more–> tag.
  3. Add your link text subsequently <!–more. In our example, we added Click here for the exciting decision.

The published excerpt now looks similar this:

Disabling scrolling past the excerpt in the full post

By default, when you click the Read More than link in an excerpt, the full post, including the excerpt, is displayed, with the web browser automatically scrolling to the starting time of the text immediately later the extract.

To prevent this scrolling, add the post-obit lines of code to wp-content/themes/[your_theme]/functions.php.

function remove_more_link_scroll( $link ) {  $link = preg_replace( '|#more than-[0-9]+|', '', $link );  render $link; } add_filter( 'the_content_more_link', 'remove_more_link_scroll' );

Removing the excerpt from the total post

When you lot click the Read More than link in an extract, the full mail is displayed including the excerpt. Nonetheless, if you don't desire excerpts to be displayed with the full posts, at that place are two ways of removing them:

  • Add a <!–noteaser–> tag to the post.
  • Edit post templates to remove all excerpts from posts.

Add a <!–noteaser–> tag to the mail

Apply this method if y'all create excerpts in the WordPress editor and y'all desire to remove excerpts from some full posts.

  1. When yous're writing or updating your post, open the Text editor.
  2. Locate the <!–more–> tag.
  3. Immediately post-obit it, add together <!–noteaser–>. It should await like this:

When you publish or update the post, the excerpt won't be displayed with the total post.

Edit post templates to remove all excerpts from posts

Use this method to remove all excerpts from all total posts automatically.

  1. Open up your mail service template file. The file'south name depends on the theme you're using only could exist mail.php, index.php, or like. In our example, it's mail-template.php.
  2. Locate this line:

function the_content( $more_link_text = null, $strip_teaser = simulated) {

3. Change false to true.

function the_content( $more_link_text = null, $strip_teaser = true) {

Excerpts will no longer be displayed with full posts.

More information

For more information about template tags and customizing how dates and times are displayed, see the post-obit WordPress documentation topics:

  • Excerpt
  • Template Tags
  • Customizing the Read More

If you need assist with your HostPapa business relationship, delight open a support ticket from your dashboard.

Source: https://www.hostpapa.com/knowledgebase/customize-wordpress-read-link/

0 Response to "How To Remove Read More In Wordpress"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel