/** * Pings http://api.genesistheme.com/ asking if a new version of this theme is * available. * * If not, it returns false. * * If so, the external server passes serialized data back to this function, * which gets unserialized and returned for use. * * @since 1.1.0 * * @uses genesis_get_option() * @uses PARENT_THEME_VERSION Genesis version string * * @global string $wp_version WordPress version string * @return mixed Unserialized data, or false on failure */ function genesis_update_check() { global $wp_version; /** If updates are disabled */ if (!genesis_get_option('update') || !current_theme_supports('genesis-auto-updates')) { return false; } /** Get time of last update check */ $genesis_update = get_transient('genesis-update'); /** If it has expired, do an update check */ if (!$genesis_update) { $url = 'http://api.genesistheme.com/update-themes/'; $options = apply_filters('genesis_update_remote_post_options', array('body' => array('genesis_version' => PARENT_THEME_VERSION, 'wp_version' => $wp_version, 'php_version' => phpversion(), 'uri' => home_url(), 'user-agent' => "WordPress/{$wp_version};"))); $response = wp_remote_post($url, $options); $genesis_update = wp_remote_retrieve_body($response); /** If an error occurred, return FALSE, store for 1 hour */ if ('error' == $genesis_update || is_wp_error($genesis_update) || !is_serialized($genesis_update)) { set_transient('genesis-update', array('new_version' => PARENT_THEME_VERSION), 60 * 60); return false; } /** Else, unserialize */ $genesis_update = maybe_unserialize($genesis_update); /** And store in transient for 24 hours */ set_transient('genesis-update', $genesis_update, 60 * 60 * 24); } /** If we're already using the latest version, return false */ if (version_compare(PARENT_THEME_VERSION, $genesis_update['new_version'], '>=')) { return false; } return $genesis_update; }
/** * Currency switcher * * @access public * @return void|bool|string */ public static function currencies($atts) { $atts = shortcode_atts(array(), $atts, 'realia_currencies'); if (!current_theme_supports('realia-currencies')) { return; } $currencies = get_theme_mod('realia_currencies'); if ($currencies == false) { $currencies = array(array('symbol' => '$', 'code' => 'USD', 'show_after' => false, 'money_decimals' => 2, 'money_dec_point' => '.', 'money_thousands_separator' => ',')); } elseif (!is_array($currencies)) { return false; } array_splice($currencies, get_theme_mod('realia_currencies_other', 0) + 1); $result = ''; if (!empty($currencies) && is_array($currencies)) { ksort($currencies); $currency_code = Realia_Currencies::get_current_currency_code(); $result = ''; ob_start(); include Realia_Template_Loader::locate('misc/currencies'); $result = ob_get_contents(); ob_end_clean(); } return $result; }
/** * Scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/main.css * * Enqueue scripts in the following order: * 1. jquery-1.11.1.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr.min.js * 3. /theme/assets/js/scripts.js (in footer) * * Google Analytics is loaded after enqueued scripts if: * - An ID has been defined in config.php * - You're not logged in as an administrator */ function roots_scripts() { /** * The build task in Grunt renames production assets with a hash * Read the asset names from assets-manifest.json */ if (WP_ENV === 'development') { $assets = array('css' => '/assets/css/main.css', 'js' => '/assets/js/scripts.js', 'modernizr' => '/assets/vendor/modernizr/modernizr.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js'); } else { $get_assets = file_get_contents(get_template_directory() . '/assets/manifest.json'); $assets = json_decode($get_assets, true); $assets = array('css' => '/assets/css/main.min.css' . '?' . $assets['assets/css/main.min.css']['hash'], 'js' => '/assets/js/scripts.min.js' . '?' . $assets['assets/js/scripts.min.js']['hash'], 'modernizr' => '/assets/js/vendor/modernizr.min.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); } wp_enqueue_style('roots_css', get_template_directory_uri() . $assets['css'], false, null); /** * jQuery is loaded using the same method from HTML5 Boilerplate: * Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline * It's kept in the header instead of footer to avoid conflicts with plugins. */ if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', $assets['jquery'], array(), null, false); add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false); wp_enqueue_script('jquery'); wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, true); }
/** * Custom post type definition * * @access public * @return void */ public static function definition() { $labels = array('name' => __('FAQ', 'realia'), 'singular_name' => __('FAQ', 'realia'), 'add_new' => __('Add New FAQ', 'realia'), 'add_new_item' => __('Add New FAQ', 'realia'), 'edit_item' => __('Edit FAQ', 'realia'), 'new_item' => __('New FAQ', 'realia'), 'all_items' => __('All FAQ', 'realia'), 'view_item' => __('View FAQ', 'realia'), 'search_items' => __('Search FAQ', 'realia'), 'not_found' => __('No FAQ found', 'realia'), 'not_found_in_trash' => __('No FAQ found in Trash', 'realia'), 'parent_item_colon' => '', 'menu_name' => __('FAQ', 'realia')); if (current_theme_supports('realia-faq')) { register_post_type('faq', array('labels' => $labels, 'supports' => array('title', 'editor'), 'public' => true, 'show_ui' => true, 'has_archive' => true, 'rewrite' => array('slug' => __('faq', 'realia')), 'menu_position' => 49, 'categories' => array(), 'menu_icon' => 'dashicons-editor-help')); } }
/** */ protected function load_config_section($section_name, $section_array) { // not a feature option by default $feature_option = null; // sub option syntax? if (strpos($section_name, self::SUB_OPTION_DELIM)) { // yes, split at special delim $parts = explode(self::SUB_OPTION_DELIM, $section_name); // feature is the first part $feature = $parts[0]; // name is the second part $feature_option = $parts[1]; } else { // feature name is section name $feature = $section_name; } // does theme support this feature? if (current_theme_supports($feature)) { // yes, options component enabled? if ($feature_option && $this->policy()->options() instanceof ICE_Policy) { // inject feature atts into config array $section_array['feature'] = $feature; // is it a sub option? if ($this->policy()->options()->registry()->load_feature_option($feature_option, $section_array)) { // yes, skip standard loading return true; } } else { // load like a regular feature return parent::load_config_section($section_name, $section_array); } } // feature config *not* loaded return false; }
/** * Registers menu items * * @access public * @return void */ public static function menu() { if (current_theme_supports('realia-statistics')) { add_submenu_page('edit.php?post_type=property', __('Property Views', 'realia'), __('Property Views', 'realia'), 'manage_options', 'property_views', array(__CLASS__, 'property_views_template')); add_submenu_page('edit.php?post_type=property', __('Search Queries', 'realia'), __('Search Queries', 'realia'), 'manage_options', 'search_queries', array(__CLASS__, 'search_queries_template')); } }
function _tm_register_image_sizes() { if (!current_theme_supports('post-thumbnails')) { return; } set_post_thumbnail_size(238, 182, true); // Registers a new image sizes. add_image_size('_tm-thumb-s', 150, 150, true); add_image_size('_tm-thumb-240-100', 240, 100, true); add_image_size('_tm-thumb-m', 400, 400, true); add_image_size('_tm-thumb-560-350', 560, 350, true); add_image_size('_tm-post-thumbnail-large', 770, 480, true); add_image_size('_tm-thumb-l', 1170, 780, true); add_image_size('_tm-thumb-xl', 1920, 1080, true); add_image_size('_tm-thumb-150-115', 150, 115, true); add_image_size('_tm-thumb-238-182', 238, 182, true); add_image_size('_tm-thumb-337-258', 337, 258, true); add_image_size('_tm-thumb-476-365', 476, 365, true); add_image_size('_tm-thumb-536-411', 536, 411, true); add_image_size('_tm-thumb-426-327', 426, 327, true); add_image_size('_tm-thumb-860-662', 860, 662, true); add_image_size('_tm-thumb-760-585', 760, 585, true); add_image_size('_tm-thumb-660-508', 660, 508, true); add_image_size('_tm-thumb-1132-411', 1132, 411, true); }
/** * Popup Elements * * If this function is defined in a child class the element automatically gets an edit button, that, when pressed * opens a modal window that allows to edit the element properties * * @return void */ function popup_elements() { $this->elements = array(array("name" => __("For Developers: Section Class", 'avia_framework'), "desc" => __("Apply a custom Class Attribute to the section, so you can apply a style via CSS.", 'avia_framework') . "<br/><br/>" . __("Use with caution and make sure to only use allowed characters. No special characters can be used.", 'avia_framework'), "id" => "myclass", "type" => "input", "std" => ""), array("name" => __("For Developers: Section ID", 'avia_framework'), "desc" => __("Apply a custom ID Attribute to the section, so you can apply a unique style via CSS. This option is also helpful if you want to use anchor links to scroll to a sections when a link is clicked", 'avia_framework') . "<br/><br/>" . __("Use with caution and make sure to only use allowed characters. No special characters can be used.", 'avia_framework'), "id" => "myid", "type" => "input", "std" => ""), array("name" => __("Tab Position", 'avia_framework'), "desc" => __("Where should the tabs be displayed", 'avia_framework'), "id" => "position", "type" => "select", "std" => "top_tab", 'container_class' => "avia-element-fullwidth", "target" => array('#aviaTBcontent-form-container', 'class'), "subtype" => array(__('Display tabs at the top', 'avia_framework') => 'top_tab', __("Display Tabs on the left", 'avia_framework') => 'sidebar_tab sidebar_tab_left', __("Display Tabs on the right", 'avia_framework') => 'sidebar_tab sidebar_tab_right')), array("name" => __("Boxed Tabs", 'avia_framework'), "desc" => __("Do you want to display a border around your tabs or without border", 'avia_framework'), "id" => "boxed", "type" => "select", "std" => "no", "required" => array('position', 'contains', 'sidebar_tab'), "subtype" => array(__('With border', 'avia_framework') => 'border_tabs', __('Without border', 'avia_framework') => 'noborder_tabs')), array("name" => __("Add/Edit Tabs", 'avia_framework'), "desc" => __("Here you can add, remove and edit the Tabs you want to display.", 'avia_framework'), "type" => "modal_group", "id" => "content", 'container_class' => "avia-element-fullwidth avia-tab-container", "modal_title" => __("Edit Form Element", 'avia_framework'), "std" => array(array('title' => __('Tab 1', 'avia_framework')), array('title' => __('Tab 2', 'avia_framework'))), 'subelements' => array(array("name" => __("Tab Title", 'avia_framework'), "desc" => __("Enter the tab title here (Better keep it short)", 'avia_framework'), "id" => "title", "std" => "Tab Title", "type" => "input"), array("name" => __("Tab Icon", 'avia_framework'), "desc" => __("Should an icon be displayed at the left side of the tab title?", 'avia_framework'), "id" => "icon_select", "type" => "select", "std" => "no", "subtype" => array(__('No Icon', 'avia_framework') => 'no', __('Yes, display Icon', 'avia_framework') => 'yes')), array("name" => __("Tab Icon", 'avia_framework'), "desc" => __("Select an icon for your tab title below", 'avia_framework'), "id" => "icon", "type" => "iconfont", "std" => "", "required" => array('icon_select', 'equals', 'yes')), array("name" => __("Tab Content", 'avia_framework'), "desc" => __("Enter some content here", 'avia_framework'), "id" => "content", "type" => "tiny_mce", "std" => "Tab Content goes here"))), array("name" => __("Initial Open", 'avia_framework'), "desc" => __("Enter the Number of the Tab that should be open initially.", 'avia_framework'), "id" => "initial", "std" => "1", "type" => "input")); if (current_theme_supports('avia_template_builder_custom_tab_toogle_id')) { $this->elements[2]['subelements'][] = array("name" => __("For Developers: Custom Tab ID", 'avia_framework'), "desc" => __("Insert a custom ID for the element here. Make sure to only use allowed characters.", 'avia_framework'), "id" => "custom_id", "type" => "input", "std" => ""); } }
/** * Enqueue scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/main.min.css * * Enqueue scripts in the following order: * 1. jquery-1.11.0.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr-2.7.2.min.js * 3. /theme/assets/js/main.min.js (in footer) */ function alfath_scripts() { wp_enqueue_style('alfath_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '1.0.0'); wp_enqueue_style('alfath_fa-icon', get_template_directory_uri() . '/assets/css/font-awesome.min.css', false, '4.0.3'); wp_enqueue_style('alfath-icon', get_template_directory_uri() . '/assets/css/alfath-icon.min.css', false, '1.0.0'); if (file_exists(get_template_directory() . '/assets/css/custom.css')) { wp_enqueue_style('alfath_custom', get_template_directory_uri() . '/assets/css/custom.css', array('alfath_main'), filemtime(get_template_directory() . '/assets/css/custom.css'), 'all'); } // jQuery is loaded using the same method from HTML5 Boilerplate: // Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline // It's kept in the header instead of footer to avoid conflicts with plugins. if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', false, null, false); add_filter('script_loader_src', 'alfath_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.7.2.min.js', false, null, false); wp_register_script('jquery-migrate', get_template_directory_uri() . '/assets/js/vendor/jquery-migrate-1.2.1.min.js', array('jquery'), null, false); wp_register_script('alfath_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', false, '1.0.0', true); wp_enqueue_script('modernizr'); wp_enqueue_script('jquery'); wp_enqueue_script('jquery-migrate'); wp_enqueue_script('alfath_scripts'); }
/** * Filter to add php-respimg as an image editor. * * @since 2.3.0 * * @return array Editors. **/ function tevkori_wp_image_editors($editors) { if (current_theme_supports('advanced-image-compression')) { array_unshift($editors, 'WP_Image_Editor_Respimg'); } return $editors; }
/** * Add notices + styles if needed. */ public function add_notices() { if (get_option('_wc_needs_update') == 1 || get_option('_wc_needs_pages') == 1) { wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE)); add_action('admin_notices', array($this, 'install_notice')); } $notices = get_option('woocommerce_admin_notices', array()); if (!empty($_GET['hide_theme_support_notice'])) { $notices = array_diff($notices, array('theme_support')); update_option('woocommerce_admin_notices', $notices); } if (!empty($_GET['hide_template_files_notice'])) { $notices = array_diff($notices, array('template_files')); update_option('woocommerce_admin_notices', $notices); } if (in_array('theme_support', $notices) && !current_theme_supports('woocommerce')) { $template = get_option('template'); if (!in_array($template, array('twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten'))) { wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE)); add_action('admin_notices', array($this, 'theme_check_notice')); } } if (in_array('template_files', $notices)) { wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE)); add_action('admin_notices', array($this, 'template_file_check_notice')); } }
/** * Show admin notice * * Show a message if current theme does not support the plugin. * * @since 0.9 */ function ctc_get_theme_support_notice() { // Theme does not support plugin if (!current_theme_supports('churchthemes-framework')) { // Show only if user has some control over plugins and themes if (!current_user_can('activate_plugins') && !current_user_can('switch_themes')) { return; } // Show only on relavent pages as not to overwhelm admin $screen = get_current_screen(); if (!in_array($screen->base, array('themes', 'plugins')) && !preg_match('/^ctc_.+/', $screen->post_type)) { return; } // Option ID $theme_data = wp_get_theme(); $option_id = 'ctc_hide_theme_support_notice-' . $theme_data['Template']; // unique to theme so if change, message shows again // Message has not been dismissed for this theme if (!get_option($option_id)) { ?> <div class="error"> <p><?php printf(__('The <b>%1$s</b> theme does not support the <b>%2$s</b> plugin. <a href="%3$s" target="_blank">More Information</a>, <a href="%4$s">Dismiss</a>', 'churchthemes-framework'), wp_get_theme(), CTC_NAME, CTC_INFO_URL, add_query_arg('ctc_hide_theme_support_notice', '1')); ?> </p> </div> <?php } } }
/** * Generic embeds * * This helps make embeds more generic by setting parameters to remove * related videos, set neutral colors, reduce branding, etc. * * Enable with: add_theme_support( 'ctc-generic-embeds' ); * * @since 0.9 * @param string $html Embed HTML code * @return string Modified embed HTML code */ function ctc_generic_embeds($html) { // Does theme support this? if (current_theme_supports('ctc-generic-embeds')) { // Get iframe source URL preg_match_all('/<iframe[^>]+src=([\'"])(.+?)\\1[^>]*>/i', $html, $matches); $url = !empty($matches[2][0]) ? $matches[2][0] : ''; // URL found if ($url) { $new_url = ''; $source = ''; $args = array(); // YouTube if (preg_match('/youtube/i', $url)) { $source = 'youtube'; $args = array('wmode' => 'transparent', 'rel' => '0', 'showinfo' => '0', 'color' => 'white', 'modestbranding' => '1'); } elseif (preg_match('/vimeo/i', $url)) { $source = 'vimeo'; $args = array('title' => '0', 'byline' => '0', 'portrait' => '0', 'color' => 'ffffff'); } // Modify URL $args = apply_filters('ctc_generic_embeds_add_args', $args, $source); $new_url = add_query_arg($args, $url); // Replace source with modified URL if ($new_url != $url) { $html = str_replace($url, $new_url, $html); } } } return $html; }
static function is_html5() { if (self::$is_html5 == null) { self::$is_html5 = function_exists('current_theme_supports') && current_theme_supports('html5'); } return self::$is_html5; }
/** * Check the theme, support menu or not * * @see https://codex.wordpress.org/Function_Reference/current_theme_supports * * @return boolean */ function is_support_menus() { if (!current_theme_supports('menus')) { return false; } return true; }
/** * Scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/main.css * * Enqueue scripts in the following order: * 1. jquery-1.11.1.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr.min.js * 3. /theme/assets/js/scripts.js * * Google Analytics is loaded after enqueued scripts if: * - An ID has been defined in config.php * - You're not logged in as an administrator */ function roots_scripts() { /** * The build task in Grunt renames production assets with a hash * Read the asset names from assets-manifest.json */ wp_enqueue_style('google_fonts', 'https://fonts.googleapis.com/css?family=Oswald:400,700', false, null); wp_enqueue_style('font_awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', false, '90912b55a3d6b2070ca68c801a5ef6bb'); if (WP_ENV === 'development') { $assets = array('css' => '/assets/css/main.css', 'js' => '/assets/js/scripts.js', 'modernizr' => '/assets/vendor/modernizr/modernizr.js', 'jquery' => '//code.jquery.com/jquery-1.11.1.min.js', 'owl_carousel' => '/assets/js/plugins/owl.carousel.js'); } else { $get_assets = file_get_contents(get_template_directory() . '/assets/manifest.json'); $assets = json_decode($get_assets, true); $assets = array('css' => '/assets/css/main.min.css?' . $assets['assets/css/main.min.css']['hash'], 'js' => '/assets/js/scripts.min.js?' . $assets['assets/js/scripts.min.js']['hash'], 'modernizr' => '/assets/js/vendor/modernizr.min.js', 'jquery' => '//code.jquery.com/jquery-1.11.1.min.js', 'owl_carousel' => '/assets/js/plugins/owl.carousel.js'); } wp_enqueue_style('roots_css', get_template_directory_uri() . $assets['css'], false, null); /** * jQuery is loaded using the same method from HTML5 Boilerplate: * Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline * It's kept in the header instead of footer to avoid conflicts with plugins. */ if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', $assets['jquery'], array(), null, false); add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false); wp_enqueue_script('jquery'); wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, false); }
public function initialize() { $this->user = new stdClass(); if (is_user_logged_in()) { /* Populate settings we need for the menu based on the current user. */ $this->user->blogs = get_blogs_of_user(get_current_user_id()); if (is_multisite()) { $this->user->active_blog = get_active_blog_for_user(get_current_user_id()); $this->user->domain = empty($this->user->active_blog) ? user_admin_url() : trailingslashit(get_home_url($this->user->active_blog->blog_id)); $this->user->account_domain = $this->user->domain; } else { $this->user->active_blog = $this->user->blogs[get_current_blog_id()]; $this->user->domain = trailingslashit(home_url()); $this->user->account_domain = $this->user->domain; } } add_action('wp_head', 'wp_admin_bar_header'); add_action('admin_head', 'wp_admin_bar_header'); if (current_theme_supports('admin-bar')) { $admin_bar_args = get_theme_support('admin-bar'); // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') ); $header_callback = $admin_bar_args[0]['callback']; } if (empty($header_callback)) { $header_callback = '_admin_bar_bump_cb'; } add_action('wp_head', $header_callback); wp_enqueue_script('admin-bar'); wp_enqueue_style('admin-bar'); do_action('admin_bar_init'); }
/** * Popup Elements * * If this function is defined in a child class the element automatically gets an edit button, that, when pressed * opens a modal window that allows to edit the element properties * * @return void */ function popup_elements() { $this->elements = array(array("name" => __("Add/Edit Toggles", 'avia_framework'), "desc" => __("Here you can add, remove and edit the toggles you want to display.", 'avia_framework'), "type" => "modal_group", "id" => "content", "modal_title" => __("Edit Form Element", 'avia_framework'), "std" => array(array('title' => __('Toggle 1', 'avia_framework'), 'tags' => ''), array('title' => __('Toggle 2', 'avia_framework'), 'tags' => '')), 'subelements' => array(array("name" => __("Toggle Title", 'avia_framework'), "desc" => __("Enter the toggle title here (Better keep it short)", 'avia_framework'), "id" => "title", "std" => "Toggle Title", "type" => "input"), array("name" => __("Toggle Content", 'avia_framework'), "desc" => __("Enter some content here", 'avia_framework'), "id" => "content", "type" => "tiny_mce", "std" => "Toggle Content goes here"), array("name" => __("Toggle Sorting Tags", 'avia_framework'), "desc" => __("Enter any number of comma separated tags here. If sorting is active the user can filter the visible toggles with the help of these tags", 'avia_framework'), "id" => "tags", "std" => "", "type" => "input"))), array("name" => __("Initial Open", 'avia_framework'), "desc" => __("Enter the Number of the Accordion Item that should be open initially. Set to Zero if all should be close on page load ", 'avia_framework'), "id" => "initial", "std" => "0", "type" => "input"), array("name" => __("Behavior", 'avia_framework'), "desc" => __("Should only one toggle be active at a time and the others be hidden or can multiple toggles be open at the same time?", 'avia_framework'), "id" => "mode", "type" => "select", "std" => "accordion", "subtype" => array(__('Only one toggle open at a time (Accordion Mode)', 'avia_framework') => 'accordion', __("Multiple toggles open allowed (Toggle Mode)", 'avia_framework') => 'toggle')), array("name" => __("Sorting", 'avia_framework'), "desc" => __("Display the toggle sorting menu? (You also need to add a number of tags to each toggle to make sorting possible)", 'avia_framework'), "id" => "sort", "type" => "select", "std" => "", "subtype" => array(__('No Sorting', 'avia_framework') => '', __("Sorting Active", 'avia_framework') => 'true'))); if (current_theme_supports('avia_template_builder_custom_tab_toogle_id')) { $this->elements[0]['subelements'][] = array("name" => __("For Developers: Custom Toggle ID", 'avia_framework'), "desc" => __("Insert a custom ID for the element here. Make sure to only use allowed characters", 'avia_framework'), "id" => "custom_id", "type" => "input", "std" => ""); } }
/** * Overrides the load textdomain functionality when 'hybrid-core' is the domain in use. The purpose of * this is to allow theme translations to handle the framework's strings. What this function does is * sets the 'hybrid-core' domain's translations to the theme's. That way, we're not loading multiple * of the same MO files. * * @since 2.0.0 * @access public * @globl array $l10n * @param bool $override * @param string $domain * @param string $mofile * @return bool */ function hybrid_override_load_textdomain($override, $domain, $mofile) { /* Set up array of domains to catch. */ $text_domains = array('hybrid-core'); if (current_theme_supports('breadcrumb-trail')) { $text_domains[] = 'breadcrumb-trail'; } if (current_theme_supports('post-stylesheets')) { $text_domains[] = 'post-stylesheets'; } if (current_theme_supports('theme-layouts')) { $text_domains[] = 'theme-layouts'; } /* Check if the domain is one of our framework domains. */ if (in_array($domain, $text_domains)) { global $l10n; /* Get the theme's textdomain. */ $theme_textdomain = hybrid_get_parent_textdomain(); /* If the theme's textdomain is loaded, use its translations instead. */ if (!empty($theme_textdomain) && isset($l10n[$theme_textdomain])) { $l10n[$domain] = $l10n[$theme_textdomain]; } /* Always override. We only want the theme to handle translations. */ $override = true; } return $override; }
/** * Ping http://api.genesistheme.com/ asking if a new version of this theme is available. * * If not, it returns false. * * If so, the external server passes serialized data back to this function, which gets unserialized and returned for use. * * Applies `genesis_update_remote_post_options` filter. * * Ping occurs at a maximum of once every 24 hours. * * @since 1.1.0 * * @uses genesis_get_option() Get theme setting value. * @uses genesis_html5() Check for HTML5 support. * @uses PARENT_THEME_VERSION Genesis version string. * * @global string $wp_version WordPress version string. * * @return array Unserialized data, or empty on failure. */ function genesis_update_check() { //* Use cache static $genesis_update = null; global $wp_version; //* If updates are disabled if (!genesis_get_option('update') || !current_theme_supports('genesis-auto-updates')) { return array(); } //* If cache is empty, pull transient if (!$genesis_update) { $genesis_update = get_transient('genesis-update'); } //* If transient has expired, do a fresh update check if (!$genesis_update) { $url = 'http://api.genesistheme.com/update-themes/'; $options = apply_filters('genesis_update_remote_post_options', array('body' => array('genesis_version' => PARENT_THEME_VERSION, 'html5' => genesis_html5(), 'php_version' => phpversion(), 'uri' => home_url(), 'user-agent' => "WordPress/{$wp_version};", 'wp_version' => $wp_version))); $response = wp_remote_post($url, $options); $genesis_update = wp_remote_retrieve_body($response); //* If an error occurred, return FALSE, store for 1 hour if ('error' === $genesis_update || is_wp_error($genesis_update) || !is_serialized($genesis_update)) { set_transient('genesis-update', array('new_version' => PARENT_THEME_VERSION), 60 * 60); return array(); } //* Else, unserialize $genesis_update = maybe_unserialize($genesis_update); //* And store in transient for 24 hours set_transient('genesis-update', $genesis_update, 60 * 60 * 24); } //* If we're already using the latest version, return empty array. if (version_compare(PARENT_THEME_VERSION, $genesis_update['new_version'], '>=')) { return array(); } return $genesis_update; }
/** * Add notices + styles if needed. */ public function add_notices() { if (get_option('_wc_needs_update') == 1 || get_option('_wc_needs_pages') == 1) { wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE)); add_action('admin_notices', array($this, 'install_notice')); } $notices = get_option('woocommerce_admin_notices', array()); if (!empty($_GET['hide_theme_support_notice'])) { $notices = array_diff($notices, array('theme_support')); update_option('woocommerce_admin_notices', $notices); } if (!empty($_GET['hide_template_files_notice'])) { $notices = array_diff($notices, array('template_files')); update_option('woocommerce_admin_notices', $notices); } if (in_array('theme_support', $notices) && !current_theme_supports('woocommerce')) { $template = get_option('template'); if (!in_array($template, wc_get_core_supported_themes())) { wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE)); add_action('admin_notices', array($this, 'theme_check_notice')); } } if (in_array('template_files', $notices)) { wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE)); add_action('admin_notices', array($this, 'template_file_check_notice')); } if (in_array('translation_upgrade', $notices)) { wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE)); add_action('admin_notices', array($this, 'translation_upgrade_notice')); } if (!class_exists('WC_Mijireh_Checkout') && ($mijireh = get_option('woocommerce_mijireh_checkout_settings', false)) && !empty($mijireh['enabled']) && $mijireh['enabled'] === 'yes' && empty($_GET['action'])) { add_action('admin_notices', array($this, 'mijireh_notice')); } }
/** * Loads the `admin-widgets.css` file when viewing the widgets screen. * * @since 0.9.0 * @access public * @return void */ function omega_admin_enqueue_styles($hook_suffix) { wp_enqueue_style('omega-admin'); if (current_theme_supports('omega-widgets') && 'widgets.php' == $hook_suffix) { wp_enqueue_style('omega-admin-widgets'); } }
/** * Activates default theme features. * * @since 1.6.0 */ function genesis_theme_support() { add_theme_support('menus'); add_theme_support('post-thumbnails'); add_theme_support('automatic-feed-links'); add_theme_support('genesis-inpost-layouts'); add_theme_support('genesis-archive-layouts'); add_theme_support('genesis-admin-menu'); add_theme_support('genesis-seo-settings-menu'); add_theme_support('genesis-import-export-menu'); add_theme_support('genesis-readme-menu'); add_theme_support('genesis-auto-updates'); add_theme_support('genesis-breadcrumbs'); //* Maybe add support for Genesis menus if (!current_theme_supports('genesis-menus')) { add_theme_support('genesis-menus', array('primary' => __('Primary Navigation Menu', 'genesis'), 'secondary' => __('Secondary Navigation Menu', 'genesis'))); } //* Maybe add support for structural wraps if (!current_theme_supports('genesis-structural-wraps')) { add_theme_support('genesis-structural-wraps', array('header', 'menu-primary', 'menu-secondary', 'footer-widgets', 'footer')); } //* Turn on HTML5, responsive viewport & footer widgets if Genesis is active if (!is_child_theme()) { add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption')); add_theme_support('genesis-responsive-viewport'); add_theme_support('genesis-footer-widgets', 3); } }
function __construct(&$owner) { parent::__construct($owner, get_class($this), __('General Settings', XF_TEXTDOMAIN)); $measures = $this->owner->get_measures(); $this->options[] = new xtreme_option_bool($this, false, 'responsive', __('Responsive Design:', XF_TEXTDOMAIN), false); $this->options[] = new xtreme_option_bool($this, false, 'html5', __('Output HTML5:', XF_TEXTDOMAIN), false); $this->options[] = new xtreme_option_numeric($this, false, 'bodyfontsize', __('Body Fontsize:', XF_TEXTDOMAIN), 75, '%', $measures, false, array('%' => array(62.5, 68.75, 75.0, 81.25, 87.5, 100.0))); $this->options[] = new xtreme_option_select_pair($this, false, 'layout', __('Layout:', XF_TEXTDOMAIN), 1, array(__('fixed', XF_TEXTDOMAIN), __('flexible', XF_TEXTDOMAIN))); $this->options[] = new xtreme_option_numeric($this, false, 'minwidth', __('Minimum Layout Width:', XF_TEXTDOMAIN), 740, 'px', $measures, array('px' => array(100, 2000)), false, false); $this->options[] = new xtreme_option_numeric($this, false, 'maxwidth', __('Maximum Layout Width:', XF_TEXTDOMAIN), 80, 'em', $measures, array('em' => array(20, 200), '%' => array(20, 100)), false, false); $this->options[] = new xtreme_option_numeric($this, false, 'width', __('Layout Width:', XF_TEXTDOMAIN), 960, 'px', $measures, array('px' => array(100, 2000)), false, false); $this->options[] = new xtreme_option_select_pair($this, false, 'layoutalign', __('Alignment:', XF_TEXTDOMAIN), 1, array(__('left', XF_TEXTDOMAIN), __('center', XF_TEXTDOMAIN), __('right', XF_TEXTDOMAIN))); $this->options[] = new xtreme_option_select_pair($this, false, 'appearance', __('Design:', XF_TEXTDOMAIN), 0, array(__('blog layout', XF_TEXTDOMAIN), __('full page layout', XF_TEXTDOMAIN))); if (current_theme_supports('xtreme-color-styles')) { $support = get_theme_support('xtreme-color-styles'); $colors = $support[0]; $color_keys = array_keys($colors); $this->options[] = new xtreme_option_select_pair($this, false, 'color_styles', __('Color Style:', XF_TEXTDOMAIN), $color_keys[0], $colors); } else { $this->options[] = new xtreme_option_hidden($this, false, 'color_styles', '', ''); } /* $this->options[] = new xtreme_option_select_pair($this, false, 'post_socials', __('Social Bookmark Support on Posts:', XF_TEXTDOMAIN), 'none', array('disabled' => __('disabled', XF_TEXTDOMAIN), 'none' => __('enabled, but not predefined', XF_TEXTDOMAIN), 'option' => __('enabled, predefined globally', XF_TEXTDOMAIN), 'postmeta' => __('enabled, predefined post specific', XF_TEXTDOMAIN))); $this->options[] = new xtreme_option_select_pair($this, false, 'post_socials_layout', __('Social Bookmark Layout Placement:', XF_TEXTDOMAIN), 'xtreme_after_single_post', array('xtreme_before_single_post' => __('before the post', XF_TEXTDOMAIN), 'xtreme_after_single_post' => __('after the post', XF_TEXTDOMAIN), 'xtreme_authorbox_inside_vcard' => __('inside author box', XF_TEXTDOMAIN), 'xtreme_after_comments_template' => __('after comments', XF_TEXTDOMAIN), 'xtreme_social_template_tag' =>__('manual template tag', XF_TEXTDOMAIN) )); */ $this->options[] = new xtreme_option_bool($this, false, 'aria_required', __('Activate WAI Aria Roles:', XF_TEXTDOMAIN), false); $this->options[] = new xtreme_option_bool($this, false, 'nav_vlist', __('Include YAMLs nav_vlist.css:', XF_TEXTDOMAIN), false); $this->options[] = new xtreme_option_description($this, false, 'desc_row', '<em>' . __('If you switch the content position, make sure to check your settings in the layout manager for every layout.', XF_TEXTDOMAIN) . '</em>'); $this->options[] = new xtreme_option_bool($this, false, 'layout_2', __('Generate Markup with Content at first Position:', XF_TEXTDOMAIN), false); }
/** * Register a new post thumbnail. * * Required $args contents: * * label - The name of the post thumbnail to display in the admin metabox * * id - Used to build the CSS class for the admin meta box. Needs to be unique and valid in a CSS class selector. * * Optional $args contents: * * post_type - The post type to register this thumbnail for. Defaults to post. * * priority - The admin metabox priority. Defaults to 'low'. * * context - The admin metabox context. Defaults to 'side'. * * @param array|string $args See above description. * @return void */ public function register($args = array()) { global $wp_version; $defaults = array('label' => null, 'id' => null, 'post_type' => 'post', 'priority' => 'low', 'context' => 'side'); $args = wp_parse_args($args, $defaults); // Create and set properties foreach ($args as $k => $v) { $this->{$k} = $v; } // Need these args to be set at a minimum if (null === $this->label || null === $this->id) { if (WP_DEBUG) { trigger_error(sprintf(__("The 'label' and 'id' values of the 'args' parameter of '%s::%s()' are required", 'multiple-post-thumbnails'), __CLASS__, __FUNCTION__)); } return; } // add theme support if not already added if (!current_theme_supports('post-thumbnails')) { add_theme_support('post-thumbnails'); } add_action('add_meta_boxes', array($this, 'add_metabox')); if (version_compare($wp_version, '3.5', '<')) { add_filter('attachment_fields_to_edit', array($this, 'add_attachment_field'), 20, 2); } add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); add_action('admin_print_scripts-post.php', array($this, 'admin_header_scripts')); add_action('admin_print_scripts-post-new.php', array($this, 'admin_header_scripts')); add_action("wp_ajax_set-{$this->post_type}-{$this->id}-thumbnail", array($this, 'set_thumbnail')); add_action('delete_attachment', array($this, 'action_delete_attachment')); add_filter('is_protected_meta', array($this, 'filter_is_protected_meta'), 20, 2); }
/** * Custom post type definition * * @access public * @return void */ public static function definition() { $labels = array('name' => __('CRM', 'realia'), 'singular_name' => __('Landlord', 'realia'), 'add_new' => __('Add New', 'realia'), 'add_new_item' => __('Add New Landlord', 'realia'), 'edit_item' => __('Edit Landlord', 'realia'), 'new_item' => __('New Landlord', 'realia'), 'all_items' => __('All Landlords', 'realia'), 'view_item' => __('View Landlord', 'realia'), 'search_items' => __('Search Landlord', 'realia'), 'not_found' => __('No landlords found', 'realia'), 'not_found_in_trash' => __('No landlords found in Trash', 'realia'), 'parent_item_colon' => '', 'menu_name' => __('CRM', 'realia')); if (current_theme_supports('realia-landlords')) { register_post_type('landlord', array('labels' => $labels, 'supports' => array('title', 'editor'), 'public' => false, 'show_ui' => true, 'rewrite' => false, 'menu_position' => 46, 'menu_icon' => 'dashicons-id')); } }
/** * Only add the watermkaring admin optins if the current theme suports it, as we don;t want to clutter * for poeple who don't care * */ function wpthumb_add_crop_from_position_admin_hooks() { if (current_theme_supports('wpthumb-crop-from-position')) { add_filter('attachment_fields_to_edit', 'wpthumb_media_form_crop_position', 10, 2); add_filter('attachment_fields_to_save', 'wpthumb_media_form_crop_position_save', 10, 2); } }
/** * Custom post type definition * * @access public * @return void */ public static function definition() { $labels = array('name' => __('Partners', 'realia'), 'singular_name' => __('Partner', 'realia'), 'add_new' => __('Add New Partner', 'realia'), 'add_new_item' => __('Add New Partner', 'realia'), 'edit_item' => __('Edit Partner', 'realia'), 'new_item' => __('New Partner', 'realia'), 'all_items' => __('All Partners', 'realia'), 'view_item' => __('View Partner', 'realia'), 'search_items' => __('Search Partner', 'realia'), 'not_found' => __('No Partners found', 'realia'), 'not_found_in_trash' => __('No Partners found in Trash', 'realia'), 'parent_item_colon' => '', 'menu_name' => __('Partners', 'realia')); if (current_theme_supports('realia-partners')) { register_post_type('partner', array('labels' => $labels, 'menu_icon' => 'dashicons-portfolio', 'supports' => array('title', 'thumbnail'), 'public' => true, 'exclude_from_search' => true, 'publicly_queryable' => false, 'has_archive' => false, 'rewrite' => false, 'menu_position' => 48, 'show_in_nav_menus' => false)); } }
/** * Creates new shortcodes for use in any shortcode-ready area. This function uses the add_shortcode() * function to register new shortcodes with WordPress. * * @since 0.8.0 * @access public * @uses add_shortcode() to create new shortcodes. * @link http://codex.wordpress.org/Shortcode_API * @return void */ function hybrid_add_shortcodes() { /* Add theme-specific shortcodes. */ add_shortcode('the-year', 'hybrid_the_year_shortcode'); add_shortcode('site-link', 'hybrid_site_link_shortcode'); add_shortcode('wp-link', 'hybrid_wp_link_shortcode'); add_shortcode('theme-link', 'hybrid_theme_link_shortcode'); add_shortcode('child-link', 'hybrid_child_link_shortcode'); /* Only register deprected shortcodes if the theme supports deprecated functions. */ if (current_theme_supports('hybrid-core-deprecated')) { /* Theme shortcodes. */ add_shortcode('loginout-link', 'hybrid_loginout_link_shortcode'); add_shortcode('query-counter', 'hybrid_query_counter_shortcode'); add_shortcode('nav-menu', 'hybrid_nav_menu_shortcode'); /* Add entry-specific shortcodes. */ add_shortcode('entry-title', 'hybrid_entry_title_shortcode'); add_shortcode('entry-author', 'hybrid_entry_author_shortcode'); add_shortcode('entry-terms', 'hybrid_entry_terms_shortcode'); add_shortcode('entry-comments-link', 'hybrid_entry_comments_link_shortcode'); add_shortcode('entry-published', 'hybrid_entry_published_shortcode'); add_shortcode('entry-edit-link', 'hybrid_entry_edit_link_shortcode'); add_shortcode('entry-shortlink', 'hybrid_entry_shortlink_shortcode'); add_shortcode('entry-permalink', 'hybrid_entry_permalink_shortcode'); add_shortcode('post-format-link', 'hybrid_post_format_link_shortcode'); /* Add comment-specific shortcodes. */ add_shortcode('comment-published', 'hybrid_comment_published_shortcode'); add_shortcode('comment-author', 'hybrid_comment_author_shortcode'); add_shortcode('comment-edit-link', 'hybrid_comment_edit_link_shortcode'); add_shortcode('comment-reply-link', 'hybrid_comment_reply_link_shortcode'); add_shortcode('comment-permalink', 'hybrid_comment_permalink_shortcode'); } }
/** * Register a new post thumbnail. * * Required $args contents: * * label - The name of the post thumbnail to display in the admin metabox * * id - Used to build the CSS class for the admin meta box. Needs to be unique and valid in a CSS class selector. * * Optional $args contents: * * post_type - The post type to register this thumbnail for. Defaults to post. * * priority - The admin metabox priority. Defaults to low to show after normal post thumbnail meta box. * * @param array|string $args See above description. * @return void */ public function register($args = array()) { global $wp_version; $defaults = array('label' => null, 'id' => null, 'post_type' => 'post', 'priority' => 'low'); $args = wp_parse_args($args, $defaults); // Create and set properties foreach ($args as $k => $v) { $this->{$k} = $v; } // Need these args to be set at a minimum if (null === $this->label || null === $this->id) { if (WP_DEBUG) { trigger_error(sprintf("The 'label' and 'id' values of the 'args' parameter of '%s::%s()' are required", __CLASS__, __FUNCTION__)); } return; } $this->prefix = "{$this->post_type}-{$this->id}"; $this->meta_key = "{$this->post_type}_{$this->id}_thumbnail_id"; // add theme support if not already added if (!current_theme_supports('post-thumbnails')) { add_theme_support('post-thumbnails'); } // use modal style media popup for versions after 3.4.2. ugly, but works with 3.5 betas. if (version_compare($wp_version, '3.6', '>')) { add_action('add_meta_boxes', array($this, 'add_metabox_modal')); add_action('save_post', array($this, 'action_save_post')); } else { add_action('add_meta_boxes', array($this, 'add_metabox')); add_filter('attachment_fields_to_edit', array($this, 'add_attachment_field'), 20, 2); add_action("wp_ajax_set-{$this->post_type}-{$this->id}-thumbnail", array($this, 'set_thumbnail')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); } add_action('delete_attachment', array($this, 'action_delete_attachment')); }