• Hi,
    first of all, your plugin is great!
    But I have a problem with the “read more”.
    The shortcode is like this:
    [display-posts wrapper="div" wrapper_class="display-posts-listing image-left " include_excerpt="true" image_size="thumbnail" posts_per_page="10" excerpt_more="Read More" excerpt_more_link="true" excerpt_length="10" post_title_as_h2="true" ]

    and the generated code is like this:
    <span class="excerpt">Hier kommt der Beschreibungstext hin <a class="excerpt-more" href="https://localhost/antikleben/bank/">Read More</a></span>
    But I want to have the readmore-link in a new line an styled like a button. So I cannot use display:block for the a-tag.

    I found in the plugin display-posts-shortcode.php line 541
    $more = $excerpt_more_link ? ' <a class="excerpt-more" href="' . get_permalink() . '">' . $more . '</a>' : ' <span class="excerpt-more">' . $more . '</span>';
    If I can add a <span> I can style it like I want to.
    But how can I do an override for this?

    Thank you
    Nadja

Viewing 1 replies (of 1 total)
  • Luis Colome

    (@luiscolome)

    Hi there @nadjal77,

    You can use the output filter, just adding the variable $more and creating the markup you need for the button. You can even add the block editor class to style it as a button by default.
    It would be something like this:

    
    <?php
    /**
     * Display Posts Output Filter
     * @see https://displayposts.com/docs/the-output-filter/
     *
     */
    function be_dps_output_customization( $output, $original_atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class, $author, $category_display_text ) {
      $more =  '<p><a class="excerpt-more wp-block-button__link" href="' . get_permalink() . '">Read More</a></p>';
      $output = '<' . $inner_wrapper . ' class="' . implode( ' ', $class ) . '">' . $image . $title . $date . $author . $category_display_text . $excerpt . &more . $content . '</' . $inner_wrapper . '>';
      return $output;
    }
    add_filter( 'display_posts_shortcode_output', 'be_dps_output_customization', 10, 11 );

    I hope it helps!

Viewing 1 replies (of 1 total)
  • The topic ‘“read more” in new line’ is closed to new replies.