Support » Plugin: wp-Typography » cannot exclude element

  • Resolved berry metal

    (@erikalleman)


    Hi there,

    I am unable to exclude classes.

    Here is my HTML:
    https://i.imgur.com/K5gfOgi.png

    and here are my settings:
    https://i.imgur.com/KS6wiA9.png

    But links are excluded at the HTML elements as well, and that post entry title is a link, so widows shouldn’t be prevented on that link.

    I have cleared the wp-Typography plugin cache, my grid cache, and all my other caches, CDN, etc…

    Am I specifying something wrong in my settings?

    • This topic was modified 4 months, 1 week ago by berry metal.
    • This topic was modified 4 months, 1 week ago by berry metal.
Viewing 5 replies - 46 through 50 (of 50 total)
  • Thread Starter berry metal

    (@erikalleman)

    Hi,

    I managed to add the class only to my related posts titles via grid code:

    add_filter('wp_grid_builder/the_content', [ 'WP_Typography', 'process' ] );
    
    function prefix_register_block( $blocks ) {
        
        // 'my_block' corresponds to the block slug.
        $blocks['wpgb_custom_title'] = [
            'name' => __( 'WPGB Custom Title', 'text-domain' ),
            'render_callback' => 'prefix_my_block_render',
        ];
    
        return $blocks;
        
    }
    
    add_filter( 'wp_grid_builder/blocks', 'prefix_register_block', 10, 1 );
    
    // The render callback function allows to output content in cards.
    function prefix_my_block_render() {
    
        // Get current post, term, or user object.
        $post = wpgb_get_post();
    
        // Output the post title.
        echo '<span class="noTypo">' . esc_html( $post->post_title ) . '</span>';
    
    }

    And the noTypo class is succesfully added, yet the titles are not dewidowed.

    Screenshot of the HTML:

    https://i.imgur.com/K465Ryr.png

    Something is amiss here… could you advise what could be wrong?

    Because when I added the class previously with:

    function add_notypo_to_title( $title ) {
     
        return "<span class='noTypo'>$title</span>";
    }
    
    if (! is_admin() ) {
        add_filter( 'the_title', 'add_notypo_to_title', 10, 1 );
    }

    the dewidowing worked just fine.
    Is it something with the way the title is retrieved in my grid code?

    Thanks in advance,
    I hope you and your businesses are doing well,
    have a nice weekend.

    Plugin Author pepe

    (@pputzer)

    Unfortunately, I cannot support a closed-source plugin. Please contact GridBuilder support for help with their filter hooks/rendering logic.

    PS: “prefix_” is just a placeholder and you should a prefix unique to your child theme/organzation/website.

    Thread Starter berry metal

    (@erikalleman)

    Hi,
    if the class is added, then it should work, so this question refers to why it doesn’t work if the class is added, not to my grid plugin.
    I don’t what are the requirements for it to work – that is what I am asking.
    It seems that it matters when is the class added.
    I attached the plugin code so you can see when is the class added.
    What should I tell to the grid developer about when should the class be added to make it work?
    If he knows when you need the class to be added in your plugin to make it work, then he can help perhaps to modify the code.
    I just need to know the requirement for when the class need to be added (not later than… some event).

    Best regards.

    Plugin Author pepe

    (@pputzer)

    @erikalleman, what matters is whether the string ultimately passed to WP_Typography::process as its first parameter contains the element with the class. Since you are using a custom hook of a closed-source plugin (wp_grid_builder/the_content), I have no idea what arguments will be passed to the added filter functions.

    Thread Starter berry metal

    (@erikalleman)

    Thanks for your reply. In that case I will try to sort this out with the grid developer.

Viewing 5 replies - 46 through 50 (of 50 total)
  • You must be logged in to reply to this topic.