Title: cannot exclude element
Last modified: February 20, 2022

---

# cannot exclude element

 *  Resolved [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/)
 * Hi there,
 * I am unable to exclude classes.
 * Here is my HTML:
 * > [flameshot_screenshot](https://imgur.com/K5gfOgi)
 * and here are my settings:
 * > [flameshot_screenshot](https://imgur.com/KS6wiA9)
 * 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 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).
    -  This topic was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).

Viewing 5 replies - 46 through 50 (of 50 total)

[←](https://wordpress.org/support/topic/cannot-exclude-element/page/3/?output_format=md)
[1](https://wordpress.org/support/topic/cannot-exclude-element/?output_format=md)
[2](https://wordpress.org/support/topic/cannot-exclude-element/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/cannot-exclude-element/page/3/?output_format=md)
4

 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/cannot-exclude-element/page/4/#post-15475553)
 * 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:
 * > [flameshot_screenshot](https://imgur.com/K465Ryr)
 * 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](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/cannot-exclude-element/page/4/#post-15475903)
 * 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](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/cannot-exclude-element/page/4/#post-15476418)
 * 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](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/cannot-exclude-element/page/4/#post-15476428)
 * [@erikalleman](https://wordpress.org/support/users/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](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/cannot-exclude-element/page/4/#post-15476519)
 * 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)

[←](https://wordpress.org/support/topic/cannot-exclude-element/page/3/?output_format=md)
[1](https://wordpress.org/support/topic/cannot-exclude-element/?output_format=md)
[2](https://wordpress.org/support/topic/cannot-exclude-element/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/cannot-exclude-element/page/3/?output_format=md)
4

The topic ‘cannot exclude element’ is closed to new replies.

 * ![](https://ps.w.org/wp-typography/assets/icon.svg?rev=2663995)
 * [wp-Typography](https://wordpress.org/plugins/wp-typography/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-typography/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-typography/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-typography/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-typography/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-typography/reviews/)

 * 50 replies
 * 2 participants
 * Last reply from: [berry metal](https://wordpress.org/support/users/erikalleman/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/cannot-exclude-element/page/4/#post-15476519)
 * Status: resolved