'a-staff', "version" => '1.3', ); if ( !is_array( $tpl_load_version ) ) { $tpl_load_version = $a_staff_tpl_version; } else { if ( version_compare( $tpl_load_version["version"], $a_staff_tpl_version["version"] ) < 0 ) { $tpl_load_version = $a_staff_tpl_version; } } // The initializer function function a_staff_init() { global $tpl_load_version, $a_staff_tpl_version; // If we use a non-Themple-based theme, go with the plugin's built-in Themple Lite version if ( $tpl_load_version["name"] == $a_staff_tpl_version["name"] ) { require_once plugin_dir_path( dirname( __FILE__ ) ) . "framework/tpl-fw.php"; // Load the framework's l10n files in this case $mo_filename = plugin_dir_path( dirname( __FILE__ ) ) . 'framework/languages/' . get_locale() . '.mo'; if ( is_admin() && file_exists( $mo_filename ) ) { load_textdomain( 'tpl', $mo_filename ); } } } add_action( 'after_setup_theme', 'a_staff_init' ); // This function is needed for interpreting the Settings page settings. function a_staff_settings () { tpl_settings_page( 'a_staff_settings'); } // Font Awesome CSS loader function. Loads the FA CSS file if it's not yet available in the front end function a_staff_fa_css() { wp_enqueue_style( 'font-awesome', plugins_url( 'assets/font-awesome.min.css', dirname( __FILE__ ) ) ); } // Adding some extra settings just to make sure JS works fine add_filter( 'tpl_admin_js_strings', 'a_staff_admin_js_values', 10, 1 ); function a_staff_admin_js_values( $values ) { $values["remover_confirm"] = 'yes'; $values["pb_fewer_confirm"] = 'yes'; $values["pb_fewer_instances"] = ''; return $values; } // Add the default image size for the plugin add_filter( 'tpl_image_sizes', 'a_staff_image_sizes', 10, 1 ); function a_staff_image_sizes( $image_sizes = array() ) { // The post thumbnail in sidebar view $image_sizes["a-staff-default"] = array( 'title' => __( 'a-staff Default', 'a-staff' ), 'width' => 480, 'height' => 480, 'crop' => array( 'center', 'top' ), 'select' => true, ); return $image_sizes; } // Load the plugin's front end CSS if it's enabled in admin add_action( 'wp_enqueue_scripts', function() { if ( tpl_get_option( 'a_staff_load_css' ) == 'yes' ) { wp_enqueue_style( 'a-staff-style', plugins_url( 'assets/a-staff.css', dirname( __FILE__ ) ), array(), A_STAFF_VERSION ); // Add some responsive code if it was enabled in plugin settings if ( tpl_get_option( 'a_staff_responsive' ) == 'yes' ) { $custom_css = '@media (max-width: ' . tpl_get_value( 'a_staff_responsive_breakpoints/0/breakpoint_1' ) . ') { .a-staff-cols-5 .a-staff-member-box-wrapper, .a-staff-cols-6 .a-staff-member-box-wrapper { width: 33.3333%; } } @media (max-width: ' . tpl_get_value( 'a_staff_responsive_breakpoints/0/breakpoint_2' ) . ') { .a-staff-cols-3 .a-staff-member-box-wrapper, .a-staff-cols-4 .a-staff-member-box-wrapper, .a-staff-cols-5 .a-staff-member-box-wrapper, .a-staff-cols-6 .a-staff-member-box-wrapper { width: 50%; } } @media (max-width: ' . tpl_get_value( 'a_staff_responsive_breakpoints/0/breakpoint_3' ) . ') { .a-staff-cols-2 .a-staff-member-box-wrapper, .a-staff-cols-3 .a-staff-member-box-wrapper, .a-staff-cols-4 .a-staff-member-box-wrapper, .a-staff-cols-5 .a-staff-member-box-wrapper, .a-staff-cols-6 .a-staff-member-box-wrapper { width: 100%; } }'; wp_add_inline_style( 'a-staff-style', esc_html( $custom_css ) ); } } } ); // Add some styles for the admin page function a_staff_admin_style() { echo ''; } add_action( 'admin_head', 'a_staff_admin_style' ); // Rewrite rules update to avoid 404 errors function a_staff_flush_rewrites() { a_staff_cpt(); flush_rewrite_rules(); }