/** * Theme functions and definitions. * * Sets up the theme and provides some helper functions * * When using a child theme (see http://codex.wordpress.org/Theme_Development * and http://codex.wordpress.org/Child_Themes), you can override certain * functions (those wrapped in a function_exists() call) by defining them first * in your child theme's functions.php file. The child theme's functions.php * file is included before the parent theme's file, so the child theme * functions would be used. * * * For more information on hooks, actions, and filters, * see http://codex.wordpress.org/Plugin_API * * @package OceanWP WordPress theme */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Core Constants. define( 'OCEANWP_THEME_DIR', get_template_directory() ); define( 'OCEANWP_THEME_URI', get_template_directory_uri() ); /** * OceanWP theme class */ final class OCEANWP_Theme_Class { /** * Main Theme Class Constructor * * @since 1.0.0 */ public function __construct() { // Define theme constants. $this->oceanwp_constants(); // Load required files. $this->oceanwp_has_setup(); // Load framework classes. add_action( 'after_setup_theme', array( 'OCEANWP_Theme_Class', 'classes' ), 4 ); // Setup theme => add_theme_support, register_nav_menus, load_theme_textdomain, etc. add_action( 'after_setup_theme', array( 'OCEANWP_Theme_Class', 'theme_setup' ), 10 ); // Setup theme => Generate the custom CSS file. add_action( 'admin_bar_init', array( 'OCEANWP_Theme_Class', 'save_customizer_css_in_file' ), 9999 ); // register sidebar widget areas. add_action( 'widgets_init', array( 'OCEANWP_Theme_Class', 'register_sidebars' ) ); // Registers theme_mod strings into Polylang. if ( class_exists( 'Polylang' ) ) { add_action( 'after_setup_theme', array( 'OCEANWP_Theme_Class', 'polylang_register_string' ) ); } /** Admin only actions */ if ( is_admin() ) { // Load scripts in the WP admin. add_action( 'admin_enqueue_scripts', array( 'OCEANWP_Theme_Class', 'admin_scripts' ) ); // Outputs custom CSS for the admin. add_action( 'admin_head', array( 'OCEANWP_Theme_Class', 'admin_inline_css' ) ); /** Non Admin actions */ } else { // Load theme CSS. add_action( 'wp_enqueue_scripts', array( 'OCEANWP_Theme_Class', 'theme_css' ) ); // Load his file in last. add_action( 'wp_enqueue_scripts', array( 'OCEANWP_Theme_Class', 'custom_style_css' ), 9999 ); // Remove Customizer CSS script from Front-end. add_action( 'init', array( 'OCEANWP_Theme_Class', 'remove_customizer_custom_css' ) ); // Load theme js. add_action( 'wp_enqueue_scripts', array( 'OCEANWP_Theme_Class', 'theme_js' ) ); // Add a pingback url auto-discovery header for singularly identifiable articles. add_action( 'wp_head', array( 'OCEANWP_Theme_Class', 'pingback_header' ), 1 ); // Add meta viewport tag to header. add_action( 'wp_head', array( 'OCEANWP_Theme_Class', 'meta_viewport' ), 1 ); // Add an X-UA-Compatible header. add_filter( 'wp_headers', array( 'OCEANWP_Theme_Class', 'x_ua_compatible_headers' ) ); // Loads html5 shiv script. add_action( 'wp_head', array( 'OCEANWP_Theme_Class', 'html5_shiv' ) ); // Outputs custom CSS to the head. add_action( 'wp_head', array( 'OCEANWP_Theme_Class', 'custom_css' ), 9999 ); // Minify the WP custom CSS because WordPress doesn't do it by default. add_filter( 'wp_get_custom_css', array( 'OCEANWP_Theme_Class', 'minify_custom_css' ) ); // Alter the search posts per page. add_action( 'pre_get_posts', array( 'OCEANWP_Theme_Class', 'search_posts_per_page' ) ); // Alter WP categories widget to display count inside a span. add_filter( 'wp_list_categories', array( 'OCEANWP_Theme_Class', 'wp_list_categories_args' ) ); // Add a responsive wrapper to the WordPress oembed output. add_filter( 'embed_oembed_html', array( 'OCEANWP_Theme_Class', 'add_responsive_wrap_to_oembeds' ), 99, 4 ); // Adds classes the post class. add_filter( 'post_class', array( 'OCEANWP_Theme_Class', 'post_class' ) ); // Add schema markup to the authors post link. add_filter( 'the_author_posts_link', array( 'OCEANWP_Theme_Class', 'the_author_posts_link' ) ); // Add support for Elementor Pro locations. add_action( 'elementor/theme/register_locations', array( 'OCEANWP_Theme_Class', 'register_elementor_locations' ) ); // Remove the default lightbox script for the beaver builder plugin. add_filter( 'fl_builder_override_lightbox', array( 'OCEANWP_Theme_Class', 'remove_bb_lightbox' ) ); } } /** * Define Constants * * @since 1.0.0 */ public static function oceanwp_constants() { $version = self::theme_version(); // Theme version. define( 'OCEANWP_THEME_VERSION', $version ); // Javascript and CSS Paths. define( 'OCEANWP_JS_DIR_URI', OCEANWP_THEME_URI . '/assets/js/' ); define( 'OCEANWP_CSS_DIR_URI', OCEANWP_THEME_URI . '/assets/css/' ); // Include Paths. define( 'OCEANWP_INC_DIR', OCEANWP_THEME_DIR . '/inc/' ); define( 'OCEANWP_INC_DIR_URI', OCEANWP_THEME_URI . '/inc/' ); // Check if plugins are active. define( 'OCEAN_EXTRA_ACTIVE', class_exists( 'Ocean_Extra' ) ); define( 'OCEANWP_ELEMENTOR_ACTIVE', class_exists( 'Elementor\Plugin' ) ); define( 'OCEANWP_BEAVER_BUILDER_ACTIVE', class_exists( 'FLBuilder' ) ); define( 'OCEANWP_WOOCOMMERCE_ACTIVE', class_exists( 'WooCommerce' ) ); define( 'OCEANWP_EDD_ACTIVE', class_exists( 'Easy_Digital_Downloads' ) ); define( 'OCEANWP_LIFTERLMS_ACTIVE', class_exists( 'LifterLMS' ) ); define( 'OCEANWP_ALNP_ACTIVE', class_exists( 'Auto_Load_Next_Post' ) ); define( 'OCEANWP_LEARNDASH_ACTIVE', class_exists( 'SFWD_LMS' ) ); } /** * Load all core theme function files * * @since 1.0.0oceanwp_has_setup */ public static function oceanwp_has_setup() { $dir = OCEANWP_INC_DIR; require_once $dir . 'helpers.php'; require_once $dir . 'header-content.php'; require_once $dir . 'oceanwp-strings.php'; require_once $dir . 'oceanwp-svg.php'; require_once $dir . 'oceanwp-theme-icons.php'; require_once $dir . 'customizer/controls/typography/webfonts.php'; require_once $dir . 'walker/init.php'; require_once $dir . 'walker/menu-walker.php'; require_once $dir . 'third/class-gutenberg.php'; require_once $dir . 'third/class-elementor.php'; require_once $dir . 'third/class-beaver-themer.php'; require_once $dir . 'third/class-bbpress.php'; require_once $dir . 'third/class-buddypress.php'; require_once $dir . 'third/class-lifterlms.php'; require_once $dir . 'third/class-learndash.php'; require_once $dir . 'third/class-sensei.php'; require_once $dir . 'third/class-social-login.php'; require_once $dir . 'third/class-amp.php'; require_once $dir . 'third/class-pwa.php'; // WooCommerce. if ( OCEANWP_WOOCOMMERCE_ACTIVE ) { require_once $dir . 'woocommerce/woocommerce-config.php'; } // Easy Digital Downloads. if ( OCEANWP_EDD_ACTIVE ) { require_once $dir . 'edd/edd-config.php'; } } /** * Returns current theme version * * @since 1.0.0 */ public static function theme_version() { // Get theme data. $theme = wp_get_theme(); // Return theme version. return $theme->get( 'Version' ); } /** * Compare WordPress version * * @access public * @since 1.8.3 * @param string $version - A WordPress version to compare against current version. * @return boolean */ public static function is_wp_version( $version = '5.4' ) { global $wp_version; // WordPress version. return version_compare( strtolower( $wp_version ), strtolower( $version ), '>=' ); } /** * Check for AMP endpoint * * @return bool * @since 1.8.7 */ public static function oceanwp_is_amp() { return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint(); } /** * Load theme classes * * @since 1.0.0 */ public static function classes() { // Admin only classes. if ( is_admin() ) { // Recommend plugins. require_once OCEANWP_INC_DIR . 'plugins/class-tgm-plugin-activation.php'; require_once OCEANWP_INC_DIR . 'plugins/tgm-plugin-activation.php'; // Front-end classes. } else { // Breadcrumbs class. require_once OCEANWP_INC_DIR . 'breadcrumbs.php'; } // Customizer class. require_once OCEANWP_INC_DIR . 'customizer/customizer.php'; } /** * Theme Setup * * @since 1.0.0 */ public static function theme_setup() { // Load text domain. load_theme_textdomain( 'oceanwp', OCEANWP_THEME_DIR . '/languages' ); // Get globals. global $content_width; // Set content width based on theme's default design. if ( ! isset( $content_width ) ) { $content_width = 1200; } // Register navigation menus. register_nav_menus( array( 'topbar_menu' => esc_html__( 'Top Bar', 'oceanwp' ), 'main_menu' => esc_html__( 'Main', 'oceanwp' ), 'footer_menu' => esc_html__( 'Footer', 'oceanwp' ), 'mobile_menu' => esc_html__( 'Mobile (optional)', 'oceanwp' ), ) ); // Enable support for Post Formats. add_theme_support( 'post-formats', array( 'video', 'gallery', 'audio', 'quote', 'link' ) ); // Enable support for
' . $cache . '
'; } else { return ' '; } } /** * Adds extra classes to the post_class() output * * @param obj $classes Return classes. * @since 1.0.0 */ public static function post_class( $classes ) { // Get post. global $post; // Add entry class. $classes[] = 'entry'; // Add has media class. if ( has_post_thumbnail() || get_post_meta( $post->ID, 'ocean_post_oembed', true ) || get_post_meta( $post->ID, 'ocean_post_self_hosted_media', true ) || get_post_meta( $post->ID, 'ocean_post_video_embed', true ) ) { $classes[] = 'has-media'; } // Return classes. return $classes; } /** * Add schema markup to the authors post link * * @param obj $link Author link. * @since 1.0.0 */ public static function the_author_posts_link( $link ) { // Add schema markup. $schema = oceanwp_get_schema_markup( 'author_link' ); if ( $schema ) { $link = str_replace( 'rel="author"', 'rel="author" ' . $schema, $link ); } // Return link. return $link; } /** * Add support for Elementor Pro locations * * @param obj $elementor_theme_manager Elementor Instance. * @since 1.5.6 */ public static function register_elementor_locations( $elementor_theme_manager ) { $elementor_theme_manager->register_all_core_location(); } /** * Add schema markup to the authors post link * * @since 1.1.5 */ public static function remove_bb_lightbox() { return true; } } /**-------------------------------------------------------------------------------- #region Freemius - This logic will only be executed when Ocean Extra is active and has the Freemius SDK ---------------------------------------------------------------------------------*/ if ( ! function_exists( 'owp_fs' ) ) { if ( class_exists( 'Ocean_Extra' ) && defined( 'OE_FILE_PATH' ) && file_exists( dirname( OE_FILE_PATH ) . '/includes/freemius/start.php' ) ) { /** * Create a helper function for easy SDK access. */ function owp_fs() { global $owp_fs; if ( ! isset( $owp_fs ) ) { // Include Freemius SDK. require_once dirname( OE_FILE_PATH ) . '/includes/freemius/start.php'; $owp_fs = fs_dynamic_init( array( 'id' => '3752', 'bundle_id' => '3767', 'slug' => 'oceanwp', 'type' => 'theme', 'public_key' => 'pk_043077b34f20f5e11334af3c12493', 'bundle_public_key' => 'pk_c334eb1ae413deac41e30bf00b9dc', 'is_premium' => false, 'has_addons' => true, 'has_paid_plans' => true, 'menu' => array( 'slug' => 'oceanwp-panel', 'account' => true, 'contact' => false, 'support' => false, ), 'bundle_license_auto_activation' => true, 'navigation' => 'menu', 'is_org_compliant' => true, ) ); } return $owp_fs; } // Init Freemius. owp_fs(); // Signal that SDK was initiated. do_action( 'owp_fs_loaded' ); } } #endregion new OCEANWP_Theme_Class(); {"id":30,"date":"2018-12-26T14:53:31","date_gmt":"2018-12-26T14:53:31","guid":{"rendered":"https:\/\/charity.oceanwp.org\/?page_id=30"},"modified":"2021-07-03T12:53:42","modified_gmt":"2021-07-03T12:53:42","slug":"home","status":"publish","type":"page","link":"https:\/\/manasfoundationndb.org\/","title":{"rendered":"Home"},"content":{"rendered":"\t\t