Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #212360

    Hi there,

    if you get search results there is an excerpt of the text frrom pages/articles/etc. .

    Mainly on Pages my first letter is a dropcap. These dropcaps you can’t see in the excerpts of text on the search results list.

    Text on pages/articles for example: ‘Test’ , (…’T’ is a dropcap)
    On search results is this: ‘est’

    So my question is:

    How can I add the letter ‘T’ (…which is a dropcap) to the search results page ?

    Thanks Guys
    The Blogwaeltler

    • This topic was modified 7 months, 1 week ago by  blogwaeltler.
    #212565

    Hi blogwaeltler!

    You can edit includes > loop-search.php, find this code:

    $excerpt = trim(get_the_excerpt());
                    if(!empty($excerpt))
                    {
                        the_excerpt();
                    }
                    else
                    {
                        $excerpt = strip_shortcodes( get_the_content() );
                        $excerpt = apply_filters('the_excerpt', $excerpt);
                        $excerpt = str_replace(']]>', ']]>', $excerpt);
                        echo $excerpt;
                    }

    Replace it with:

    $excerpt = trim(get_the_excerpt());
                    echo do_shortcode(substr($excerpt, 0, 200));

    Cheers!
    Ismael

    #212880

    Ismael, thank you !

    Sometimes i’m stupid.
    For example at first i could use the additional ‘excerpt’ option in the page editing mode without the shortcode for dropcaps.

    But on the other site i would like to use your method. (So, the ‘writing’ of an additional text for the excerpt option wouldn’t be necessary.)

    For your method i have to create the loop-search.php because this file is nowhere.

    How should this file look above your posted code ‘$excerpt = trim(get_the_excerpt())’ …and beneath the last line of your code ‘do_shortcode(substr($excerpt, 0, 200))’ ?

    In which folder I have to copy this new loop-search.php ?

    Thanks Guys,

    Blogwaeltler

    #213943

    Hi!

    The loop-search.php is inside the includes folder in your theme files. You don’t need to create it, just modify it according to Ismael’s suggested changes.

    Best regards,
    Devin

    #214013

    Hi Devin,
    unfortunetaly there isn’t this file.
    I’m using a fresh downloaded flashlight version 2.4.1.
    On the installed wordpress with flashlight (…on webspace) and in the original downloaded flashlight version 2.4.1 i can’t find this file.
    In the zipped 2.4.1 file (…downloaded from themeforest) there isn’t a loop-search.php… in none directory.

    ???

    Best regards,
    The blogwaeltler

    #214811

    Hi!

    If you use the “excerpt” option field you can’t use shortcodes. If you want to activate the shortcodes in the “content” text open up includes > loop-search.php and replace

    
    $excerpt = strip_shortcodes( get_the_content() );
    

    with

    
    $excerpt = do_shortcodes( get_the_content() );
    

    Best regards,
    Peter

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.