Skip to content

Commit

Permalink
Fix compatible with TFRN plugin #933
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed Sep 1, 2022
1 parent 2bea90e commit 73aa2aa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion classes/Visualizer/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
$this->_addFilter( Visualizer_Plugin::FILTER_UNDO_REVISIONS, 'undoRevisions', 10, 2 );
$this->_addFilter( Visualizer_Plugin::FILTER_HANDLE_REVISIONS, 'handleExistingRevisions', 10, 2 );
$this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA_AS, 'getDataAs', 10, 3 );
$this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 );
$this->_addAction( 'pre_get_posts', 'PreGetPosts' );
register_shutdown_function( array($this, 'onShutdown') );

}
Expand Down Expand Up @@ -793,6 +793,21 @@ public function _getImage( $chart = null ) {
);
}

/**
* Filter chart title if visualizer post type.
*
* @param object $query WP Query object.
* @return void
*/
public function PreGetPosts( $query ) {
if ( ! $query->is_main_query() ) {
$post_type = $query->get( 'post_type' );
if ( 'visualizer' === $post_type ) {
$this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 );
}
}
}

/**
* Filter chart title.
*
Expand Down

0 comments on commit 73aa2aa

Please sign in to comment.