| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPSpeedo_Team; |
| 4 |
|
| 5 |
if ( ! defined('ABSPATH') ) exit; |
| 6 |
|
| 7 |
class Compatibility { |
| 8 |
|
| 9 |
// Constructor |
| 10 |
public function __construct() { |
| 11 |
|
| 12 |
if ( $this->is_theme('OceanWP') ) { |
| 13 |
if ( get_theme_mod( 'ocean_performance_scroll_effect', 'enabled' ) === 'enabled' ) { |
| 14 |
// Disable OceanWP scroll effect on team member links |
| 15 |
add_filter( 'wpspeedo_team/post_link_attrs', [ $this, 'modify_oceanwp_link_attrs' ], 10, 2 ); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
} |
| 20 |
|
| 21 |
// Modify link attributes for OceanWP theme |
| 22 |
public function modify_oceanwp_link_attrs( $attrs, $action ) { |
| 23 |
if ( in_array( $action, ['modal', 'expand', 'side-panel'] ) ) { |
| 24 |
if ( ! isset( $attrs['class'] ) ) $attrs['class'] = 'opl-link'; |
| 25 |
else $attrs['class'] .= ' opl-link'; |
| 26 |
} |
| 27 |
return $attrs; |
| 28 |
} |
| 29 |
|
| 30 |
// Check if the $theme is in theme or parent theme |
| 31 |
public function is_theme( $theme ) { |
| 32 |
$current_theme = wp_get_theme(); |
| 33 |
if ( $current_theme->get('Name') === $theme ) { |
| 34 |
return true; |
| 35 |
} |
| 36 |
if ( $current_theme->parent() && $current_theme->parent()->get('Name') === $theme ) { |
| 37 |
return true; |
| 38 |
} |
| 39 |
return false; |
| 40 |
} |
| 41 |
|
| 42 |
} |