function cherry_plugin_settings() { global $wpdb; if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $upload_dir = wp_upload_dir(); $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php'); //Cherry plugin constant variables define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__)); define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']); define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']); define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']); define('CHERRY_PLUGIN_NAME', $plugin_data['Name']); define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__)); define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN); define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/')); //Other constant variables define('CURRENT_THEME_DIR', get_stylesheet_directory()); define('CURRENT_THEME_URI', get_stylesheet_directory_uri()); define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir'])); define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/')); // if ( !defined('API_URL') ) { // define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) ); // } load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR); do_action('cherry_plugin_settings'); }
/** * Return a list of header images, both from the Tarski directory and the child * theme (if one is being used). * * @uses get_tarski_option * @uses wp_get_theme * @uses get_template_directory_uri * @uses get_stylesheet_directory_uri * * @return array */ function _tarski_list_header_images() { $headers = array(); $dirs = array('Tarski' => get_template_directory()); $current = get_tarski_option('header'); $theme = wp_get_theme(); if (strlen($theme->Template) > 0) { $dirs[$theme->Name] = get_stylesheet_directory(); } foreach ($dirs as $theme_name => $dir) { $dirpath = $dir . '/headers'; if (is_dir($dirpath)) { $header_dir = dir($dirpath); } else { continue; } while ($file = $header_dir->read()) { if (preg_match('/^[^.].+\\.(jpg|png|gif)/', $file) && !preg_match('/-thumb\\.(jpg|png|gif)$/', $file)) { $name = $theme_name . '/' . $file; $id = 'header_' . preg_replace('/[^a-z_]/', '_', strtolower($name)); $path = $dir == get_template_directory() ? '%1$s' : '%2$s'; $thumb = preg_replace('/(\\.(?:png|gif|jpg))/', '-thumb\\1', $file); $uri = $dir == get_template_directory() ? get_template_directory_uri() : get_stylesheet_directory_uri(); $is_current = is_string($current) && $current == $file || $current[0] == $theme_name && $current[1] == $file; $headers[] = array('name' => $name, 'id' => $id, 'lid' => 'for_' . $id, 'path' => "{$uri}/headers/{$file}", 'current' => $is_current, 'thumb' => "{$uri}/headers/{$thumb}", 'description' => $name, 'url' => "{$path}/headers/{$file}", 'thumbnail_url' => "{$path}/headers/{$thumb}"); } } } return $headers; }
static function init() { // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = str_replace($wp_content_dir, '', self::$_dir); $wp_content_url = Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL); self::$_url = trailingslashit($wp_content_url) . $relative_url; // See if Redux is a plugin or not if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { self::$_is_plugin = false; } /** Still need to port these. $defaults['footer_credit'] = '<span id="footer-thankyou">' . __( 'Options panel created using', 'redux-framework') . ' <a href="' . $this->framework_url . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version . '</span>'; $defaults['help_tabs'] = array(); $defaults['help_sidebar'] = ''; // __( '', 'redux-framework' ); $defaults['database'] = ''; // possible: options, theme_mods, theme_mods_expanded, transient $defaults['customizer'] = false; // setting to true forces get_theme_mod_expanded $defaults['global_variable'] = ''; $defaults['output'] = true; // Dynamically generate CSS $defaults['transient_time'] = 60 * MINUTE_IN_SECONDS; // The defaults are set so it will preserve the old behavior. $defaults['default_show'] = false; // If true, it shows the default value $defaults['default_mark'] = ''; // What to print by the field's title if the value shown is default **/ self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_permissions' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'menu_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_priority' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'output' => array('required', 'data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Output/Generate CSS', 'desc' => 'Global shut-off for dynamic CSS output by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false))); }
function alm_get_default_repeater() { global $wpdb; $file = null; $template_dir = 'alm_templates'; // Allow user to load template from theme directory // Since 2.8.5 // load repeater template from current theme folder if (is_child_theme()) { $template_theme_file = get_stylesheet_directory() . '/' . $template_dir . '/default.php'; // if child theme does not have repeater template, then use the parent theme dir if (!file_exists($template_theme_file)) { $template_theme_file = get_template_directory() . '/' . $template_dir . '/default.php'; } } else { $template_theme_file = get_template_directory() . '/' . $template_dir . '/default.php'; } // if theme or child theme contains the template, use that file if (file_exists($template_theme_file)) { $file = $template_theme_file; } // Since 2.0 // otherwise use pre-defined plug-in templates if ($file == null) { $blog_id = $wpdb->blogid; if ($blog_id > 1) { $file = ALM_PATH . 'core/repeater/' . $blog_id . '/default.php'; // File } else { $file = ALM_PATH . 'core/repeater/default.php'; } } return $file; }
/** * Retrieve the name of the highest priority template file that exists. * * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which * inherit from a parent theme can just overload one file. If the template is * not found in either of those, it looks in the theme-compat folder last. * * Taken from bbPress * * @since v2.5 * * @param string|array $template_names Template file(s) to search for, in order. * @param bool $load If true the template file will be loaded if it is found. * @param bool $require_once Whether to require_once or require. Default true. * Has no effect if $load is false. * @return string The template filename if one is located. */ function mr_locate_template($template_names, $load = false, $require_once = true, $template_vars) { // No file found yet $located = false; // Try to find a template file foreach ((array) $template_names as $template_name) { // Continue if template is empty if (empty($template_name)) { continue; } // Trim off any slashes from the template name $template_name = ltrim($template_name, '/'); // Check child theme first if (file_exists(trailingslashit(get_stylesheet_directory()) . 'multi-rating/' . $template_name)) { $located = trailingslashit(get_stylesheet_directory()) . 'multi-rating/' . $template_name; break; // Check parent theme next } elseif (file_exists(trailingslashit(get_template_directory()) . 'multi-rating/' . $template_name)) { $located = trailingslashit(get_template_directory()) . 'multi-rating/' . $template_name; break; // Check theme compatibility last } elseif (file_exists(trailingslashit(mr_get_templates_dir()) . $template_name)) { $located = trailingslashit(mr_get_templates_dir()) . $template_name; break; } } if (true == $load && !empty($located)) { mr_load_template($located, $require_once, $template_vars); } return $located; }
/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function goran_setup() { /* * Declare textdomain for this child theme. */ load_child_theme_textdomain('goran', get_stylesheet_directory() . '/languages'); /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_image_size('edin-thumbnail-landscape', 314, 228, true); add_image_size('edin-thumbnail-square', 314, 314, true); add_image_size('edin-featured-image', 772, 9999); add_image_size('edin-hero', 1230, 1230); /* * Unregister nav menu. */ unregister_nav_menu('secondary'); /* * Editor styles. */ add_editor_style(array('editor-style.css', goran_noto_sans_font_url(), goran_noto_serif_font_url(), goran_droid_sans_mono_font_url())); /** * Add support for Eventbrite. * See: https://wordpress.org/plugins/eventbrite-api/ */ add_theme_support('eventbrite'); }
private function includes() { $parent = get_template_directory() . '/setup/'; $child = get_stylesheet_directory() . '/setup/'; require_once $parent . 'class.install.php'; require_once $parent . 'class.uw-scripts.php'; require_once $parent . 'class.uw-styles.php'; require_once $parent . 'class.uw-dropdowns.php'; require_once $parent . 'class.images.php'; require_once $parent . 'class.squish_bugs.php'; require_once $parent . 'class.filters.php'; require_once $parent . 'class.uw-oembeds.php'; require_once $parent . 'class.googleapps.php'; require_once $parent . 'class.mimes.php'; require_once $parent . 'class.users.php'; require_once $parent . 'class.dropdowns_walker.php'; // no initialization needed because it extends a WP class require_once $parent . 'class.uw-basic-custom-post.php'; // no initialization needed unless a child theme makes one require_once $parent . 'class.uw-sidebar-menu-walker.php'; // sidebar menu will initialize for us require_once $parent . 'class.uw-quicklinks.php'; require_once $parent . 'class.uw-iframes.php'; require_once $parent . 'class.uw-shortcodes.php'; require_once $parent . 'class.uw-media-credit.php'; require_once $parent . 'class.uw-media-caption.php'; require_once $parent . 'class.uw-replace-media.php'; require_once $parent . 'class.uw-tinymce.php'; require_once $parent . 'class.uw-documentation-dashboard-widget.php'; require_once $parent . 'class.uw-enclosure.php'; require_once $parent . 'class.uw-carousel.php'; require_once $parent . 'class.uw-settings.php'; }
function UM_Mail($user_id_or_email = 1, $subject_line = 'Email Subject', $template, $path = null, $args = array()) { if (absint($user_id_or_email)) { $user = get_userdata($user_id_or_email); $email = $user->user_email; } else { $email = $user_id_or_email; } $headers = 'From: ' . um_get_option('mail_from') . ' <' . um_get_option('mail_from_addr') . '>' . "\r\n"; $attachments = null; if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html')) { $path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html'; } else { if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html')) { $path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html'; } else { $path_to_email = $path . $template . '.html'; } } if (um_get_option('email_html')) { $message = file_get_contents($path_to_email); add_filter('wp_mail_content_type', 'um_mail_content_type'); } else { $message = um_get_option('email-' . $template) ? um_get_option('email-' . $template) : 'Untitled'; } $message = um_convert_tags($message, $args); wp_mail($email, $subject_line, $message, $headers, $attachments); }
function builder_add_responsive_stylesheets() { $template_dir = get_template_directory(); $template_url = get_template_directory_uri(); $stylesheet_dir = get_stylesheet_directory(); $stylesheet_url = get_stylesheet_directory_uri(); $files = array('style-responsive.css' => 'tablet-width', 'style-tablet.css' => array('mobile-width', 'tablet-width'), 'style-mobile.css' => 'mobile-width'); $files = apply_filters('builder_get_responsive_stylesheet_files', $files); $stylesheets = array(); $use_template = false; if ($template_dir != $stylesheet_dir && !defined('BUILDER_DISABLE_PARENT_RESPONSIVE_STYLESHEETS')) { $use_template = true; } foreach (array_keys($files) as $file) { if (file_exists("{$stylesheet_dir}/{$file}")) { $stylesheets[$file] = "{$stylesheet_url}/{$file}"; } else { if ($use_template && file_exists("{$template_dir}/{$file}")) { $stylesheets[$file] = "{$template_url}/{$file}"; } } } if (empty($stylesheets)) { return; } $size_widths = array('tablet-width' => builder_theme_supports('builder-responsive', 'tablet-width'), 'mobile-width' => builder_theme_supports('builder-responsive', 'mobile-width'), 'layout-width' => apply_filters('builder_get_layout_width', '')); foreach ($stylesheets as $file => $stylesheet) { $widths = $files[$file]; if (is_array($widths)) { $min_width = $widths[0]; $max_width = $widths[1]; } else { $min_width = ''; $max_width = $widths; } if (!empty($min_width) && isset($size_widths[$min_width])) { $min_width = $size_widths[$min_width]; } if (!empty($min_width) && isset($size_widths[$min_width])) { $min_width = $size_widths[$min_width]; } if (is_numeric($min_width)) { $min_width .= 'px'; } if (!empty($size_widths[$max_width])) { $max_width = $size_widths[$max_width]; } if (!empty($size_widths[$max_width])) { $max_width = $size_widths[$max_width]; } if (is_numeric($max_width)) { $max_width .= 'px'; } if (empty($min_width)) { echo "<link rel=\"stylesheet\" href=\"{$stylesheet}\" type=\"text/css\" media=\"only screen and (max-width: {$max_width})\" />\n"; } else { echo "<link rel=\"stylesheet\" href=\"{$stylesheet}\" type=\"text/css\" media=\"only screen and (min-width: {$min_width}) and (max-width: {$max_width})\" />\n"; } } }
function __construct() { // This is how to call the template engine: // do_action('wunderground_render_template', $file_name, $data_array ); add_action('wunderground_render_template', array(&$this, 'render'), 10, 2); // Set up Twig Twig_Autoloader::register(); // This path should always be the last $base_path = trailingslashit(plugin_dir_path(Wunderground_Plugin::$file)) . 'templates'; $this->loader = new Twig_Loader_Filesystem($base_path); // Tap in here to add additional template paths $additional_paths = apply_filters('wunderground_template_paths', array(trailingslashit(get_stylesheet_directory()) . 'wunderground')); foreach ($additional_paths as $path) { // If the directory exists if (is_dir($path)) { // Tell Twig to use it first $this->loader->prependPath($path); } } // You can force debug mode by adding `add_filter( 'wunderground_twig_debug' '__return_true' );` $debug = apply_filters('wunderground_twig_debug', current_user_can('manage_options') && isset($_GET['debug'])); $this->twig = new Twig_Environment($this->loader, array('debug' => !empty($debug), 'auto_reload' => true)); if (!empty($debug)) { $this->twig->addExtension(new Twig_Extension_Debug()); } }
function SLUG_load_template($out, $code, $template_name) { if (false !== ($template = file_get_contents(file_get_contents(trailingslashit(get_stylesheet_directory()) . "pods-templates/{$template_name}")))) { $code = $template; } return $code; }
/** * Activates default theme features * * @since 1.0 */ function projetcela_theme_setup() { // Make theme available for translation. // Translations can be filed in the /languages/ directory. // uncomment to enable (remove the // before load_theme_textdomain ) load_theme_textdomain('suits', get_stylesheet_directory() . '/languages'); }
function plandd_acf_path($path) { // update path $path = get_stylesheet_directory() . '/includes/acf-pro/'; // return return $path; }
public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; $apikey = getbapiapikey(); if (!empty($apikey)) { $fname = get_stylesheet_directory() . '/insta-default-content/insta-footer.php'; if (!file_exists($fname)) { $fname = plugin_dir_path(__FILE__) . 'insta-default-content/insta-footer.php'; } if (file_exists($fname)) { $t = file_get_contents($fname); $m = new Mustache_Engine(); $wrapper = getbapisolutiondata(); //print_r($wrapper); $string = $m->render($t, $wrapper); echo $string; } elseif (is_newapp_website()) { echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://kigo.net">Vacation Rental Software by Kigo</a></div>'; } else { echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://www.InstaManager.com">Vacation Rental Software by InstaManager</a></div>'; } } elseif (is_newapp_website()) { echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://kigo.net">Vacation Rental Software by Kigo</a></div>'; } else { echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://www.InstaManager.com">Vacation Rental Software by InstaManager</a></div>'; } echo $after_widget; }
function my_acf_settings_path($path) { // update path $path = get_stylesheet_directory() . '/acf-pro/'; // return return $path; }
public static function isChildTheme($file) { if (strpos(self::cleanFilePath($file), self::cleanFilePath(get_stylesheet_directory())) !== false) { return true; } return false; }
/** * Pick the correct template to include * @param string $template Path to template * * @return string Path to template */ public static function templateChooser($template) { $events = TribeEvents::instance(); do_action('tribe_tec_template_chooser', $template); // hijack this method right up front if it's a 404 if (is_404() && $events->displaying == 'single-event' && apply_filters('tribe_events_templates_is_404', '__return_true')) { return get_404_template(); } // no non-events need apply if (!in_array(get_query_var('post_type'), array(TribeEvents::POSTTYPE, TribeEvents::VENUE_POST_TYPE, TribeEvents::ORGANIZER_POST_TYPE)) && !is_tax(TribeEvents::TAXONOMY)) { return $template; } if (tribe_get_option('tribeEventsTemplate', 'default') == '') { return self::getTemplateHierarchy('default-template'); } else { // add_filter( 'wp_title', array(__CLASS__, 'remove_default_title'), 1); if (!is_single() || !post_password_required()) { add_action('loop_start', array(__CLASS__, 'setup_ecp_template')); } $template = locate_template(tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default')); if ($template == '') { $template = get_index_template(); } // remove singular body class if sidebar-page.php if ($template == get_stylesheet_directory() . '/sidebar-page.php') { add_filter('body_class', array(__CLASS__, 'remove_singular_body_class')); } else { add_filter('body_class', array(__CLASS__, 'add_singular_body_class')); } return $template; } }
public static function Dropdown($params) { extract($params); $type = isset($type) ? $type : 'link'; $ltpldir = get_stylesheet_directory() . '/donwload-manager/' . $type . '-templates/'; if (!file_exists($ltpldir)) { $ltpldir = WPDM_BASE_DIR . '/tpls/' . $type . '-templates/'; } $ctpls = scandir($ltpldir); array_shift($ctpls); array_shift($ctpls); $name = isset($name) ? $name : $type . '_template'; $css = isset($css) ? "style='{$css}'" : ''; $id = isset($id) ? $id : uniqid(); $default = $type == 'link' ? 'link-template-calltoaction3.php' : 'page-template-1col-flat.php'; $html = "<select name='{$name}' id='{$id}' class='form-control template {$type}_template' {$css}><option value='{$default}'>Select " . ucfirst($type) . " Template</option>"; $data = array(); foreach ($ctpls as $ctpl) { $tmpdata = file_get_contents($ltpldir . $ctpl); $regx = "/WPDM.*Template[\\s]*:([^\\-\\->]+)/"; if (preg_match($regx, $tmpdata, $matches)) { $data[$ctpl] = $matches[1]; $selected = isset($selected) && $selected == $ctpl ? 'selected=selected' : ''; $html .= "<option value='{$ctpl}' {$selected}>{$matches[1]}</option>"; } } $html .= "</select>"; return isset($data_type) && $data_type == 'ARRAY' ? $data : $html; }
public static function init() { global $wp_filesystem; // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = str_replace($wp_content_dir, '', self::$_dir); self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL)); self::$_url = self::$wp_content_url . $relative_url; // See if Redux is a plugin or not if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { self::$_is_plugin = false; } // Create our private upload directory Redux_Functions::initWpFilesystem(); self::$_upload_dir = trailingslashit($wp_filesystem->wp_content_dir()) . '/redux/'; self::$_upload_url = trailingslashit(content_url()) . '/redux/'; if (function_exists('sys_get_temp_dir')) { $tmp = sys_get_temp_dir(); if (empty($tmp)) { $tmpDir = self::$_upload_url . 'tmp'; if (file_exists($tmpDir)) { Redux_Helpers::rmdir($tmpDir); } putenv('TMPDIR=' . self::$_upload_dir . 'tmp'); } } // Ensure it exists if (!is_dir(self::$_upload_dir)) { // Create the directory $wp_filesystem->mkdir(self::$_upload_dir); } }
/** * Enqueue custom stylesheets * * @author Jonny Frodsham **/ function ttEnqueueStyles() { if (!is_admin()) { wp_register_style('stylesheet', THEME_DIRECTORY . '/assets/css/tatton.css', array(), filemtime(get_stylesheet_directory() . '/assets/css/tatton.css'), 'all'); wp_enqueue_style('stylesheet'); } }
/** * load_controller_directories. * Goes through the theme and active plugins to check whether it has a wp-controllers directory * and adds this to the internal directories */ private static function load_controller_directories() { self::$_directories = array(__DIR__ . '/controllers'); $parent_theme = get_template_directory(); $child_theme = get_stylesheet_directory(); // Check & add child theme if ($parent_theme !== $child_theme) { $child_theme = apply_filters('wp_controllers_child_theme_directory', "{$child_theme}/wp-controllers"); if (is_dir($child_theme)) { self::$_directories[] = $child_theme; } } // Check & add main/parent theme $parent_theme = apply_filters('wp_controllers_theme_directory', "{$parent_theme}/wp-controllers"); if (is_dir($parent_theme)) { self::$_directories[] = $parent_theme; } // Include necessary plugin functions if front-end if (!function_exists('get_plugins')) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } // Check & add active plugins $plugins = get_plugins(); $plugins_path = WP_PLUGIN_DIR; foreach ($plugins as $path => $data) { if (is_plugin_active($path) && basename($path) !== basename(__FILE__)) { $path = strstr($path, DIRECTORY_SEPARATOR, true); $directory = apply_filters('wp_controllers_plugin_directory', "{$plugins_path}/{$path}/wp-controllers", $path, $data); if (is_dir($directory)) { self::$_directories[] = $directory; } } } }
/** * * This function adds all the constants that can be used for the CRM Press framework. * * @since 1.0 * */ function crmpress_constants() { // Define directory constants define('PARENT_DIR', get_template_directory()); define('CHILD_DIR', get_stylesheet_directory()); define('CRMPRESS_IMAGES_DIR', PARENT_DIR . '/images'); define('CRMPRESS_LIB_DIR', PARENT_DIR . '/lib'); define('CRMPRESS_ADMIN_DIR', CRMPRESS_LIB_DIR . '/admin'); define('CRMPRESS_BUILD_DIR', CRMPRESS_LIB_DIR . '/build'); define('CRMPRESS_METABOX_DIR', CRMPRESS_LIB_DIR . '/metabox'); define('CRMPRESS_CSS_DIR', CRMPRESS_LIB_DIR . '/css'); define('CRMPRESS_FUNCTIONS_DIR', CRMPRESS_LIB_DIR . '/functions'); define('CRMPRESS_JS_DIR', CRMPRESS_LIB_DIR . '/js'); define('CRMPRESS_RESOURCES_DIR', CRMPRESS_LIB_DIR . '/resources'); define('CRMPRESS_WIDGETS_DIR', CRMPRESS_LIB_DIR . '/widgets'); // Define URL constants define('PARENT_URL', get_template_directory_uri()); define('CHILD_URL', get_stylesheet_directory_uri()); define('CRMPRESS_IMAGES_URL', PARENT_URL . '/images'); define('CRMPRESS_LIB_URL', PARENT_URL . '/lib'); define('CRMPRESS_ADMIN_URL', CRMPRESS_LIB_URL . '/admin'); define('CRMPRESS_BUILD_URL', CRMPRESS_LIB_URL . '/build'); define('CRMPRESS_METABOX_URL', CRMPRESS_LIB_URL . '/metabox'); define('CRMPRESS_CSS_URL', CRMPRESS_LIB_URL . '/css'); define('CRMPRESS_FUNCTIONS_URL', CRMPRESS_LIB_URL . '/functions'); define('CRMPRESS_JS_URL', CRMPRESS_LIB_URL . '/js'); define('CRMPRESS_RESOURCES_URL', CRMPRESS_LIB_URL . '/resources'); define('CRMPRESS_WIDGETS_URL', CRMPRESS_LIB_URL . '/widgets'); }
static function rewrite_rules($content) { $theme_name = next(explode('/themes/', get_stylesheet_directory())); global $wp_rewrite; $new_non_wp_rules = array('css/(.*)' => 'wp-content/themes/' . $theme_name . '/css/$1', 'js/(.*)' => 'wp-content/themes/' . $theme_name . '/js/$1', 'img/(.*)' => 'wp-content/themes/' . $theme_name . '/img/$1', 'plugins/(.*)' => 'wp-content/plugins/$1'); $wp_rewrite->non_wp_rules += $new_non_wp_rules; }
function acf_wpcli_register_groups() { global $blog_id; if (function_exists("register_field_group")) { global $wpdb; $db_field_groups = $wpdb->get_results("SELECT post_title FROM {$wpdb->posts} WHERE post_type='acf' AND post_status='publish';"); $db_field_group_titles = array(); foreach ($db_field_groups as $db_group) { $db_field_group_titles[] = $db_group->post_title; } $paths = array('active_theme' => get_template_directory() . '/field-groups/', 'active_child_theme' => get_stylesheet_directory() . '/field-groups/', 'child_themes_shared' => ABSPATH . 'field-groups/shared-childs/'); $paths = apply_filters('acfwpcli_fieldgroup_paths', $paths); $patterns = array(); foreach ($paths as $key => $value) { if (!is_dir($value)) { continue; } $patterns[$key] = trailingslashit($value) . '*/data.php'; } $added_groups = array(); foreach ($patterns as $pattern) { // register the field groups specific for this subsite foreach (glob($pattern) as $file) { $group = acf_wpcli_get_file_data($file); // Don't register group when the group is already in the DB if (!in_array($group['title'], $db_field_group_titles)) { register_field_group($group); } $added_groups[] = $group['title']; } } } }
/** * Enqueue styles and scripts * * @access public * @return void * @since 1.0.0 */ public function enqueue_styles_scripts() { $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_script('yith_wcas_jquery-autocomplete', YITH_WCAS_URL . 'assets/js/devbridge-jquery-autocomplete' . $suffix . '.js', array('jquery'), '1.2.7', true); $css = file_exists(get_stylesheet_directory() . '/woocommerce/yith_ajax_search.css') ? get_stylesheet_directory_uri() . '/woocommerce/yith_ajax_search.css' : YITH_WCAS_URL . 'assets/css/yith_wcas_ajax_search.css'; wp_enqueue_style('yith_wcas_frontend', $css); }
function display() { $browser = new SendPress_Browser(); if (get_bloginfo('version') < '3.4') { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; } else { $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; } // Try to identify the hosting provider $host = false; if (defined('WPE_APIKEY')) { $host = 'WP Engine'; } elseif (defined('PAGELYBIN')) { $host = 'Pagely'; } $request['cmd'] = '_notify-validate'; $params = array('sslverify' => false, 'timeout' => 60, 'body' => $request); $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { $WP_REMOTE_POST = 'wp_remote_post() works' . "\n"; } else { $WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n"; } return $this->display_output($browser, $theme, $host, $WP_REMOTE_POST); }
function Destro_setup() { // This theme uses wp_nav_menu() in one location. register_nav_menus(array('mainmenu' => __('Main Navigation', 'Destro'))); // This theme uses post thumbnails add_theme_support('post-thumbnails'); add_image_size('Destrothumb', 450, 300, true); // Add default posts and comments RSS feed links to head add_theme_support('automatic-feed-links'); // Add translation support load_theme_textdomain('Destro', get_template_directory() . '/languages'); // Delete default WordPress gallery css add_filter('use_default_gallery_style', '__return_false'); // Add Custom background feature if (of_get_option('skin_style')) { $custombgargsskin = of_get_option('skin_style'); } else { $custombgargsskin = 'destro'; } if (get_stylesheet_directory() == get_template_directory()) { $custombgargs = array('default-color' => '292929', 'default-image' => get_template_directory_uri() . '/images/' . $custombgargsskin . '/page_bg.png'); } else { $custombgargs = array('default-image' => get_stylesheet_directory_uri() . '/images/page_bg.png'); } add_theme_support('custom-background', $custombgargs); }
function teutopress_acf_settings_path($path) { // update path $path = get_stylesheet_directory() . '/acf/'; // return return $path; }
/** * PHP5 contructor * * @since 1.0.0 */ function __construct() { global $table_prefix; $this->version = UT_OPTION_VERSION; $this->table_name = $table_prefix . UT_THEME_INITIAL . 'option_tree'; define('OT_TABLE_NAME', $this->table_name); $this->option_array = $this->option_tree_data(); // file path & name without extention $this->ot_file = '/lambda/assets/optionsdata/theme-options.xml'; $this->ot_data = '/lambda/assets/optionsdata/theme-options.txt'; $this->ot_layout = '/lambda/assets/optionsdata/layouts.txt'; // XML file path $this->theme_options_xml = get_stylesheet_directory() . $this->ot_file; if (!is_readable($this->theme_options_xml)) { // no file try parent theme $this->theme_options_xml = get_template_directory() . $this->ot_file; } // Data file path $this->theme_options_data = get_stylesheet_directory() . $this->ot_data; if (!is_readable($this->theme_options_data)) { // no file try parent theme $this->theme_options_data = get_template_directory() . $this->ot_data; } // Layout file path $this->theme_options_layout = get_stylesheet_directory() . $this->ot_layout; if (!is_readable($this->theme_options_layout)) { // no file try parent theme $this->theme_options_layout = get_template_directory() . $this->ot_layout; } // check for files $this->has_xml = is_readable($this->theme_options_xml) ? true : false; $this->has_data = is_readable($this->theme_options_data) ? true : false; $this->has_layout = is_readable($this->theme_options_layout) ? true : false; //delete_option('option_tree'); }
/** * Setup the data that is going to be tracked * * @access private * @return void */ private function setup_data() { $data = array(); // Retrieve current theme info if (get_bloginfo('version') < '3.4') { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; } else { $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; } $data['url'] = home_url(); $data['theme'] = $theme; $data['email'] = get_bloginfo('admin_email'); // Retrieve current plugin information if (!function_exists('get_plugins')) { include ABSPATH . '/wp-admin/includes/plugin.php'; } $plugins = array_keys(get_plugins()); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $key => $plugin) { if (in_array($plugin, $active_plugins)) { // Remove active plugins from list so we can show active and inactive separately unset($plugins[$key]); } } $data['active_plugins'] = $active_plugins; $data['inactive_plugins'] = $plugins; $data['products'] = wp_count_posts('download')->publish; $this->data = $data; }