E
E
EnnX2021-07-22 16:26:39
WordPress
EnnX, 2021-07-22 16:26:39

How to display a preview of verses in the Reboot Wordpress theme without removing tags, in quatrains?

Hello dear WordPress pros!
Who can help with this problem? On the site https://stihi.blacksea-studio.ru it is necessary to display a preview of poems with the preservation of tags, that is, quatrains.
As I was told in the support service, in order for the tags in the publication cards not to be deleted, it is necessary to publish excerpts manually, but this option does not suit me, since there is a lot of work to be done.
I found the Advaced Except plugin for automatically generating excerpts, but apparently it conflicts with the theme, and the excerpts are displayed in solid text (as on the Home page). WordPress works with the standard output, but the verses are displayed clumsily, as in the section https://stihi.blacksea-studio.ru/lyubimomu-muzhchine
How can I make this plugin work with the selected topic on the Main page and how to display previews of poems in headings similar to the Main page, but with quatrains and page pagination?
I would be grateful for the answers!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2021-07-24
@artzolin

You can leave only the first paragraph in the passages, but your quatrains will still have to be reduced to the same form (those that go in solid text)

add_filter( 'wp_trim_excerpt', 'first_paragraph_excerpts', 99, 2 );
function first_paragraph_excerpts( $excerpt, $raw_excerpt ) {
  if ( is_admin() )
    return $excerpt;
  
  if ( '' !== $raw_excerpt )
    return $excerpt;
  
  $content = apply_filters( 'the_content', get_the_content() );
  return substr( $content, 0, strpos( $content, '</p>' ) + 4 );
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question