Help for a WordPress Site - Removing "Read More"

nuni

Active Member
I need your help. I was looking and searching the network, but could not find any solution.

I want to remove "Read more" in the posts, because I make something like a static site and I need to display all the information on the whole page.

If some one could give me a hand, I will be really happy.
 
Последно редактирано от модератор:

Torbalan Trolski

Well-Known Member
Removing "Read More" in WordPress Site

Where do you want this - on the front page or in your archives?

It depends on the theme, does it use the_content() or the_excerpt().
Also depends on does it have <!--more--> tags in the posts.

Could not help you a lot if you don't know which is the WordPress theme you are working on.
 
Последно редактирано от модератор:

Torbalan Trolski

Well-Known Member
Remove 'Read-More' Link | How to remove "read more" link from custom post type

Well, obviously the theme is smthemes.com/wphotel.

in wp-content/themes create directory viva
in wp-content/themes/viva create file style.css със следното съдържание

Код:
/*
Theme Name:     Viva (wphotel Child)
Description:    Child theme for the wphotel
Template:       wphotel
Version:        0.0.1

*/
@import url("../wphotel/style.css");
Copy theloop.php from wp-content/themes/wphotel in wp-content/themes/viva

Find that code in wp-content/themes/viva/theloop.php

PHP:
				<?php
				//Post content
				if (!is_single()&&!is_page()) { 
					if ( ! post_password_required() ) { smtheme_excerpt('echo=1'); } else the_content('');
					?><a href='<?php the_permalink(); ?>' class='readmore'><?php echo $SMTheme->_( 'readmore' ); ?></a><?php
				} else {
					the_content('');
				}
And replace it with this:
PHP:
				<?php
				//Post content
				if (!is_single()&&!is_page()) { 
					if ( ! post_password_required() ) { 
						smtheme_excerpt('echo=1'); 
					} else {
						/* More tag start - if you don't have it  <!--more--> you don't need tags*/
						global $more;    
						$tmp_more = $more;
						$more = 1;
						/* More tag end -  if you don't have it  <!--more--> you don't need tags*/
						the_content('');
						/* More tag start -  if you don't have it  <!--more--> you don't need tags*/
						$more = $tmp_more;
						/* More tag end -  if you don't have it  <!--more--> you don't need tags*/
					}					
				} else {
					the_content('');
				}
If you don't use posts protected with a password, I suppose that's why you need if ( ! post_password_required() )
Could be much more easier.
PHP:
				<?php
				//Post content
				if (!is_single()&&!is_page()) { 
						/* More tag start - if your don't have  <!--more--> you don't need tags*/
						global $more;    
						$tmp_more = $more;
						$more = 1;
						/* More tag end - if your don't have  <!--more--> you don't need tags*/
						the_content('');
						/* More tag start - if your don't have  <!--more--> you don't need tags*/
						$more = $tmp_more;
						/* More tag end - if your don't have  <!--more--> you don't need tags*/
				} else {
					the_content('');
				}
The code is a little bit dirty hack and is not tasted, but it will do the job. You should know that you won't have Read More anywhere.

PS: Don't forget to switch the theme. :D
 
Последно редактирано:

Brum

New Member
Wow, the last one is great answer. Thanks for sharing it with us. Much more coding than what I can take. :)

A reputation was added. ;)
 

Горе