function aviators_option_posts_per_agents_page($value) { if (is_post_type_archive('agent')) { return aviators_settings_get_value('agents', 'agents', 'per_page'); } return $value; }
/** * Gets The Archive Title Set In The Options, With Normal Defaults. * * Pass true to echo instead or returning the value * * @param bool $echo * @return mixed|null|string|void * @since 0.1 */ function tb_archive_title($echo = true) { $out = __('Archive'); if (is_tax('tb_genre')) { $opt = get_option('genre_archive_title'); $out = $opt ? $opt : single_term_title('', false); } if (is_tax('tb_author')) { $opt = get_option('author_archive_title'); $out = $opt ? $opt : single_term_title('', false); } if (is_tax('tb_series')) { $opt = get_option('series_archive_title'); $out = $opt ? $opt : single_term_title('', false); } if (is_post_type_archive('tb_book')) { $opt = get_option('book_archive_title'); $out = $opt ? $opt : __('Books Archives', 'totally-booked'); } if (!$echo) { return $out; } echo $out; return; }
function porto_page_title() { global $porto_settings; $output = ''; if (!is_front_page()) { } elseif (is_home()) { $output .= $porto_settings['blog-title']; } if (is_singular()) { $output .= porto_page_title_leaf(); } else { if (is_post_type_archive()) { if (is_search()) { $output .= porto_page_title_leaf('search'); } else { $output .= porto_page_title_archive(); } } elseif (is_tax() || is_tag() || is_category()) { $html = porto_page_title_leaf('term'); if (is_tag()) { $output .= sprintf(__('Tag - %s', 'porto'), $html); } elseif (is_tax('product_tag')) { $output .= sprintf(__('Product Tag - %s', 'porto'), $html); } else { $output .= $html; } } elseif (is_date()) { if (is_year()) { $output .= porto_page_title_leaf('year'); } elseif (is_month()) { $output .= porto_page_title_leaf('month'); } elseif (is_day()) { $output .= porto_page_title_leaf('day'); } } elseif (is_author()) { $output .= porto_page_title_leaf('author'); } elseif (is_search()) { $output .= porto_page_title_leaf('search'); } elseif (is_404()) { $output .= porto_page_title_leaf('404'); } elseif (class_exists('bbPress') && is_bbpress()) { if (bbp_is_search()) { $output .= porto_page_title_leaf('bbpress_search'); } elseif (bbp_is_single_user()) { $output .= porto_page_title_leaf('bbpress_user'); } else { $output .= porto_page_title_leaf(); } } else { if (is_home() && !is_front_page()) { if (get_option('show_on_front') == 'page') { $output .= get_the_title(get_option('page_for_posts', true)); } else { $output .= $porto_settings['blog-title']; } } } } return apply_filters('porto_page_title', $output); }
/** * Helper function to check whether the shortcode should be rendered or not * * @return type */ static function display_allowed() { global $rtmedia_query; $flag = !(is_home() || is_post_type_archive() || is_author()) && is_user_logged_in() && (is_rtmedia_upload_music_enabled() || is_rtmedia_upload_photo_enabled() || is_rtmedia_upload_video_enabled()) && (isset($rtmedia_query->is_upload_shortcode) && $rtmedia_query->is_upload_shortcode == true || is_rtmedia_bp_profile() && is_rtmedia_profile_media_enable() || is_rtmedia_bp_group() && is_rtmedia_group_media_enable()); $flag = apply_filters('before_rtmedia_uploader_display', $flag); return $flag; }
function hocwp_is_post_type_archive($post_type) { if (is_tax(get_object_taxonomies($post_type)) || is_post_type_archive($post_type)) { return true; } return false; }
function widget() { if (!is_user_logged_in()) { return; } $post = get_post(); switch ($this->post_type) { case 'page': if ($post->post_type !== 'page') { return; } break; default: if ($post->post_type !== $this->post_type && !is_post_type_archive($this->post_type)) { return; } break; } $watchlist = get_post_meta($post->ID, '_wporg_watchlist', true); if ($watchlist && in_array(get_current_user_id(), $watchlist)) { printf('<p>You are watching this page. <a href="%s">Unwatch</a></p>', wp_nonce_url(admin_url('admin-post.php?action=wporg_watchlist&post_id=' . $post->ID), 'unwatch-' . $post->ID)); } else { printf('<p><a href="%s">Watch this page</a></p>', wp_nonce_url(admin_url('admin-post.php?action=wporg_watchlist&watch=1&post_id=' . $post->ID), 'watch-' . $post->ID)); } }
function paw_ux_redirect() { if (is_post_type_archive('skills')) { wp_redirect(home_url(), 301); exit; } }
/** * Page titles */ function dw_timeline_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return get_bloginfo('name'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'dw-timeline'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'dw-timeline'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'dw-timeline'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Author Archives: %s', 'dw-timeline'), $author->display_name); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'dw-timeline'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'dw-timeline'); } else { return get_the_title(); } }
/** * Load a template. * * Handles template usage so that we can use our own templates instead of the themes. * * Templates are in the 'templates' folder. eventon looks for theme * overrides in /theme/eventon/ by default * * For beginners, it also looks for a eventon.php template first. If the user adds * this to the theme (containing a eventon() inside) this will be used for all * eventon templates. * * @access public * @param mixed $template * @return string */ public function template_loader($template) { global $eventon_sin_event, $eventon; $file = ''; $sure_path = AJDE_EVCAL_PATH . '/templates/'; // Paths to check $paths = apply_filters('eventon_template_paths', array(0 => TEMPLATEPATH . '/', 1 => TEMPLATEPATH . '/' . $eventon->template_url)); $evOpt = evo_get_options('1'); $events_page_id = evo_get_event_page_id($evOpt); // single and archieve events page if (is_single() && get_post_type() == 'ajde_events') { $file = 'single-ajde_events.php'; // if this page is event archive page } elseif (is_post_type_archive('ajde_events')) { $file__ = evo_get_event_template($evOpt); $file = $file__; $paths[] = $file__ == 'archive-ajde_events.php' ? AJDE_EVCAL_PATH . '/templates/' : get_template_directory(); } // FILE Exist if ($file) { // each path foreach ($paths as $path) { if (file_exists($path . $file)) { $template = $path . $file; break; } } if (!$template) { $template = AJDE_EVCAL_PATH . '/templates/' . $file; } } //print_r($template); return $template; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { if (!is_post_type_archive('product') && !is_tax(get_object_taxonomies('product'))) { return; } // enqueue necessary scripts wp_enqueue_style('wcapf-style'); wp_enqueue_style('font-awesome'); wp_enqueue_script('wcapf-script'); global $wcapf; $active_filters = $wcapf->getChosenFilters()['active_filters']; $found = false; $html = ''; if (sizeof($active_filters) > 0) { $found = true; $html .= '<div class="wcapf-active-filters">'; foreach ($active_filters as $key => $active_filter) { if ($key === 'term') { foreach ($active_filter as $data_key => $terms) { foreach ($terms as $term_id => $term_name) { $html .= '<a href="javascript:void(0)" data-key="' . $data_key . '" data-value="' . $term_id . '">' . $term_name . '</a>'; } } } if ($key === 'keyword') { $html .= '<a href="javascript:void(0)" data-key="keyword">' . __('Search For: ', 'wcapf') . $active_filter . '</a>'; } if ($key === 'orderby') { $html .= '<a href="javascript:void(0)" data-key="orderby">' . __('Orderby: ', 'wcapf') . $active_filter . '</a>'; } if ($key === 'min_price') { $html .= '<a href="javascript:void(0)" data-key="min-price">' . __('Min Price: ', 'wcapf') . $active_filter . '</a>'; } if ($key === 'max_price') { $html .= '<a href="javascript:void(0)" data-key="max-price">' . __('Max Price: ', 'wcapf') . $active_filter . '</a>'; } } $html .= '</div>'; } extract($args); // Add class to before_widget from within a custom widget // http://wordpress.stackexchange.com/questions/18942/add-class-to-before-widget-from-within-a-custom-widget if ($found === false) { $widget_class = 'wcapf-widget-hidden woocommerce wcapf-ajax-term-filter'; } else { $widget_class = 'woocommerce wcapf-ajax-term-filter'; } // no class found, so add it if (strpos($before_widget, 'class') === false) { $before_widget = str_replace('>', 'class="' . $widget_class . '"', $before_widget); } else { $before_widget = str_replace('class="', 'class="' . $widget_class . ' ', $before_widget); } echo $before_widget; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } echo $html; echo $args['after_widget']; }
/** * Load Scripts * * Enqueues the required scripts. * * @since 1.0 * @global $post * @return void */ function edd_load_scripts() { global $post; $js_dir = EDD_PLUGIN_URL . 'assets/js/'; // Use minified libraries if SCRIPT_DEBUG is turned off $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // Get position in cart of current download if (isset($post->ID)) { $position = edd_get_item_position_in_cart($post->ID); } $has_purchase_links = false; if (!empty($post->post_content) && (has_shortcode($post->post_content, 'purchase_link') || has_shortcode($post->post_content, 'downloads')) || is_post_type_archive('download')) { $has_purchase_links = true; } if (edd_is_checkout()) { if (edd_is_cc_verify_enabled()) { wp_register_script('creditCardValidator', $js_dir . 'jquery.creditCardValidator' . $suffix . '.js', array('jquery'), EDD_VERSION); wp_enqueue_script('creditCardValidator'); } wp_register_script('edd-checkout-global', $js_dir . 'edd-checkout-global' . $suffix . '.js', array('jquery'), EDD_VERSION); wp_enqueue_script('edd-checkout-global'); wp_localize_script('edd-checkout-global', 'edd_global_vars', apply_filters('edd_global_checkout_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'checkout_nonce' => wp_create_nonce('edd_checkout_nonce'), 'currency_sign' => edd_currency_filter(''), 'currency_pos' => edd_get_option('currency_position', 'before'), 'decimal_separator' => edd_get_option('decimal_separator', '.'), 'thousands_separator' => edd_get_option('thousands_separator', ','), 'no_gateway' => __('Please select a payment method', 'easy-digital-downloads'), 'no_discount' => __('Please enter a discount code', 'easy-digital-downloads'), 'enter_discount' => __('Enter discount', 'easy-digital-downloads'), 'discount_applied' => __('Discount Applied', 'easy-digital-downloads'), 'no_email' => __('Please enter an email address before applying a discount code', 'easy-digital-downloads'), 'no_username' => __('Please enter a username before applying a discount code', 'easy-digital-downloads'), 'purchase_loading' => __('Please Wait...', 'easy-digital-downloads'), 'complete_purchase' => __('Purchase', 'easy-digital-downloads'), 'taxes_enabled' => edd_use_taxes() ? '1' : '0', 'edd_version' => EDD_VERSION))); } // Load AJAX scripts, if enabled if (!edd_is_ajax_disabled()) { wp_register_script('edd-ajax', $js_dir . 'edd-ajax' . $suffix . '.js', array('jquery'), EDD_VERSION); wp_enqueue_script('edd-ajax'); wp_localize_script('edd-ajax', 'edd_scripts', apply_filters('edd_ajax_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'position_in_cart' => isset($position) ? $position : -1, 'has_purchase_links' => $has_purchase_links, 'already_in_cart_message' => __('You have already added this item to your cart', 'easy-digital-downloads'), 'empty_cart_message' => __('Your cart is empty', 'easy-digital-downloads'), 'loading' => __('Loading', 'easy-digital-downloads'), 'select_option' => __('Please select an option', 'easy-digital-downloads'), 'ajax_loader' => set_url_scheme(EDD_PLUGIN_URL . 'assets/images/loading.gif', 'relative'), 'is_checkout' => edd_is_checkout() ? '1' : '0', 'default_gateway' => edd_get_default_gateway(), 'redirect_to_checkout' => edd_straight_to_checkout() || edd_is_checkout() ? '1' : '0', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0', 'quantities_enabled' => edd_item_quantities_enabled(), 'taxes_enabled' => edd_use_taxes() ? '1' : '0'))); } }
/** * Display breadcrumbs */ public function display() { if (Habakiri::get('is_displaying_bread_crumb') === 'false') { return; } global $wp_query; // Set to home $home_label = $this->get_home_label(); $this->set($home_label, home_url('/')); // Set to blog $post_type = $this->get_post_type(); if (is_category() || is_tag() || is_date() || is_author() || is_single() && $post_type === 'post') { $show_on_front = get_option('show_on_front'); $page_for_posts = get_option('page_for_posts'); if ($show_on_front === 'page' && $page_for_posts) { $this->set(get_the_title($page_for_posts), get_permalink($page_for_posts)); } } // Set current and ancestors if (is_404()) { $this->set_for_404(); } elseif (is_search()) { $this->set_for_search(); } elseif (is_tax()) { $this->set_for_tax(); } elseif (is_attachment()) { $this->set_for_attachment(); } elseif (is_page() && !is_front_page()) { $this->set_for_page(); } elseif (is_post_type_archive()) { $this->set_for_post_type_archive(); } elseif (is_single()) { $this->set_for_single(); } elseif (is_category()) { $this->set_for_category(); } elseif (is_tag()) { $this->set_for_tag(); } elseif (is_author()) { $this->set_for_author(); } elseif (is_day()) { $this->set_for_day(); } elseif (is_month()) { $this->set_for_month(); } elseif (is_year()) { $this->set_for_year(); } elseif (is_home() && !is_front_page()) { $this->set_for_blog(); } $bread_crumb = array(); $last_item = array_pop($this->bread_crumb); foreach ($this->bread_crumb as $_bread_crumb) { if (!empty($_bread_crumb['link'])) { $bread_crumb[] = sprintf('<a href="%s">%s</a>', esc_url($_bread_crumb['link']), esc_html($_bread_crumb['title'])); } else { $bread_crumb[] = esc_html($_bread_crumb['title']); } } $bread_crumb[] = sprintf('<strong>%s</strong>', $last_item['title']); printf('<div class="breadcrumbs">%s</div>', implode(' > ', apply_filters('habakiri_bread_crumb', $bread_crumb))); }
function mpp_gallery_archive_redirect() { if (is_post_type_archive(mpp_get_gallery_post_type()) && mediapress()->is_bp_active() && mpp_get_option('has_gallery_directory') && isset(buddypress()->pages->mediapress->id)) { wp_safe_redirect(get_permalink(buddypress()->pages->mediapress->id), 301); exit(0); } }
public function archiveTemplate($template) { if (\is_post_type_archive($this->postType)) { $template = __DIR__ . '/templates/archive-template.php'; } return $template; }
/** * Load a template. * * Handles template usage so that we can use our own templates instead of the themes. * * Templates are in the 'templates' folder. woocommerce looks for theme * overrides in /theme/woocommerce/ by default * * For beginners, it also looks for a woocommerce.php template first. If the user adds * this to the theme (containing a woocommerce() inside) this will be used for all * woocommerce templates. * * @param mixed $template * @return string */ public function template_loader($template) { $find = array('woocommerce.php'); $file = ''; if (is_single() && get_post_type() == 'product') { $file = 'single-product.php'; $find[] = $file; $find[] = WC_TEMPLATE_PATH . $file; } elseif (is_tax('product_cat') || is_tax('product_tag')) { $term = get_queried_object(); $file = 'taxonomy-' . $term->taxonomy . '.php'; $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = WC_TEMPLATE_PATH . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = $file; $find[] = WC_TEMPLATE_PATH . $file; } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) { $file = 'archive-product.php'; $find[] = $file; $find[] = WC_TEMPLATE_PATH . $file; } if ($file) { $template = locate_template($find); $status_options = get_option('woocommerce_status_options', array()); if (!$template || !empty($status_options['template_debug_mode']) && current_user_can('manage_options')) { $template = WC()->plugin_path() . '/templates/' . $file; } } return $template; }
function cap_podcast_change_archive_title($title) { if (is_post_type_archive('cap_podcast')) { $title = $title . '<div class="rss-feed"><a href="' . get_feed_link() . '?post_type=cap_podcast"><span class="dashicons dashicons-rss"></span> Subscribe to Podcast</a></div>'; } return $title; }
/** * Page titles */ function roots_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Most Recent Posts', 'roots'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Old Posts, Organized by Day: %s', 'roots'), get_the_date()); } elseif (is_month()) { return sprintf(__('Old Posts, Organized by Month: %s', 'roots'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Old Posts, Organized by Year: %s', 'roots'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Old Posts, Organized by Author: %s', 'roots'), apply_filters('the_author', is_object($author) ? $author->display_name : null)); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'roots'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'roots'); } else { return get_the_title(); } }
/** * Are we on a Sunshine related page * * @since 1.0 * @param string $from Help determine where this call is being made for debugging * @return bool */ function is_sunshine($from = '') { global $post, $sunshine; $return = ''; if (isset($_GET['sunshine']) && $_GET['sunshine'] == 1 || isset($_POST['sunshine']) && $_POST['sunshine'] == 1) { $return = 'SUNSHINE'; } if (isset($post) && is_array($sunshine->pages) && in_array($post->ID, $sunshine->pages)) { $return = 'SUNSHINE PAGE'; } if (get_post_type($post) == 'sunshine-gallery') { $return = 'SUNSHINE-GALLERY'; } if (is_post_type_archive('sunshine-gallery')) { $return = 'SUNSHINE-GALLERY-ARCHIVE'; } if (isset($post) && $post->post_parent > 0 && get_post_type($post->post_parent) == 'sunshine-gallery') { $return = 'SUNSHINE GALLERY ATTACHMENT'; } if (get_post_type($post) == 'sunshine-order') { $return = 'SUNSHINE ORDER'; } if ($return) { if (!defined('IS_SUNSHINE')) { define('IS_SUNSHINE', $return); } return $return; } else { return false; } }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { if (!is_post_type_archive('product') && !is_tax(get_object_taxonomies('product'))) { return; } global $wcapf; // price range for filtered products $filtered_price_range = $wcapf->getPriceRange(true); // price range for all published products $unfiltered_price_range = $wcapf->getPriceRange(false); $html = ''; // to be sure that these values are number $min_val = $max_val = 0; if (sizeof($unfiltered_price_range) === 2) { $min_val = $unfiltered_price_range[0]; $max_val = $unfiltered_price_range[1]; } // required scripts // enqueue necessary scripts wp_enqueue_style('wcapf-style'); wp_enqueue_style('font-awesome'); wp_enqueue_script('wcapf-script'); wp_enqueue_script('wcapf-nouislider-script'); wp_enqueue_script('wcapf-price-filter-script'); wp_enqueue_style('wcapf-nouislider-style'); // get values from url $set_min_val = null; if (isset($_GET['min-price']) && !empty($_GET['min-price'])) { $set_min_val = (int) $_GET['min-price']; } $set_max_val = null; if (isset($_GET['max-price']) && !empty($_GET['max-price'])) { $set_max_val = (int) $_GET['max-price']; } // HTML markup for price slider $html .= '<div class="wcapf-price-filter-wrapper">'; $html .= '<div id="wcapf-noui-slider" class="noUi-extended" data-min="' . $min_val . '" data-max="' . $max_val . '" data-set-min="' . $set_min_val . '" data-set-max="' . $set_max_val . '"></div>'; $html .= '<br />'; $html .= '<div class="slider-values">'; $html .= '<p>Min Price: <span class="wcapf-slider-value" id="wcapf-noui-slider-value-min"></span></p>'; $html .= '<p>Max Price: <span class="wcapf-slider-value" id="wcapf-noui-slider-value-max"></span></p>'; $html .= '</div>'; $html .= '</div>'; extract($args); // Add class to before_widget from within a custom widget // http://wordpress.stackexchange.com/questions/18942/add-class-to-before-widget-from-within-a-custom-widget $widget_class = 'woocommerce wcapf-price-filter-widget'; // no class found, so add it if (strpos($before_widget, 'class') === false) { $before_widget = str_replace('>', 'class="' . $widget_class . '"', $before_widget); } else { $before_widget = str_replace('class="', 'class="' . $widget_class . ' ', $before_widget); } echo $before_widget; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } echo $html; echo $args['after_widget']; }
function car_artists_sort_order($query) { if (is_post_type_archive('car_artists')) { $query->set('order', 'ASC'); $query->set('orderby', 'menu_order'); } }
function context_check($check, $settings) { if (empty($settings)) { return $check; } $status = array(); if (!is_array($this->post_types)) { $this->set_objects(); } foreach ($this->post_types as $post_type => $post_type_settings) { if (isset($settings['is_singular-' . $post_type]) && $settings['is_singular-' . $post_type]) { $status['is_singular-' . $post_type] = is_singular($post_type); } if (isset($settings['is_archive-' . $post_type]) && $settings['is_archive-' . $post_type]) { $status['is_archive-' . $post_type] = is_post_type_archive($post_type); } } foreach ($this->taxonomies as $taxonomy => $tax_settings) { if (isset($settings['is_tax-' . $taxonomy]) && $settings['is_tax-' . $taxonomy]) { $status['is_tax-' . $taxonomy] = is_tax($taxonomy); } } $matched = array_intersect_assoc($settings, $status); if (!empty($matched)) { return true; } return $check; }
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $indent = $depth ? str_repeat("\t", $depth) : ''; $li_attributes = ''; $class_names = $value = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; // managing divider: add divider class to an element to get a divider before it. $divider_class_position = array_search('divider', $classes); if ($divider_class_position !== false) { $output .= "<li class=\"divider\"></li>\n"; unset($classes[$divider_class_position]); } $classes[] = $args->has_children ? 'dropdown' : ''; $classes[] = $item->current || $item->current_item_ancestor || 'Courses' === $item->title && is_post_type_archive('course') || 'Courses' === $item->title && is_singular('course') ? 'active' : ''; $classes[] = 'menu-item-' . $item->ID; if ($depth && $args->has_children) { $classes[] = 'dropdown-submenu'; } $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); $class_names = ' class="' . esc_attr($class_names) . '"'; $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); $id = strlen($id) ? ' id="' . esc_attr($id) . '"' : ''; $output .= $indent . '<li' . $id . $value . $class_names . $li_attributes . '>'; $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : ''; $attributes .= $args->has_children ? ' class="dropdown-toggle" data-toggle="dropdown"' : ''; $item_output = $args->before; $item_output .= '<a' . $attributes . '>'; $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; $item_output .= $depth == 0 && $args->has_children ? ' <b class="caret"></b></a>' : '</a>'; $item_output .= $args->after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }
function woothemes_add_css() { global $woo_options; wp_register_style('prettyPhoto', get_template_directory_uri() . '/includes/css/prettyPhoto.css'); wp_register_style('non-responsive', get_template_directory_uri() . '/css/non-responsive.css'); // Disable prettyPhoto css if WooCommerce is activated and user is on the product page $woocommerce_activated = is_woocommerce_activated(); $woocommerce_lightbox = get_option('woocommerce_enable_lightbox') == 'yes' ? true : false; $woocommerce_product = false; if ($woocommerce_activated) { $woocommerce_product = is_product(); } if ($woocommerce_activated && $woocommerce_product && $woocommerce_lightbox) { wp_deregister_style('prettyPhoto'); } // Conditionally load the Portfolio CSS, where needed. $load_portfolio_css = false; if (is_page_template('template-portfolio.php') || is_singular() && get_post_type() == 'portfolio' || is_post_type_archive('portfolio') || is_tax('portfolio-gallery')) { $load_portfolio_css = true; } // Allow child themes/plugins to load the portfolio CSS when they need it. $load_portfolio_css = apply_filters('woo_load_portfolio_css', $load_portfolio_css); if ($load_portfolio_css) { wp_enqueue_style('prettyPhoto'); } do_action('woothemes_add_css'); }
public static function pre_get_posts($query) { if (is_post_type_archive('portifolio')) { $query->set('posts_per_page', -1); } return $query; }
function add_builtin_template($template) { $theme_files = array(); $template_path = ''; if (is_post_type_archive('route')) { $theme_files = array('archive-route.php', 'djb-rrr/archive-route.php'); $template_path = plugin_dir_path(__FILE__) . '../../public/archive-route.php'; } elseif (is_tax('route-category')) { $theme_files = array('taxonomy-route.php', 'djb-rrr/taxonomy-route.php'); $template_path = plugin_dir_path(__FILE__) . '../../public/taxonomy-route.php'; } elseif (is_singular('route')) { $theme_files = array('single-route.php', 'djb-rrr/single-route.php'); $template_path = plugin_dir_path(__FILE__) . '../../public/single-route.php'; } if (count($theme_files) > 0) { //We use the presence of theme files to check as an indicator that we might want to inject a template. If we wanted to always inject, we'd need to do something different. $exists_in_theme = locate_template($theme_files, false); if ($exists_in_theme != '') { return $exists_in_theme; } else { return $template_path; } } return $template; }
/** * Page titles */ function pinnacle_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Latest Posts', 'pinnacle'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return $term->name; } elseif (is_post_type_archive()) { return get_queried_object()->labels->name; } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'pinnacle'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'pinnacle'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'pinnacle'), get_the_date('Y')); } elseif (is_author()) { return sprintf(__('Author Archives: %s', 'pinnacle'), get_the_author()); } else { return single_cat_title("", false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'pinnacle'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'pinnacle'); } else { return get_the_title(); } }
/** * Page titles */ function stachestack_title() { if (is_home()) { if (get_option('page_for_posts', true)) { $title = get_the_title(get_option('page_for_posts', true)); } else { $title = __('Latest Posts', 'stachestack'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { $title = apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { $title = apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date()); } elseif (is_month()) { $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y')); } elseif (is_year()) { $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y')); } elseif (is_author()) { $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name); } else { $title = single_cat_title('', false); } } elseif (is_search()) { $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query()); } elseif (is_404()) { $title = __('Not Found', 'stachestack'); } else { $title = get_the_title(); } return apply_filters('stachestack_title', $title); }
/** * Check for an archive-{post-type} situation. * * @param string $postType The post type to check for * @param array $details Settings for the route */ private static function archive($postType, array $details) { if ((is_post_type_archive($postType) || is_home()) && !is_search()) { self::loadController($details); exit; } }
function afia_title() { if (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'afia'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'afia'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'afia'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Author Archives: %s', 'afia'), $author->display_name); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'afia'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'afia'); } else { $c = get_the_category(); $cat_name = $c[0]->name; $cat_id = get_cat_ID($cat_name); $cat_link = get_category_link($cat_id); $lk = '<span class="idle"><a href = "' . $cat_link . '" title = "' . __('Category ', 'afia') . '->' . $cat_name . '">' . $cat_name . '</a></span> | ' . get_the_title(); return $lk; } }
/** * Load a template. * * Handles template usage so that we can use our own templates instead of the themes. * * Templates are in the 'templates' folder. woocommerce looks for theme * overrides in /theme/woocommerce/ by default * * For beginners, it also looks for a woocommerce.php template first. If the user adds * this to the theme (containing a woocommerce() inside) this will be used for all * woocommerce templates. * * @param mixed $template * @return string */ public static function template_loader($template) { $find = array('woocommerce.php'); $file = ''; if (is_single() && get_post_type() == 'product') { $file = 'single-product.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } elseif (is_product_taxonomy()) { $term = get_queried_object(); if (is_tax('product_cat') || is_tax('product_tag')) { $file = 'taxonomy-' . $term->taxonomy . '.php'; } else { $file = 'archive-product.php'; } $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = 'taxonomy-' . $term->taxonomy . '.php'; $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) { $file = 'archive-product.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } if ($file) { $template = locate_template(array_unique($find)); if (!$template || WC_TEMPLATE_DEBUG_MODE) { $template = WC()->plugin_path() . '/templates/' . $file; } } return $template; }