function chld_thm_cfg_version($src, $handle)
{
    if (strstr($src, get_stylesheet())) {
        $src = preg_replace("/ver=(.*?)(\\&|\$)/", 'ver=' . wp_get_theme()->Version . "\$2", $src);
    }
    return $src;
}
コード例 #2
0
 /**
  * Start previewing the selected theme.
  *
  * Adds filters to change the current theme.
  *
  * @since 3.4.0
  */
 public function start_previewing_theme()
 {
     if ($this->is_preview() || false === $this->theme || $this->theme && !$this->theme->exists()) {
         return;
     }
     // Initialize $theme and $original_stylesheet if they do not yet exist.
     if (!isset($this->theme)) {
         $this->theme = wp_get_theme($_REQUEST['theme']);
         if (!$this->theme->exists()) {
             $this->theme = false;
             return;
         }
     }
     $this->original_stylesheet = get_stylesheet();
     $this->previewing = true;
     add_filter('template', array($this, 'get_template'));
     add_filter('stylesheet', array($this, 'get_stylesheet'));
     add_filter('pre_option_current_theme', array($this, 'current_theme'));
     // @link: http://core.trac.wordpress.org/ticket/20027
     add_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
     add_filter('pre_option_template', array($this, 'get_template'));
     // Handle custom theme roots.
     add_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
     add_filter('pre_option_template_root', array($this, 'get_template_root'));
     do_action('start_previewing_theme');
 }
コード例 #3
0
 /**
  * get status of settings
  *
  * ## EXAMPLES
  *
  *     wp multi-device status
  *
  */
 public function status($args, $assoc_args)
 {
     $options = get_option($this->options);
     $rows = array();
     $slug_table = array('None' => '');
     $themes = wp_get_themes();
     foreach ($themes as $theme_slug => $header) {
         $slug_table[$header->get('Name')] = $theme_slug;
     }
     $rows[] = array('Device' => 'smartphone (Smart Phone)', 'Theme' => $options['theme_smartphone'], 'Slug' => $slug_table[$options['theme_smartphone']], 'UserAgent' => $options['userAgent_smart']);
     $rows[] = array('Device' => 'tablet (Tablet PC)', 'Theme' => $options['theme_tablet'], 'Slug' => $slug_table[$options['theme_tablet']], 'UserAgent' => $options['userAgent_tablet']);
     $rows[] = array('Device' => 'mobile (Mobile Phone)', 'Theme' => $options['theme_mobile'], 'Slug' => $slug_table[$options['theme_mobile']], 'UserAgent' => $options['userAgent_mobile']);
     $rows[] = array('Device' => 'game (Game Platforms)', 'Theme' => $options['theme_game'], 'Slug' => $slug_table[$options['theme_game']], 'UserAgent' => $options['userAgent_game']);
     foreach ($options as $custom_switcher_option => $custom_switcher_theme) {
         if (!preg_match('/^custom_switcher_theme_/', $custom_switcher_option)) {
             continue;
         }
         $custom_switcher_name = preg_replace('/^custom_switcher_theme_/', '', $custom_switcher_option);
         $rows[] = array('Device' => $custom_switcher_name, 'Theme' => $options['custom_switcher_theme_' . $custom_switcher_name], 'Slug' => $slug_table[$options['custom_switcher_theme_' . $custom_switcher_name]], 'UserAgent' => $options['custom_switcher_userAgent_' . $custom_switcher_name]);
     }
     $default_theme = wp_get_theme()->get('Name');
     $default_theme .= ' | ';
     $default_theme .= get_stylesheet();
     WP_CLI::line('Active Theme: ' . $default_theme);
     WP_CLI\Utils\format_items('table', $rows, array('Device', 'Theme', 'Slug', 'UserAgent'));
     $line = '';
     $line .= 'PC Switcher: ';
     $line .= $options['pc_switcher'] ? 'on' : 'off';
     $line .= "\n";
     $line .= 'default CSS: ';
     $line .= $options['default_css'] ? 'on' : 'off';
     WP_CLI::line($line);
 }
コード例 #4
0
ファイル: customizer.php プロジェクト: faithmade/rock
 /**
  * Class constructor.
  */
 public function __construct()
 {
     self::$stylesheet = get_stylesheet();
     /**
      * Load Customizer Colors functionality.
      *
      * @since 1.0.0
      */
     require_once get_template_directory() . '/inc/customizer/colors.php';
     /**
      * Load Customizer Fonts functionality.
      *
      * @since 1.0.0
      */
     require_once get_template_directory() . '/inc/customizer/fonts.php';
     /**
      * Load Customizer Layouts functionality.
      *
      * @since 1.0.0
      */
     require_once get_template_directory() . '/inc/customizer/layouts.php';
     add_action('after_setup_theme', array($this, 'logo'));
     add_action('customize_register', array($this, 'selective_refresh'), 11);
     add_action('customize_register', array($this, 'use_featured_hero_image'));
     add_action('customize_preview_init', array($this, 'customize_preview_js'));
 }
コード例 #5
0
    public function admin_page()
    {
        ?>
<h1>Theme Search</h1>
<?php 
        if (isset($_POST['search'])) {
            $search = $_POST['search'];
            $theme = wp_get_theme();
            $stylesheet = get_stylesheet();
            $files = $theme->get_files();
            echo '<ul>';
            foreach ($files as $key => $file) {
                $f = fopen($file, 'r');
                $content = fread($f, filesize($file));
                if (stripos($content, $search) !== FALSE) {
                    echo '<li><a href="theme-editor.php?file=' . urlencode($key) . '&theme=' . urlencode($stylesheet) . '">' . $file . '</a></li>';
                }
                fclose($f);
            }
            echo '</ul>';
        }
        ?>
<form method="post" action="themes.php?page=theme-search">
<p>Search for: <input type="text" name="search" /></p>
</form>
<?php 
    }
コード例 #6
0
 public function update_breakpoints()
 {
     if (!Upfront_Permissions::current(Upfront_Permissions::SAVE)) {
         $this->_reject();
     }
     $breakpoints = isset($_POST['breakpoints']) ? $_POST['breakpoints'] : array();
     // Parse data types
     foreach ($breakpoints as $index => $breakpoint) {
         $breakpoints[$index]['enabled'] = filter_var($breakpoint['enabled'], FILTER_VALIDATE_BOOLEAN);
         $breakpoints[$index]['default'] = filter_var($breakpoint['default'], FILTER_VALIDATE_BOOLEAN);
         $breakpoints[$index]['width'] = filter_var($breakpoint['width'], FILTER_VALIDATE_INT);
         $breakpoints[$index]['columns'] = filter_var($breakpoint['columns'], FILTER_VALIDATE_INT);
         if (isset($breakpoint['fixed'])) {
             $breakpoints[$index]['fixed'] = filter_var($breakpoint['fixed'], FILTER_VALIDATE_BOOLEAN);
         }
     }
     $responsive_settings = get_option('upfront_' . get_stylesheet() . '_responsive_settings');
     $responsive_settings = apply_filters('upfront_get_responsive_settings', $responsive_settings);
     if (empty($responsive_settings)) {
         $responsive_settings = array('breakpoints' => $breakpoints);
     } else {
         if (is_string($responsive_settings)) {
             $responsive_settings = json_decode($responsive_settings);
         }
         $responsive_settings = (array) $responsive_settings;
         $responsive_settings['breakpoints'] = $breakpoints;
     }
     do_action('upfront_update_responsive_settings', $responsive_settings);
     if (!has_action('upfront_update_responsive_settings')) {
         update_option('upfront_' . get_stylesheet() . '_responsive_settings', json_encode($responsive_settings));
     }
     $this->_out(new Upfront_JsonResponse_Success(get_stylesheet() . ' responsive settings updated'));
 }
コード例 #7
0
 function after()
 {
     $update_actions = array();
     if (!empty($this->upgrader->result['destination_name']) && ($theme_info = $this->upgrader->theme_info()) && !empty($theme_info)) {
         $name = $theme_info['Name'];
         $stylesheet = $this->upgrader->result['destination_name'];
         $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
         $template = $this->installed_theme_key;
         $stylesheet = $this->installed_theme_key;
         $theme_info = get_theme_data(trailingslashit(WP_CONTENT_DIR) . 'themes/' . $stylesheet);
         if (!empty($theme_info['Template'])) {
             $template = $theme_info['Template'];
         }
         // End IF Statement
         $preview_link = htmlspecialchars(add_query_arg(array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true'), trailingslashit(esc_url(get_option('home')))));
         $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
         $update_actions['preview'] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;', 'woothemes'), $name)) . '">' . __('Preview', 'woothemes') . '</a>';
         $update_actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr(sprintf(__('Activate &#8220;%s&#8221;', 'woothemes'), $name)) . '">' . __('Activate', 'woothemes') . '</a>';
         if (!$this->result || is_wp_error($this->result) || $stylesheet == get_stylesheet()) {
             unset($update_actions['preview'], $update_actions['activate']);
         }
         $update_actions['themes_page'] = '<a href="' . admin_url('themes.php?page=woo-installer') . '" title="' . esc_attr(__('Install other WooThemes', 'woothemes')) . '" target="_parent">' . __('Install other WooThemes', 'woothemes') . '</a>';
     }
     $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->installed_theme_key);
     if (!empty($update_actions)) {
         $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array) $update_actions));
     }
 }
コード例 #8
0
/**
 * Load theme compat file if it exists.
 */
function jetpack_load_theme_compat()
{
    /**
     * Filter theme compat files.
     *
     * Themes can add their own compat files here if they like. For example:
     *
     * add_filter( 'jetpack_theme_compat_files', 'mytheme_jetpack_compat_file' );
     * function mytheme_jetpack_compat_file( $files ) {
     *     $files['mytheme'] = locate_template( 'jetpack-compat.php' );
     *     return $files;
     * }
     *
     * @module theme-tools
     *
     * @since 2.8.0
     *
     * @param array Associative array of theme compat files to load.
     */
    $compat_files = apply_filters('jetpack_theme_compat_files', array('twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php', 'twentyfifteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfifteen.php'));
    _jetpack_require_compat_file(get_stylesheet(), $compat_files);
    if (is_child_theme()) {
        _jetpack_require_compat_file(get_template(), $compat_files);
    }
}
コード例 #9
0
/**
 * Fixes 1 Click demo import when invalid data was imported
 */
function ct_fix_invalid_menus()
{
    $key = 'theme_mods_' . get_stylesheet();
    if (!is_array(get_option($key))) {
        update_option($key, array());
    }
}
コード例 #10
0
ファイル: admin.php プロジェクト: SublimeCoralie/project-ar2
/**
 * Retrieves default setting fields for theme options.
 * @since 1.6
 */
function ar2_theme_options_default_fields()
{
    global $ar2_image_sizes, $ar2_styles;
    $_defaults = array('theme_version' => array('type' => 'static', 'title' => __('Version', 'ar2'), 'section' => 'ar2_general_site_info', 'content' => '<strong>' . wp_get_theme()->get('Version') . '</strong>', 'description' => __('If you have recently upgraded Project AR2 to a new release, it is <span style="color: red">highly recommended</span> that you reset your theme options, clear your browser cache and restart your browser before proceeding.', 'ar2')), 'site_rss_feed' => array('type' => 'static', 'title' => __('RSS Feed', 'ar2'), 'section' => 'ar2_general_social', 'content' => '<code>' . get_feed_link('rss2') . '</code>', 'description' => __('Custom feed URLs are no longer allowed due to support for automatic feed links.', 'ar2')), 'social_twitter' => array('type' => 'input', 'title' => __('Twitter Username', 'ar2'), 'section' => 'ar2_general_social'), 'social_facebook' => array('type' => 'input', 'title' => __('Facebook Username', 'ar2'), 'section' => 'ar2_general_social'), 'social_flickr' => array('type' => 'input', 'title' => __('Flickr ID', 'ar2'), 'section' => 'ar2_general_social'), 'social_gplus' => array('type' => 'input', 'title' => __('Google+ ID', 'ar2'), 'section' => 'ar2_general_social'), 'social_youtube' => array('type' => 'input', 'title' => __('YouTube Channel ID', 'ar2'), 'section' => 'ar2_general_social'), 'footer_message' => array('type' => 'textarea_html', 'title' => __('Footer Message', 'ar2'), 'section' => 'ar2_general_footer', 'description' => __("Usually your website's copyright information would go here.<br /> It would be great if you could include a link to WordPress or the theme website. :)", 'ar2'), 'extras' => 'class="code"'), 'nodebased_show_excerpts' => array('type' => 'switch', 'title' => __('Show Excerpts', 'ar2'), 'section' => 'ar2_layout_excerpts'), 'excerpt_limit' => array('type' => 'input', 'title' => __('Excerpt Limit', 'ar2'), 'section' => 'ar2_layout_excerpts', 'extras' => 'style="width: 50px" maxlength="2"', 'description' => __('Excerpts will only be trimmed to the limit if no excerpt is specified for the respective post.', 'ar2')), 'archive_display' => array('type' => 'dropdown', 'title' => __('Display Type', 'ar2'), 'section' => 'ar2_layout_archive', 'options' => ar2_get_archive_display_types()), 'single_posts_display' => array('type' => 'custom', 'title' => __('Display in Single Posts', 'ar2'), 'section' => 'ar2_layout_single', 'callback' => 'ar2_render_single_form_field', 'setting' => 'ar2_theme_options[post_display]'), 'relative_dates' => array('type' => 'checkbox', 'title' => __('Display Relative Post Dates', 'ar2'), 'section' => 'ar2_layout_single', 'description' => __('Check this to display post dates relative to current time (eg. 2 days ago ).', 'ar2')), 'auto_thumbs' => array('type' => 'checkbox', 'title' => __('Auto Thumbnails', 'ar2'), 'section' => 'ar2_thumbnails_options', 'description' => __('Check this to allow the theme to automatically retrieve the first attached image from the post as featured image when no image is specified.', 'ar2')), 'layout' => array('type' => 'dropdown', 'title' => __('No of Columns', 'ar2'), 'section' => 'ar2_design_overall', 'options' => $ar2_styles->get_layouts()), 'import_theme_options' => array('type' => 'textarea', 'title' => __('Import Theme Options', 'ar2'), 'section' => 'ar2_tools_port', 'description' => __('Import your theme settings by pasting the exported code in the textbox above.', 'ar2'), 'extras' => 'class="code"'), 'export_theme_options' => array('type' => 'textarea', 'title' => __('Export Theme Options', 'ar2'), 'section' => 'ar2_tools_port', 'description' => __('You can save the code above into a text file and use it when you need to import them into another installation. Note that not all options (custom background, child theme settings, etc.) will be exported.', 'ar2'), 'extras' => 'class="code"', 'value' => json_encode(ar2_flush_theme_options())));
    foreach ($ar2_image_sizes as $id => $args) {
        $_defaults[$id] = array('type' => 'thumbnail-size', 'title' => $args['name'], 'setting' => 'ar2_theme_options[thumbnails][' . $id . ']', 'section' => 'ar2_thumbnails_sizes', 'width' => $args['w'], 'height' => $args['h'], 'd_width' => $args['dw'], 'd_height' => $args['dh']);
    }
    if (AR2_ALLOW_CUSTOM_STYLES) {
        $_defaults['style'] = array('type' => 'dropdown', 'title' => __('Custom Stylesheet', 'ar2'), 'section' => 'ar2_design_overall', 'options' => ar2_get_custom_css_files(), 'description' => sprintf(__('Stylesheets can be placed in %s.', 'ar2'), '<code>wp-content/themes/' . get_stylesheet() . '/css/styles/</code>'));
    }
    // Allow developers to add more fields
    $_defaults = apply_filters('ar2_theme_options_fields', $_defaults);
    // Process the fields
    $sections = ar2_theme_options_default_sections();
    $_default_args = array('title' => '', 'type' => 'static', 'section' => 'ar2_general_site_info', 'page' => 'ar2_general', 'content' => '', 'extras' => '');
    foreach ($_defaults as $id => &$args) {
        if (!isset($args['setting'])) {
            $args['setting'] = 'ar2_theme_options[' . $id . ']';
        }
        // Parse the ID for array keys (adapted from WP_Customize_Setting class).
        $args['_id_data']['keys'] = preg_split('/\\[/', str_replace(']', '', $args['setting']));
        $args['_id_data']['base'] = array_shift($args['_id_data']['keys']);
        if (isset($sections[$args['section']])) {
            $args['page'] = $sections[$args['section']]['page'];
        }
        $args = wp_parse_args($args, $_default_args);
    }
    return $_defaults;
}
コード例 #11
0
ファイル: Theme.php プロジェクト: audiotheme/audiotheme-agent
 /**
  * Whether the theme is active.
  *
  * @since 1.0.0
  *
  * @return boolean
  */
 public function is_active()
 {
     if (is_multisite()) {
         return false;
     }
     return get_stylesheet() === $this->get_slug() || get_template() === $this->get_slug();
 }
コード例 #12
0
/**
 * Enqueues scripts and styles.
 */
function thoughtfulmuse_scripts()
{
    // Parent theme stylesheet
    wp_enqueue_style('twentysixteen-style', get_template_directory_uri() . '/style.css', false, filemtime(get_template_directory() . '/style.css'));
    // Child theme stylesheet
    wp_enqueue_style('thoughtfulmuse-style', get_stylesheet_uri(), array('twentysixteen-style'), filemtime(get_stylesheet()));
}
コード例 #13
0
ファイル: functions.php プロジェクト: slfrsn/Divi-Cinematic
function automatic_GitHub_updates($data)
{
    // Theme information
    $theme = get_stylesheet();
    // Get the folder name of the current theme
    $current = wp_get_theme()->get('Version');
    // Get the version of the current theme
    // GitHub information
    $user = '******';
    // The GitHub username hosting the repository
    $repo = 'divi-cinematic';
    // Repository name as it appears in the URL
    // Get the latest release tag from the repository. The User-Agent header must be sent, as per
    // GitHub's API documentation: https://developer.github.com/v3/#user-agent-required
    $file = @json_decode(@file_get_contents('https://api.github.com/repos/' . $user . '/' . $repo . '/releases/latest', false, stream_context_create(['http' => ['header' => "User-Agent: " . $user . "\r\n"]])));
    if ($file) {
        // Strip the version number of any non-alpha characters (excluding the period)
        // This way you can still use tags like v1.1 or ver1.1 if desired
        $update = filter_var($file->tag_name, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        // Only return a response if the new version number is higher than the current version
        if ($update > $current) {
            $data->response[$theme] = array('theme' => $theme, 'new_version' => $update, 'url' => 'https://github.com/' . $user . '/' . $repo, 'package' => $file->assets[0]->browser_download_url);
        }
    }
    return $data;
}
コード例 #14
0
ファイル: wrappers.php プロジェクト: jdelia/wordpress-plugin
 public function does_theme_include_idx_tag()
 {
     // default page content
     //the empty div is for any content they add to the visual editor so it displays
     $post_content = '<div></div><div id="idxStart" style="display: none;"></div><div id="idxStop" style="display: none;"></div>';
     // get theme to check start/stop tag
     $does_theme_include_idx_tag = false;
     $template_root = get_theme_root() . DIRECTORY_SEPARATOR . get_stylesheet();
     $files = scandir($template_root);
     foreach ($files as $file) {
         $path = $template_root . DIRECTORY_SEPARATOR . $file;
         if (is_file($path) && preg_match('/.*\\.php/', $file)) {
             $content = file_get_contents($template_root . DIRECTORY_SEPARATOR . $file);
             if (preg_match('/<div[^>\\n]+?id=[\'"]idxstart[\'"].*?(\\/>|><\\/div>)/i', $content)) {
                 if (preg_match('/<div[^>\\n]+?id=[\'"]idxstop[\'"].*?(\\/>|><\\/div>)/i', $content)) {
                     $does_theme_include_idx_tag = true;
                     break;
                 }
             }
         }
     }
     if ($does_theme_include_idx_tag || function_exists('equity')) {
         $post_content = '';
     }
     return $post_content;
 }
コード例 #15
0
 public static function get_edition_data()
 {
     if ('POST' !== $_SERVER['REQUEST_METHOD']) {
         return;
     }
     if ('update' !== mainwp_wp_stream_filter_input(INPUT_POST, 'action')) {
         return;
     }
     $theme_slug = mainwp_wp_stream_filter_input(INPUT_POST, 'theme') ? mainwp_wp_stream_filter_input(INPUT_POST, 'theme') : get_stylesheet();
     $theme = wp_get_theme($theme_slug);
     if (!$theme->exists() || $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code()) {
         return;
     }
     $allowed_files = $theme->get_files('php', 1);
     $style_files = $theme->get_files('css');
     $allowed_files['style.css'] = $style_files['style.css'];
     $file = mainwp_wp_stream_filter_input(INPUT_POST, 'file');
     if (empty($file)) {
         $file_name = 'style.css';
         $file_path = $allowed_files['style.css'];
     } else {
         $file_name = $file;
         $file_path = sprintf('%s/%s', $theme->get_stylesheet_directory(), $file_name);
     }
     $file_contents_before = file_get_contents($file_path);
     self::$edited_file = compact('file_name', 'file_path', 'file_contents_before', 'theme');
 }
コード例 #16
0
ファイル: theme-tools.php プロジェクト: KurtMakesWeb/CandG
/**
 * Load theme compat file if it exists.
 *
 * A theme could add its own compat files here if they like. For example:
 *
 * add_filter( 'jetpack_theme_compat_files', 'mytheme_jetpack_compat_file' );
 * function mytheme_jetpack_compat_file( $files ) {
 *     $files['mytheme'] = locate_template( 'jetpack-compat.php' );
 *     return $files;
 * }
 */
function jetpack_load_theme_compat()
{
    $compat_files = apply_filters('jetpack_theme_compat_files', array('twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php'));
    _jetpack_require_compat_file(get_stylesheet(), $compat_files);
    if (is_child_theme()) {
        _jetpack_require_compat_file(get_template(), $compat_files);
    }
}
コード例 #17
0
ファイル: helper.php プロジェクト: WPDevHQ/nevertheless
/**
 * Helper Function: Get (child) theme version
 * This function is to properly add version number to scripts and styles.
 * @since 0.1.0
 */
function tamatebako_child_theme_version()
{
    if (is_child_theme()) {
        $theme = wp_get_theme(get_stylesheet());
        return $theme->get('Version');
    }
    return tamatebako_theme_version();
}
コード例 #18
0
 protected function __construct()
 {
     parent::__construct();
     $this->elementName = $this->get_element_name();
     $this->db_key = 'upfront_' . get_stylesheet() . '_' . $this->elementName . '_presets';
     $registry = Upfront_PresetServer_Registry::get_instance();
     $registry->set($this->elementName, $this);
 }
コード例 #19
0
function thematic_widgets_init()
{
    // Define array for the widgetized areas
    $thematic_widgetized_areas = array('Header Widgets' => array('admin_menu_order' => 100, 'args' => array('name' => 'Header Widgets', 'id' => 'hdr-widgets', 'description' => __('The header widget area for additional mast head items.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_header', 'function' => 'thematic_widget_header', 'priority' => 10), 'Primary Aside' => array('admin_menu_order' => 200, 'args' => array('name' => 'Primary Aside', 'id' => 'primary-aside', 'description' => __('The primary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_primary_aside', 'function' => 'thematic_primary_aside', 'priority' => 10), 'Secondary Aside' => array('admin_menu_order' => 300, 'args' => array('name' => 'Secondary Aside', 'id' => 'secondary-aside', 'description' => __('The secondary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_secondary_aside', 'function' => 'thematic_secondary_aside', 'priority' => 10), '1st Subsidiary Aside' => array('admin_menu_order' => 400, 'args' => array('name' => '1st Subsidiary Aside', 'id' => '1st-subsidiary-aside', 'description' => __('The 1st widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_1st_subsidiary_aside', 'priority' => 30), '2nd Subsidiary Aside' => array('admin_menu_order' => 500, 'args' => array('name' => '2nd Subsidiary Aside', 'id' => '2nd-subsidiary-aside', 'description' => __('The 2nd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_2nd_subsidiary_aside', 'priority' => 50), '3rd Subsidiary Aside' => array('admin_menu_order' => 600, 'args' => array('name' => '3rd Subsidiary Aside', 'id' => '3rd-subsidiary-aside', 'description' => __('The 3rd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_3rd_subsidiary_aside', 'priority' => 70), 'Index Top' => array('admin_menu_order' => 700, 'args' => array('name' => 'Index Top', 'id' => 'index-top', 'description' => __('The top widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_top', 'function' => 'thematic_index_top', 'priority' => 10), 'Index Insert' => array('admin_menu_order' => 800, 'args' => array('name' => 'Index Insert', 'id' => 'index-insert', 'description' => __('The widget area inserted after x posts on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_insert', 'function' => 'thematic_index_insert', 'priority' => 10), 'Index Bottom' => array('admin_menu_order' => 900, 'args' => array('name' => 'Index Bottom', 'id' => 'index-bottom', 'description' => __('The bottom widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_bottom', 'function' => 'thematic_index_bottom', 'priority' => 10), 'Single Top' => array('admin_menu_order' => 1000, 'args' => array('name' => 'Single Top', 'id' => 'single-top', 'description' => __('The top widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_top', 'function' => 'thematic_single_top', 'priority' => 10), 'Single Insert' => array('admin_menu_order' => 1100, 'args' => array('name' => 'Single Insert', 'id' => 'single-insert', 'description' => __('The widget area inserted between the post and the comments on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_insert', 'function' => 'thematic_single_insert', 'priority' => 10), 'Single Bottom' => array('admin_menu_order' => 1200, 'args' => array('name' => 'Single Bottom', 'id' => 'single-bottom', 'description' => __('The bottom widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_bottom', 'function' => 'thematic_single_bottom', 'priority' => 10), 'Page Top' => array('admin_menu_order' => 1300, 'args' => array('name' => 'Page Top', 'id' => 'page-top', 'description' => __('The top widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_top', 'function' => 'thematic_page_top', 'priority' => 10), 'Page Bottom' => array('admin_menu_order' => 1400, 'args' => array('name' => 'Page Bottom', 'id' => 'page-bottom', 'description' => __('The bottom widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_bottom', 'function' => 'thematic_page_bottom', 'priority' => 10));
    $thematic_widgetized_areas = apply_filters('thematic_widgetized_areas', $thematic_widgetized_areas);
    if (!function_exists('register_sidebars')) {
        return;
    }
    foreach ($thematic_widgetized_areas as $key => $value) {
        register_sidebar($thematic_widgetized_areas[$key]['args']);
        if (!has_action($thematic_widgetized_areas[$key]['action_hook'], $thematic_widgetized_areas[$key]['function'])) {
            add_action($thematic_widgetized_areas[$key]['action_hook'], $thematic_widgetized_areas[$key]['function'], $thematic_widgetized_areas[$key]['priority']);
        }
    }
    // we will check for a Thematic widgets directory and and add and activate additional widgets
    // Thanks to Joern Kretzschmar
    $widgets_dir = @dir(ABSPATH . '/wp-content/themes/' . get_template() . '/widgets');
    if ($widgets_dir) {
        while (($widgetFile = $widgets_dir->read()) !== false) {
            if (!preg_match('|^\\.+$|', $widgetFile) && preg_match('|\\.php$|', $widgetFile)) {
                include ABSPATH . '/wp-content/themes/' . get_template() . '/widgets/' . $widgetFile;
            }
        }
    }
    // we will check for the child themes widgets directory and add and activate additional widgets
    // Thanks to Joern Kretzschmar
    $widgets_dir = @dir(ABSPATH . '/wp-content/themes/' . get_stylesheet() . '/widgets');
    if (TEMPLATENAME != THEMENAME && $widgets_dir) {
        while (($widgetFile = $widgets_dir->read()) !== false) {
            if (!preg_match('|^\\.+$|', $widgetFile) && preg_match('|\\.php$|', $widgetFile)) {
                include ABSPATH . '/wp-content/themes/' . get_stylesheet() . '/widgets/' . $widgetFile;
            }
        }
    }
    // Remove WP default Widgets
    // WP 2.8 function using $widget_class
    if (function_exists('unregister_widget')) {
        unregister_widget('WP_Widget_Meta');
        unregister_widget('WP_Widget_Search');
        unregister_widget('');
        // pre WP 2.8 function using $id
    } else {
        unregister_widget_control('meta');
        unregister_widget_control('search');
    }
    // Finished intializing Widgets plugin, now let's load the thematic default widgets
    register_sidebar_widget(__('Search', 'thematic'), 'widget_thematic_search', null, 'search');
    unregister_widget_control('search');
    register_sidebar_widget(__('Meta', 'thematic'), 'widget_thematic_meta', null, 'meta');
    unregister_widget_control('meta');
    register_sidebar_widget(array(__('RSS Links', 'thematic'), 'widgets'), 'widget_thematic_rsslinks');
    register_widget_control(array(__('RSS Links', 'thematic'), 'widgets'), 'widget_thematic_rsslinks_control', 300, 90);
    // Pre-set Widgets
    $preset_widgets = array('primary-aside' => array('search', 'pages', 'categories', 'archives'), 'secondary-aside' => array('links', 'rss-links', 'meta'));
    if (isset($_GET['activated'])) {
        update_option('sidebars_widgets', apply_filters('thematic_preset_widgets', $preset_widgets));
    }
}
コード例 #20
0
ファイル: Plugin.php プロジェクト: alpipego/wp-nownownow
 public function registerPageTemplate($atts)
 {
     $cache_key = 'page_templates-' . md5(get_theme_root() . '/' . get_stylesheet());
     $templates = empty(wp_get_theme()->get_page_templates()) ? [] : wp_get_theme()->get_page_templates();
     wp_cache_delete($cache_key, 'themes');
     $templates = array_merge($templates, $this->templates);
     wp_cache_add($cache_key, $templates, 'themes', 1800);
     return $atts;
 }
コード例 #21
0
 /**
  * Set some globals
  *
  * @package BuddyDrive Component
  * @subpackage Screens
  * @since 1.2.0
  */
 public function setup_globals()
 {
     $this->template = '';
     $this->current_screen = '';
     // Is the current theme BP Default or a child theme of BP Default ?
     $this->is_bp_default = in_array('bp-default', array(get_template(), get_stylesheet()));
     // Path to the component templates
     $this->template_dir = buddydrive_get_plugin_dir() . '/templates';
 }
コード例 #22
0
ファイル: extras.php プロジェクト: growgroup/epigone
/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function epigone_body_classes($classes)
{
    // Adds a class of group-blog to blogs with more than 1 published author.
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    $classes[] = get_stylesheet();
    return $classes;
}
コード例 #23
0
ファイル: theme-options.php プロジェクト: utkarshkukreti/wp
 /**
  * Constructor
  *
  * @access public
  *
  * @return Twenty_Twelve_Options
  */
 public function __construct()
 {
     // Set option key based on get_stylesheet()
     if ('twentytwelve' != get_stylesheet()) {
         $this->option_key = get_stylesheet() . '_theme_options';
     }
     add_action('admin_init', array($this, 'options_init'));
     add_action('admin_menu', array($this, 'add_page'));
     add_action('customize_register', array($this, 'customize_register'));
 }
コード例 #24
0
/**
 * Remove from excerpts where buttons could be redundant or awkward
 */
function addtoany_excerpt_remove()
{
    // If Twenty Sixteen theme
    if ('twentysixteen' == get_stylesheet() || 'twentysixteen' == get_template()) {
        // If blog index, single, or archive page, where excerpts are used as "intros"
        if (is_single() || is_archive() || is_home()) {
            remove_filter('the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98);
        }
    }
}
コード例 #25
0
ファイル: module-extras.php プロジェクト: moscarar/cityhow
/**
 * Load theme's infinite scroll annotation file, if present in the IS plugin.
 * The `setup_theme` action is used because the annotation files should be using `after_setup_theme` to register support for IS.
 *
 * @uses is_admin, get_stylesheet, apply_filters
 * @action setup_theme
 * @return null
 */
function jetpack_load_infinite_scroll_annotation()
{
    if (is_admin() && isset($_GET['page']) && 'jetpack' == $_GET['page']) {
        $theme_name = get_stylesheet();
        $customization_file = apply_filters('infinite_scroll_customization_file', dirname(__FILE__) . "/infinite-scroll/themes/{$theme_name}.php", $theme_name);
        if (is_readable($customization_file)) {
            require_once $customization_file;
        }
    }
}
コード例 #26
0
ファイル: i18n.php プロジェクト: mastinoz/Momtaz-Framework
/**
 * Gets the child theme textdomain ID and path.
 *
 * @return array
 * @since 1.1
 */
function momtaz_get_child_theme_textdomain()
{
    $textdomain = array();
    if (is_child_theme()) {
        $theme = wp_get_theme(get_stylesheet());
        $textdomain = array('path' => $theme->get('DomainPath'), 'id' => $theme->get('TextDomain'));
    }
    $textdomain = apply_filters('momtaz_child_theme_textdomain', $textdomain);
    return $textdomain;
}
コード例 #27
0
/**
 * [task_breaker_bp_projects_is_bp_default description]
 * @return [type] [description]
 */
function task_breaker_bp_projects_is_bp_default()
{
    // if active theme is BP Default or a child theme, then we return true
    // If the Buddypress version  is < 1.7, then return true too
    if (current_theme_supports('buddypress') || in_array('bp-default', array(get_stylesheet(), get_template())) || defined('BP_VERSION') && version_compare(BP_VERSION, '1.7', '<')) {
        return true;
    } else {
        return false;
    }
    return false;
}
コード例 #28
0
 /**
  * Create Metabox which links to and explains the WordPress customizer.
  *
  * @uses  wp_customize_url()
  * @since 1.0.2
  */
 function settings_box()
 {
     $customizer_link = wp_customize_url(get_stylesheet());
     echo '<p>';
     _e('The Genesis Bacon Bar is controlled by the WordPress Customizer. ', 'baconbar');
     _e('You can edit the content, display options, and look and feel in real-time.', 'baconbar');
     echo '</p>';
     echo '<p>';
     echo '<a class="button" href="' . $customizer_link . '">' . __('Customize Now', 'baconbar') . '</a>';
     echo '</p>';
 }
コード例 #29
0
ファイル: language.php プロジェクト: wpsitecare/carelib
/**
 * Gets the child theme textdomain. This allows the library to recognize
 * the proper textdomain of the child theme.
 *
 * @since  1.0.0
 * @access protected
 * @return string The textdomain of the child theme.
 */
function _carelib_get_child_textdomain()
{
    $domain = apply_filters("{$GLOBALS['carelib_prefix']}_child_textdomain", '');
    // If the textdomain has been set, return it.
    if (!empty($domain)) {
        return sanitize_key($domain);
    }
    $textdomain = carelib_get_theme()->get('TextDomain');
    $domain = $textdomain ? $textdomain : get_stylesheet();
    return sanitize_key($domain);
}
コード例 #30
0
 /**
  * Return the current theme version or parent theme version
  *
  * @since  required+ Foundation 0.6.0
  *
  * @param  boolean $parent By default we get the parent theme
  * @return int     Version of the theme
  */
 function required_get_theme_version($parent = true)
 {
     // Name of the parent theme forder
     $stylesheet = 'required-foundation';
     if (!$parent) {
         $stylesheet = get_stylesheet();
     }
     // Get the current theme with the new WP_Theme_API
     $current_theme = wp_get_theme($stylesheet);
     return $current_theme->Version;
 }