1

I know how to add the more-link in the post editor to show the excerpt of post instead of the full post. In this method excerpts created automatically.

If I want to manually enter the excerpt I have to use the field excerpt (after showing it from screen options). I expected excerpt will be shown on front page like the method above, but instead the excerpt is shown over the full post, both are displayed !!

I need the manual excerpt (like in method 2) but to display only the excerpt on the front page without the full post.

How to achieve that (without coding if possible) for the end-user?

Notes: * I'm using the latest version of WP (4.4.2). * Theme used is "Twenty Sixteen". * Default plugins only are installed.

  • $post->post_excerpt holds the manually entered excerpt if that's what you're referring to. So you can check if that is / isn't empty and display it accordingly. – Howdy_McGee Feb 10 '16 at 17:55
  • If I understand well, you want always (method 1 and/or method 2) the excerpt showing and never a full posting on the front page. – Charles Feb 11 '16 at 1:14
  • @Charles Yes i want the custom excerpts only without the full post on the front page. – Emad Fathy Feb 11 '16 at 1:18
  • This video tutorial shows the straight forward behavior which I expect but this never happened. It always shows the excerpt on the top of the full-post in front-page/index/home. (3:45 to 4:25) youtube.com/watch?v=nS-3kC9VC4A&t=3m45s – Emad Fathy Feb 11 '16 at 2:06
1

You can use has_excerpt() for this, which checks whether the post has a manually set excerpt. The sample code below uses this function:

<?php if ( has_excerpt() ) : // Only show custom excerpts not autoexcerpts ?>
    <span class="entry-subtitle"><?php echo get_the_excerpt(); ?></span>
<?php endif; ?>
0

Found out a quick and easy way to fix it.

Follow these instructions:

  1. Create a new post
  2. Do not introduce anything at the "Excerpt" field (in fact, disable Advanced Editing)
  3. Write your post
  4. Introduce the following tag <!--more--> at the place where you want the text to break

And there you have it!
Your post should now have something like (more...) or (read everything...) at the place where you included the tag. I am assuming you are still running wordpress with the php the_content tag in place.

If you want to change what's inside the brackets, just go to Presentation>Theme Editor and edit the Main Template, and then find the_content tag and change it to something like:

<?php the_content(__('(hey! Why not read the rest of this message, since you got this far?)')); ?>

Hope this helps.

Cheers.

  • Sorry, I didn't ask about customizing the read-more link. Please reread the question. – Emad Fathy Feb 10 '16 at 17:24
  • Can you please explain – Vasim Shaikh Feb 10 '16 at 17:27
  • I want to help you but can't understand – Vasim Shaikh Feb 10 '16 at 17:30
  • Manual / Custom excerpts is displayed on the front-page on the top of the full post. I need to display the excepts only (without the full post) on front-page. – Emad Fathy Feb 10 '16 at 17:33
  • ... on front page no content am i right – Vasim Shaikh Feb 10 '16 at 17:35
0

You've got the most useful part to your answer from Vasim with $post->post_excerpt. Then you need a test of the type of page you're in, i.e. if in single post show the post's content, if in index or archive, show only the post_excerpt.

0

First of all, did you create a child theme? Because doing this in a Parent theme the changes will be 'lost' as soon it will be updated!

Steps to take:

  • Assuming you have a child theme or else you create one like shown here.
  • Create also a folder in that child-theme named template-parts
  • Copy following 2 files into that folder(from the parent template-parts folder): content.php and content-single.php
  • Open content.php and you see:
  • line 27 the_content( sprintf( Remove this line or add // in front of it
  • line 28 __( 'Continue reading bla bla, Remove it or add // in front of it
  • Line 29 get_the_title() Add a semicolon behind it like this get_the_title();
  • Line 30 ) ); Remove it or add // in front of it
  • Save this file now
  • Open content-single.php
  • On line 16 you see <?php twentysixteen_excerpt(); ?> Remove this line or do like this <?php //twentysixteen_excerpt(); ?> (Add 2 backslashes)
  • Save this file now

Now you activate in the admin panel Tab Appearance/Themes the child-theme you created.

If I have been correct and you did as shown, you have what you want :)
From now on add/edit all you want in functions.php and style.css IN that child-theme (and of course you can add other files also in that child-theme

Note: I have made just a quick test with changes as shown, but...if some still is messing up, let it know.

Cheers

-1

For the record and for anyone who comes next.

I found the issue. Although the excerpts is a native WordPress feature it is not supported -in the right way- by the "official" "pre-installed" themes like the twenty-xxx series.

Not Supporting (in the right way) a native feature isn't a common sense!!! It is a bad behavior of the official theme to display the excerpt above the full-post!!.

Excerpts supported correctly by some third party themes like FlatBox: https://wordpress.org/themes/flatbox/

For whom tried to help me I appreciate your effort and thank you.

  • You realize that you try to proof your right with contradictions I hope. Try to explain to yourself how some can be displayed in a theme although it is - in your opinion - not supported by that same theme. Quote: displaying the excerpt above the full-post /End quote. Means imho that it IS supporting the excerpt. No offence but your answer here shows only lack of knowledge from your side in this case. – Charles Feb 19 '16 at 23:29
  • I didn't try to proof I'm right with contradictions. When i told "not supported" I meant not supported in the right way, or in common sense way, and I explained later it is not common sense to display the excerpt above the full post. About the lack of knowledge, OK, everyone who asks any question already lacks some knowledge, that's why he asks! I made little modifications to clarify any ambiguity that may exist. – Emad Fathy Feb 20 '16 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.