# wp-ultimate-post-grid/2.6.0/helpers/content.php

WP Ultimate Post Grid, version 2.6.0. 30 lines.

- Page: https://pluginprobe.com/plugins/wp-ultimate-post-grid/2.6.0/code/helpers/content.php
- Raw: https://pluginprobe.com/plugins/wp-ultimate-post-grid/2.6.0/raw/helpers/content.php
- Modified: 2017-10-30T10:29:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-ultimate-post-grid/2.6.0/code/helpers/content.php#L10-L20`.

```php
<?php

class WPUPG_Content {

    public function __construct()
    {
        add_filter( 'the_content', array( $this, 'content_filter' ), 10 );
    }

    public function content_filter( $content )
    {
        $ignore_query = !is_main_query();
        if ( apply_filters( 'wpupg_content_loop_check', $ignore_query ) ) {
            return $content;
        }

        if ( get_post_type() == WPUPG_POST_TYPE ) {
            remove_filter( 'the_content', array( $this, 'content_filter' ), 10 );

            $grid = new WPUPG_Grid( get_post() );

            $content .= '[wpupg-filter id="' . $grid->slug() . '"]';
            $content .= '[wpupg-grid id="' . $grid->slug() . '"]';

            add_filter( 'the_content', array( $this, 'content_filter' ), 10 );
        }

        return $content;
    }
}
```
