-
AuthorPosts
-
February 26, 2016 at 3:48 pm #589855
Hi,
I must say in advace: I know a bit CSS, but not really PHP, so if someone could please help me out with this:
I would like to show directly above a single post’s content
- the manual excerpt, if there is any
- if there is NO manual excerpt, show/do nothing (no automatic excerpt should be shown!)
Example:
The CSS styling of this manual excerpt on top of a post’s content is something I will be able to do for my own.
But I don’t know how and where to “call” this code snippet in PHP.I found in another theme (not ENFOLD) this part of code, but I cannot “translate” this for showing it in ENFOLD:
<?php // Output manual excerpt if it's not empty if ( $ti_option['single_manual_excerpt'] == true && has_excerpt() ) { // If post has pagination using the <!--nextpage--> short tag, output the excerpt only on the first page if ( $paged == 1 || $page == 1 ) { echo '<div class="manual-excerpt">' . get_the_excerpt() . '</div>'; } } ?>
Note: I’m using the elegant blog layout!
Could anyone help me please?
Appreciate it, thank you!March 3, 2016 at 11:07 am #592550Hi COLORIT!
Thank you for using Enfold.
Edit the includes > loop-index.php file, look for this code around line 150:
$content_output = '<div class="entry-content" '.avia_markup_helper(array('context' => 'entry_content','echo'=>false)).'>'; $content_output .= $content; $content_output .= '</div>';
Above that code, you can add the custom excerpt. Use a custom field or add the get_the_excerpt function: https://codex.wordpress.org/Function_Reference/get_the_excerpt
Best regards,
IsmaelMarch 3, 2016 at 2:57 pm #592632OMG you overestimate my PHP knowledge :-(
how should I “write” this code within the loop-index.php please?
March 7, 2016 at 11:54 am #594223Hey!
Above that line, add something like this:
$excerpt2 = get_the_excerpt(); echo $excerpt2;
Edit the post, add the summary in the Excerpt module.
Cheers!
IsmaelApril 8, 2016 at 5:59 pm #610351thank you, with the help of a friend I worked it out with this, if someone needs this, too:
// show manual excerpt only if there is one if ( is_single() ) { if ( $post->post_excerpt ) echo '<div class="manual-excerpt">' . get_the_excerpt() . '</div><div class="hr hr-short hr-center avia-builder-el-9 el_after_av_textblock avia-builder-el-last "> <span class="hr-inner "> <span class="hr-inner-style"></span> </span> </div> '; }
The CSS for this is:
.manual-excerpt { color: #8c919b; font-family: Oswald; font-size: 16px; letter-spacing: 1px; }
I’ve added a line below it, to separate the excerpt better from the rest of the content text.
Result:Thanks, Ismael, for pointing me into the right direction.
April 9, 2016 at 12:28 pm #610555 -
AuthorPosts
- The topic ‘How to: show manual exerpt above single post's content’ is closed to new replies.