Tagged: blog posts, excerpt, loop-index.php
-
AuthorPosts
-
January 28, 2022 at 3:40 pm #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!January 31, 2022 at 7:16 pm #1338077Well – 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) output2that 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: https://webers-testseite.de/blog/
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 2 years, 10 months ago by Guenni007.
February 2, 2022 at 11:05 am #1338415That 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.
February 20, 2022 at 7:38 am #1341455Danke – übrigens das hier: https://kriesi.at/support/topic/set-transparent-header-as-default-header-style/#post-1341443 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 )
in:
if( shrinking )
Das ware es dann auch.
February 21, 2022 at 11:13 am #1341607Bessere Lösung als mit dem Script. Danke dir!
-
AuthorPosts
- The topic ‘How to set a standard excerpt?’ is closed to new replies.