Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #1337749

    Dear Support-Team,

    is it possible to set a default or standard excerpt for all posts? I tried it in a child theme in loop-index.php but with no success. I thought I could alter the following line:

    $current_post['content'] = $blog_content == "content" ? get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"></span>') : get_the_excerpt();

    But it seems to be not the right way to simply get rid of get_the_excerpt(); and write something else. Or am I doing something wrong? Would be happy to get an advice form you. Thanks!


    Well – it depends.
    Some listings will use f.e. the postslider.php for generating the posts shown.
    On postslider.php we got this switch what to do in case the $expert is not empty ( Well, that’s a real Freudian slip – sorry ). ( arround line 980 formulated as a ternary operator )

    $output .= ! empty( $excerpt ) ? "<div class='slide-entry-excerpt entry-content' {$markup}>{$excerpt}</div>" : '';

    ternary operators are constructed like this:
    Output = Condition ? (true) output1 : (false) output2

    that means if excerpt is empty – the output will be: ” (empty) and no markup will be added !
    what if you change that to:

    $output .= ! empty( $excerpt ) ? "<div class='slide-entry-excerpt entry-content' {$markup}>{$excerpt}</div>" : "<div class='slide-entry-default-excerpt'>Here comes a default excerpt</div>";

    ________ now we can have a child-theme postslider.php with that. : see how to on docu

    see here a result of a blog page with ( a styled ) Grid-View:
    In the code, I have only highlighted the text “Standard excerpt” in bold.

    on masonry with showing the excerpt it is a bit different – so better would be to link to the page where you like to have that.

    • This reply was modified 1 year, 8 months ago by Guenni007.

    That sounds interesting, Guenni007. Will try that for sure. In an other thread I read an alternative soloution for my atempt. One of them will work for sure. Thanks!

    Und viele Grüße nach Bonn.


    Danke – übrigens das hier: ist schade, dass es schon zu ist.

    Wie man ein Child-Theme ALB Element etabliert weisst du? – Doku
    Man kann aber auch – indem man ein original script auslädt und dafür eher dann ein Child-Theme script an dessen stelle lädt dieses ersetzen.
    Das Script um das es in diesem Fall geht ist: avia-snippet-sticky-header.js und befindet sich im Unterordner js.
    Diesen Hierarchiebaum, würde ich im Child auch beibehalten. Heißt auch einen Unterordner “js” im Child-Theme folder erstellen und dort die Kopie des Scriptes ablegen. – Soweit so gut.
    Das Ausladen des Elternscriptes und laden des Child-Theme scriptes:
    ( in die child-theme functions.php dieses Snippet )

    add_action( 'wp_enqueue_scripts', 'wp_change_sticky_header_script', 100 );
    function wp_change_sticky_header_script() {
       wp_deregister_script( 'avia-sticky-header' );
       wp_enqueue_script( 'avia-sticky-header-child', get_stylesheet_directory_uri().'/js/avia-snippet-sticky-header.js', array('avia-default'), $vn, true);

    In dieses Script gehst du nun und änderst ( im neuesten Enfold ist es auf Zeile: 76)

    if( shrinking && ! isMobile )


    if( shrinking )

    Das ware es dann auch.


    Bessere Lösung als mit dem Script. Danke dir!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How to set a standard excerpt?’ is closed to new replies.