KalvinOne
KalvinOne

Reputation: 3

Remove content after <!--more--> tag

I'm trying to show at the category page only the content of the post that is before the <!--more--> tag. I'm using the latest Wordpress version.

In other words the structure will go like this

Content

<!--more-->

Content I want to be removed and only shown if the single post is displayed.

I've already got rid of the "Read More" link, and I've already tryed to use CSS and display:none; but none of those works fine

The code generated by wordpress is the following

                    <h2 class="entry-title"><a href="http://localhost/post/" title="Permalink to post" rel="bookmark">Post Name</a></h2>  
                    <div id="chan" class="blanco">Content Shown</div>
                    <p><span id="more-50"></span>Post description.</p>

At the index.php I've managed to make it work since it shows the link and not the content itself, however in the page.php doesn't work.

Thank you very much in advance!

Upvotes: 0

Views: 357

Answers (1)

Patrick Moore
Patrick Moore

Reputation: 13344

<?php the_content(); ?> will output the content, trimmed to just before the <!-- more --> tag, if the tag is used.

From the codex:

If the quicktag <!--more--> is used in a post to designate the "cut-off" point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!--more--> quicktag point on non-single/non-permalink post pages.

Upvotes: 1

Related Questions