[Resolved] Read More Label in Search Result Page

Home Forums Support [Resolved] Read More Label in Search Result Page

Home Forums Support Read More Label in Search Result Page

Viewing 15 posts - 1 through 15 (of 28 total)
  • Author
    Posts
  • #211113
    Markus

    Hi Tom,

    maybe this is linked to https://generatepress.com/forums/topic/no-read-more-label-settings-available/

    If I do a search I get a result page with exerpts of posts and pages.
    Funny, all the pages have a —more— tag in the source.

    But the do not show the read more… label.

    Actually shown is the read more… label only for the pages if the automacally cut. Just after the 55 words which is the value set in the blog Excerpt Length…

    Coincidence?

    Example: https://insoguide.de/?s=insolvenz

    #211116
    Markus

    Funny, the “blog page” does not cut the posts after 55 words:
    https://insoguide.de/news

    Regardless of the settings in the blog part of the visual customizer
    “Show exerpt” or “Show entire post”.

    #211142
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Your blog page seems to be using the More tag, which is why it isn’t cutting off at 55 words.

    The search results page is set to display excerpts by default, as search results should really be easy to scan.

    Of course, you can make it so the search results show the full post (and respect the more tag) like this: https://generatepress.com/forums/topic/blockquote-and-tables-tags-converting-in-generatepress/#post-148736

    Hope this helps ๐Ÿ™‚

    #211143
    Markus

    Also, the tag page does not cut the pages or post after 55 words:
    https://insoguide.de/thema/insolvenzeroeffnungsgrund
    (Whereas “thema” is base for all tag pages.)
    (I use tags for pages as well).

    The read more … label is shown in all cases.

    By the way:
    But it would be nice if the posts and pages would be presented in a masory style.

    #211367
    Tom
    Lead Developer
    Lead Developer

    Looks like we posted those last two replies at the exact same time!

    Is the above resolved? ๐Ÿ™‚

    #211610
    Markus

    Resolved? Yes and no.

    Yes: I used the code in your reply
    https://generatepress.com/forums/topic/read-more-label-in-search-result-page/#post-211142
    which solved my excerpt and read -more- problem.

    Thank you very much for this!

    No: I try again to explain.
    My objective is to have almost similiar result pages for:
    Searches, e.g. https://insoguide.de?s=insolvenzverschleppung
    Blog page: https://insoguide.de/news
    and Tag page: https://insoguide.de/thema/insolvenzeroeffnungsgrund

    As you see, only the tag page looks different – it would be nice if the posts and pages would be presented in a masory style.

    #211619
    Tom
    Lead Developer
    Lead Developer

    Interesting – do you have masonry set to enable through the Customizer, or are you using a function?

    #211670
    Markus

    just the cutomizer

    #211727
    Tom
    Lead Developer
    Lead Developer

    Ah it’s because those “posts” are actually pages, and masonry is told not to include pages in masonry.

    Are you using a plugin to include pages in your archives?

    #211734
    Markus

    Hi Tom,

    not all of results are pages, some are posts (if they show a date),
    as seen in the search example.
    In the last example above (tag page) , all are pages. If I add some posts, nothing changes.

    ~~~

    I checked the https://wordpress.org/plugins/tag-pages/

    Because it contains just two functions, I added those to my child theme’s function.php.

    /**
     * Add the 'post_tag' taxonomy, which is the name of the existing taxonomy
     * used for tags to the Post type page. Normally in WordPress Pages cannot
     * be tagged, but this let's WordPress treat Pages just like Posts
     * and enables the tags metabox so you can add tags to a Page.
     * NB: This uses the register_taxonomy_for_object_type() function which is only
     * in WordPress 3 and higher!
     */
    if( ! function_exists('tagpages_register_taxonomy') ){
        function tagpages_register_taxonomy()
        {
            register_taxonomy_for_object_type('post_tag', 'page');
        }
        add_action('admin_init', 'tagpages_register_taxonomy');
    }
    
    /**
     * Display all post_types on the tags archive page. This forces WordPress to
     * show tagged Pages together with tagged Posts. Thanks to Page Tagger by
     * Ramesh Nair: http://wordpress.org/extend/plugins/page-tagger/
     */
    if( ! function_exists('tagpages_display_tagged_pages_archive') ){
        function tagpages_display_tagged_pages_archive(&$query)
        {
            if ( !is_admin() && $query->is_archive && $query->is_tag ) {
                $q = &$query->query_vars;
                $q['post_type'] = 'any';
            }
        }
        add_action('pre_get_posts', 'tagpages_display_tagged_pages_archive');
    }
    ?>
    
    #211735
    Markus

    Then I used your GP Hooks to display the tags.

    This alltogether took me two nights.
    You have to understand, this is my first WP Website – and I am not a developer.

    Thanks again for all your support.

    #211743
    Markus

    In case you need it: this I used to display the tags on pages.

    <?php if ('page' == get_post_type() and has_tag()): ?>
    <footer class="entry-meta">
    <span class="tags-links"><span class="screen-reader-text">Tags </span>
    <?php the_tags(' ', ', ', '<br />'); ?>
    </span>
    </footer>
    <?php endif; ?>
    #211863
    Tom
    Lead Developer
    Lead Developer

    If you remove the functions here: https://generatepress.com/forums/topic/read-more-label-in-search-result-page/#post-211734

    Does masonry work on the tag pages?

    #211953
    Markus

    If I remove then, it does mansonry, but show no pages anymore…

    #212153
    Tom
    Lead Developer
    Lead Developer

    Hmm, interesting problem indeed.

    No idea if it will work or not, but try this:

    add_filter( 'generate_blog_masonry','generate_custom_masonry' );
    function generate_custom_masonry()
    {
        if ( is_tag() )
            return 'true';
    
        return $masonry;
    }
Viewing 15 posts - 1 through 15 (of 28 total)
  • You must be logged in to reply to this topic.