Filtering posts on all blocks

Posted in: Newspaper
Post count: 12

Hi,

I’m using Advanced Custom Fields to add custom settings on my posts.

I was trying to filter some articles to not show on certain conditions using pre_get_posts action.
This does not seem to work..

What is the way to tackle this?

Post count: 12

Anyone?

The only I’ve found to do that is by changing the theme source code.

Adding a filter to this function:

/**
* is used by all the blocks
* @param string $atts
* @param string $paged - is used by ajax
* @return WP_Query
*/
static function &get_wp_query ($atts = '', $paged = '') { //by ref
$args = self::shortcode_to_args($atts, $paged);

// Custom filtering
$args = apply_filters('organic_posts_filter', $args);

$td_query = new WP_Query($args);

return $td_query;
}

Post count: 22421

Hi,
Sorry but the theme support does not cover custom implementation. Maybe one of our users can help if they have made this customization.
Thanks

Post count: 12

Hi Bogdan,

I had to override the td_data_source.php file in my child-theme.
Its working great.

Hope it won’t cause chaos when new updates are released 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.