Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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!)

    Screenshot

    Example:
    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!

    #592550

    Hi 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,
    Ismael

    #592632

    OMG you overestimate my PHP knowledge :-(

    how should I “write” this code within the loop-index.php please?

    #594223

    Hey!

    Above that line, add something like this:

    $excerpt2 = get_the_excerpt();
    echo $excerpt2;
    

    Edit the post, add the summary in the Excerpt module.

    Cheers!
    Ismael

    #610351

    thank 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.

    #610555

    Hi!

    Great! Let us know if you need anything else. :)

    Regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How to: show manual exerpt above single post's content’ is closed to new replies.