[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 13 posts - 16 through 28 (of 28 total)
  • Author
    Posts
  • #212252
    Markus

    Hi Tom,

    thank you very much. Without your help I’stuck.
    πŸ™‚

    And yes, it helps on the Tag pages, very nice.

    But: the Search Result Pages and the Blog Page lost masonry.
    πŸ™

    #212253
    Markus

    This way it works!!!

    //Masonary style on Tag Pages//
    add_filter( 'generate_blog_masonry','generate_custom_masonry' ); function generate_custom_masonry() {
        return 'true';
        return $masonry;
    }
    
    #212254
    Tom
    Lead Developer
    Lead Developer

    That will enable masonry everywhere on the site as you’re just returning true no matter what.

    You could try something like:

    add_filter( 'generate_blog_masonry','generate_custom_masonry' );
    function generate_custom_masonry()
    {
        if ( is_tag() || is_search() || is_home() || is_archive() )
            return 'true';
    
        return 'false';
    }
    #212270
    Markus

    You’re right.
    I found out already and tried to figure out how to tweak it.
    You were faster.

    That’s it.
    Thank you again.

    #212273
    Markus

    FYI: in the first time I just copied your solution from my mail client.
    Because the Apostroph were encoded to & # 039 ; it crashes the system.
    I guess the mail function of your forum replaces the ‘ with an entity.

    #212286
    Tom
    Lead Developer
    Lead Developer

    Ah yes, don’t trust emails when it comes to code – always come to the forum.

    Glad you got it working πŸ™‚

    #212328
    Markus

    Still not resolved….

    Now the button with the “Masonry Load More Text” is shown on all single posts and pages.

    #212332
    Markus

    I guess I have to buy you another coffee when this is resolved.
    But, Jesus, 10$ for a coffee in Vancouver Island?
    Wonder how you make ends meet.
    πŸ˜‰

    #212334
    Tom
    Lead Developer
    Lead Developer

    Can you try the adjusted code above?: https://generatepress.com/forums/topic/read-more-label-in-search-result-page/page/2/#post-212254

    Ha! You can adjust that $10 to whatever you like πŸ™‚

    It’s expensive here, but luckily not that expensive, yet!

    #212337
    Markus

    This code is already working fine for all types of result pages.
    Only this button should not be on the single posts and pages.

    #212338
    Tom
    Lead Developer
    Lead Developer

    That button should only appear if masonry is set to true.

    The code above should only apply masonry those conditionals, which don’t include is_single() or is_page().

    Are you sure the function you added where it just said return ‘true’; isn’t still in there?

    #212344
    Markus

    Shame on me.

    Instead of
    return ‘false’;

    I still had
    return $masonry;

    Sorry, have a nice weekend!

    Done.

    #212345
    Tom
    Lead Developer
    Lead Developer

    You too! πŸ™‚

Viewing 13 posts - 16 through 28 (of 28 total)
  • You must be logged in to reply to this topic.