function presscore_search_title_shortcode() { $title = ''; $wrap_class = ''; if (is_search()) { $title = get_search_query(); } else { if (is_archive()) { if (is_category()) { $title = single_cat_title('', false); } elseif (is_tag()) { $title = single_tag_title('', false); } elseif (is_author()) { the_post(); $title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>'; $wrap_class .= ' vcard'; rewind_posts(); } elseif (is_day()) { $title = '<span>' . get_the_date() . '</span>'; } elseif (is_month()) { $title = '<span>' . get_the_date('F Y'); } elseif (is_year()) { $title = '<span>' . get_the_date('Y'); } elseif (is_tax('dt_portfolio_category')) { $title = single_term_title('', false); } elseif (is_tax('dt_gallery_category')) { $title = single_term_title('', false); } } } if ($title) { $title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>'; } return $title; }
/** * Return the HTML link of the translation of a post. * * @param $post_id integer id of post. If it is null, then it converts the current URL with the language specified. * @param $language string language of translation. If it is null or invalid, current language loaded in the page is used. * @param $label string inner text of the link. * @param $class string text to include as class parameter in the link * * @return string the HTML link of the translation link of a post. */ function uls_get_link($post_id = null, $language = null, $label = null, $class = 'uls-link') { // instance the atribute $translation_url = "#"; if ($post_id == null) { if (is_home() || is_front_page() || is_archive() || is_search() || is_author() || is_category() || is_tag() || is_date()) { $url = uls_get_browser_url(); $translation_url = uls_get_url_translated($url, $language); } else { if (is_search()) { $url = get_home_url(); $url .= "?s=" . get_search_query(); $translation_url = uls_get_url_translated($url, $language); } } } else { $translation_id = uls_get_post_translation_id($post_id, $language); if (empty($translation_id)) { $translation_id = $post_id; } //set conversion of permalinks to true global $uls_permalink_convertion; $uls_permalink_convertion = true; $translation_url = uls_get_url_translated(get_permalink($translation_id), $language); //reset conversion of permalinks $uls_permalink_convertion = false; $title = get_the_title($translation_id); } if (null == $label) { return '<a class="' . $class . '" href="' . $translation_url . '" >' . $title . '</a>'; } else { return '<a class="' . $class . '" href="' . $translation_url . '" >' . $label . '</a>'; } }
function ikaros_filter_wp_title($title, $separator) { if (is_feed()) { return $title; } global $paged, $page; if (is_search()) { //If we're a search, let's start over: $title = sprintf(__('Search results for %s', 'ikaros'), '"' . get_search_query() . '"'); //Add a page number if we're on page 2 or more: if ($paged >= 2) { $title .= " {$separator} " . sprintf(__('Page %s', 'ikaros'), $paged); } //Add the site name to the end: $title .= " {$separator} " . get_bloginfo('name', 'display'); //We're done. Let's send the new title back to wp_title(): return $title; } //Otherwise, let's start by adding the site name to the end: $title .= get_bloginfo('name', 'display'); //If we have a site description and we're on the home/front page, add the description: $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) { $title .= " {$separator} " . $site_description; } //Add a page number if necessary: if ($paged >= 2 || $page >= 2) { $title .= " {$separator} " . sprintf(__('Page %s', 'ikaros'), max($paged, $page)); } //Return the new title to wp_title(): return $title; }
function wptouch_theme_archive_text() { if (!is_home()) { echo '<div class="archive-text">'; } if (is_search()) { echo sprintf(__("Search results › %s", "wptouch-pro"), get_search_query()); } if (is_category()) { echo sprintf(__("Categories › %s", "wptouch-pro"), single_cat_title("", false)); } elseif (is_tag()) { echo sprintf(__("Tags › %s", "wptouch-pro"), single_tag_title(" ", false)); } elseif (is_day()) { echo sprintf(__("Archives › %s", "wptouch-pro"), get_the_time('F jS, Y')); } elseif (is_month()) { echo sprintf(__("Archives › %s", "wptouch-pro"), get_the_time('F, Y')); } elseif (is_year()) { echo sprintf(__("Archives › %s", "wptouch-pro"), get_the_time('Y')); } elseif (is_404()) { echo __("404 Not Found", "wptouch-pro"); } if (!is_home()) { echo '</div>'; } }
/** * Generates Bootstrap powered WordPress compatible search form. * * @return String Form HTML. */ function bootswatch_get_search_form() { ob_start(); ?> <form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url()); ?> "> <div class="input-group"> <input class="form-control" name="s" value="<?php echo get_search_query(); ?> "> <span class="input-group-btn"> <button type="submit" class="btn btn-default"> <span class="glyphicon glyphicon-search"></span> <span class="screen-reader-text"><?php esc_html_e('Search', 'bootswatch'); ?> </span> </button> </span> </div> </form> <?php $form = ob_get_clean(); return $form; }
function warrior_archive_title() { global $wp_query; $title = ''; if (is_category()) { $title = sprintf(__('%s <span>Category Archives</span>', 'familia'), single_cat_title('', false)); } elseif (is_tag()) { $title = sprintf(__('%s <span>Tag Archives</span>', 'familia'), single_tag_title('', false)); } elseif (get_post_format()) { $title = sprintf(__('Post Format: %s', 'familia'), get_post_format_string(get_post_format())); } elseif (is_day()) { $title = sprintf(__('%s <span>Daily Archives</span>', 'familia'), date_i18n('d', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_month()) { $title = sprintf(__('%s <span>Monthly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_year()) { $title = sprintf(__('%s <span>Yearly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_author()) { $author = get_user_by('slug', get_query_var('author_name')); $title = sprintf(__('%s <span>Author Archives</span>', 'familia'), get_the_author_meta('display_name', $author->ID)); } elseif (is_search()) { if ($wp_query->found_posts) { $title = sprintf(__('Search Results for: "%s"', 'familia'), esc_attr(get_search_query())); } else { $title = sprintf(__('No Results for: "%s"', 'familia'), esc_attr(get_search_query())); } } elseif (is_404()) { $title = __('Not Found', 'familia'); } elseif (is_home() || is_front_page() || is_single()) { $title = ''; } else { $title = __('Blog', 'familia'); } return $title; }
/** * You can use this to output a proper title for your page. This handles special cases such as archive page titles, * taxonomy archives, etc. * * @return string A nice page title */ public static function mainPageTitle() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Latest Posts', 'baobab'); } } 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', 'baobab'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'baobab'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'baobab'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Author Archives: %s', 'baobab'), 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', 'baobab'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'baobab'); } else { return get_the_title(); } }
function ubik_search_form($html) { global $ubik_search_form_counter; // Helper text used throughout the form $help = apply_filters('ubik_search_form_text', __('Search', 'ubik')); // Generate a unique ID for this search form $id = 's-' . uniqid(); // Accessibility text $label = '<label for="' . $id . '" class="screen-reader-text">' . $help . '</label>'; // Smarter default search form value $value = ''; if (is_search()) { $value = 'value="' . esc_attr(get_search_query()) . '"'; } // Search field $input = '<input id="' . $id . '" name="s" type="search" class="search-field" placeholder="' . $help . '…" title="' . $help . '" ' . $value . '/>'; // Search button (with customizable contents) $button = '<button type="submit" class="search-submit">' . apply_filters('ubik_search_button', __('Search', 'ubik')) . '</button>'; // Assemble form contents; the "reverse" style places a wrapper around the search field and submit button to allow for flex-width search forms if (UBIK_SEARCH_FORM_REVERSE) { $contents = $button . '<div class="search-field-wrap">' . $input . '</div>'; } else { $contents = $input . $button; } // Wrap it all up and return return '<form role="search" method="get" class="search-form" action="' . trailingslashit(home_url()) . '">' . $label . $contents . '</form>'; }
/** * Get the search form label. * * @since 1.0.0 * @access protected * @return string */ function _carelib_search_form_get_input() { $id = uniqid('searchform-'); $label = sprintf('<label id="%1$s-label" for="%1$s" class="screen-reader-text">%2$s</label>', esc_attr($id), esc_attr(apply_filters("{$GLOBALS['carelib_prefix']}_search_form_label", __('Search site', 'carelib')))); $input = sprintf('<input type="search" name="s" id="%s" placeholder="%s" autocomplete="off" value="%s" />', esc_attr($id), esc_attr(apply_filters("{$GLOBALS['carelib_prefix']}_search_text", __('Search this website', 'carelib'))), esc_attr(apply_filters('the_search_query', get_search_query() ? get_search_query() : ''))); return $label . $input; }
/** * Handle output of page title */ function boilerplate_title($post = null) { $queried_object = get_queried_object(); if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Latest Posts', 'boilerplate'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term && get_query_var('taxonomy') !== 'language') { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', @$queried_object->labels->name ?: $queried_object->post_title); } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'boilerplate'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'boilerplate'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'boilerplate'), get_the_date('Y')); } elseif (is_author()) { $author = $queried_object; return sprintf(__('Author Archives: %s', 'boilerplate'), 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”', 'boilerplate'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'boilerplate'); } else { return get_the_title(); } }
function _esc_search_widget($html) { ob_start(); ?> <form role="search" method="get" action="<?php echo esc_url(home_url()); ?> " class="search-form form-inline"> <div class="input-group"> <input type="text" value="<?php echo get_search_query(); ?> " name="s" placeholder="<?php _e('Search on this site', 'wig'); ?> " class="form-control" /> <span class="input-group-btn"> <button class="btn btn-primary" type="submit"> <i class="glyphicon glyphicon-search"></i> </button> </span> </div> </form> <?php return ob_get_clean(); }
function mh_page_title() { if (is_home()) { echo get_the_title(get_option('page_for_posts', true)); } elseif (is_author()) { global $author; $user_info = get_userdata($author); echo __('Articles by ', 'mh') . esc_attr($user_info->display_name); } elseif (is_category() || is_tax()) { echo single_cat_title("", false); } elseif (is_tag()) { echo single_tag_title("", false); } elseif (is_search()) { echo __('Search Results for ', 'mh') . get_search_query(); } elseif (is_day()) { echo get_the_date(); } elseif (is_month()) { echo get_the_date('F Y'); } elseif (is_year()) { echo get_the_date('Y'); } elseif (is_404()) { echo __('Page not found (404)', 'mh'); } else { echo get_the_title(); } }
function form() { // Define strings and elements; note the presence of two filters, one for help text and the other for the contents of the button $strings = ['id' => 's-' . uniqid(), 'help' => esc_attr(apply_filters('ubik_search_help_text', __('Search', 'ubik')))]; // Assemble complete form return apply_filters('ubik_search_form', sprintf('<form method="get" class="%s" action="%s" role="search">%s%s%s</form>', esc_attr(option('form_class')), trailingslashit(home_url()), sprintf('<label for="%1$s" class="screen-reader-text">%2$s</label>', $strings['id'], $strings['help']), sprintf('<input id="%1$s" name="s" type="search" class="search-field" placeholder="%2$s…" title="%2$s" %3$s/>', $strings['id'], $strings['help'], is_search() ? 'value="' . esc_attr(get_search_query()) . '"' : ''), sprintf('<button type="submit" class="search-submit">%s</button>', apply_filters('ubik_search_form_button', __('Search', 'ubik'))))); }
/** * 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); }
/** * Page titles */ function 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', 'sage'); } } elseif (is_front_page()) { return "<span>Lemon Tree Trust Homepage</span>"; } elseif (is_archive()) { return get_the_archive_title(); } elseif (is_search()) { return sprintf(__('Search Results for %s', 'sage'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'sage'); } elseif (is_page()) { $full = get_the_title(); if (has_post_thumbnail($post->ID)) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); //echo $image[0]; echo "<div id='custom-bg' style='background-image: url(" . $image[0] . ")' > <div class='desc page_title'>"; echo '<h2>' . get_the_title() . '</h2></div> </div>'; } //return $full; } else { return get_the_title(); } }
function cpotheme_page_title() { global $post; if (isset($post->ID)) { $current_id = $post->ID; } else { $current_id = false; } $title_tag = function_exists('is_woocommerce') && is_woocommerce() && is_singular('product') ? 'span' : 'h1'; echo '<' . $title_tag . ' class="pagetitle-title heading">'; if (function_exists('is_woocommerce') && is_woocommerce()) { woocommerce_page_title(); } elseif (is_category() || is_tag() || is_tax()) { echo single_tag_title('', true); } elseif (is_author()) { the_author(); } elseif (is_date()) { _e('Archive', 'brilliance'); } elseif (is_404()) { echo __('Page Not Found', 'brilliance'); } elseif (is_search()) { echo __('Search Results for', 'brilliance') . ' "' . get_search_query() . '"'; } else { echo get_the_title($current_id); } echo '</' . $title_tag . '>'; }
/** * Replace the default search form with a Genesis-specific form. * * The exact output depends on whether the child theme supports HTML5 or not. * * Applies the `genesis_search_text`, `genesis_search_button_text`, `genesis_search_form_label` and * `genesis_search_form` filters. * * @since 0.2.0 * * @uses genesis_html5() Check for HTML5 support. * * @return string HTML markup. */ function genesis_search_form() { $search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('genesis_search_text', __('Search this website', 'genesis') . ' …'); $button_text = apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis')); $onfocus = "if ('" . esc_js($search_text) . "' === this.value) {this.value = '';}"; $onblur = "if ('' === this.value) {this.value = '" . esc_js($search_text) . "';}"; //* Empty label, by default. Filterable. $label = apply_filters('genesis_search_form_label', ''); $value_or_placeholder = get_search_query() == '' ? 'placeholder' : 'value'; if (genesis_html5()) { $form = sprintf('<form %s>', genesis_attr('search-form')); if (genesis_a11y('search-form')) { if ('' == $label) { $label = apply_filters('genesis_search_text', __('Search this website', 'genesis')); } $form_id = uniqid('searchform-'); $form .= sprintf('<meta itemprop="target" content="%s"/><label class="search-form-label screen-reader-text" for="%s">%s</label><input itemprop="query-input" type="search" name="s" id="%s" %s="%s" /><input type="submit" value="%s" /></form>', home_url('/?s={s}'), esc_attr($form_id), esc_html($label), esc_attr($form_id), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text)); } else { $form .= sprintf('%s<meta itemprop="target" content="%s"/><input itemprop="query-input" type="search" name="s" %s="%s" /><input type="submit" value="%s" /></form>', esc_html($label), home_url('/?s={s}'), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text)); } } else { $form = sprintf('<form method="get" class="searchform search-form" action="%s" role="search" >%s<input type="text" value="%s" name="s" class="s search-input" onfocus="%s" onblur="%s" /><input type="submit" class="searchsubmit search-submit" value="%s" /></form>', home_url('/'), esc_html($label), esc_attr($search_text), esc_attr($onfocus), esc_attr($onblur), esc_attr($button_text)); } return apply_filters('genesis_search_form', $form, $search_text, $button_text, $label); }
public function search($query) { if (function_exists('is_main_query') && !$query->is_main_query()) { return $query; } if (is_search() && !is_admin() && $this->algolia_registry->validCredential && isset($_GET['instant']) === false) { if ($this->algolia_registry->instant) { $url = get_site_url() . '/?instant=1&s=' . $query->query['s'] . '#q=' . $query->query['s'] . '&page=0&refinements=%5B%5D&numerics_refinements=%7B%7D&index_name=%22' . $this->algolia_registry->index_name . 'all%22'; header('Location: ' . $url); die; } $algolia_query = get_search_query(false); $options = array('hitsPerPage' => $this->algolia_registry->number_by_page, 'page' => get_query_var('paged') ? get_query_var('paged') - 1 : 0); $algolia_helper = new \Algolia\Core\AlgoliaHelper($this->algolia_registry->app_id, $this->algolia_registry->search_key, $this->algolia_registry->admin_key); $results = $algolia_helper->search($algolia_query, $options, $this->algolia_registry->index_name . 'all'); foreach ($results['hits'] as $result) { $this->ids[] = $result['objectID']; } $this->num_pages = $results['nbPages']; $this->total_result_count = $results['nbHits']; $this->page = $results['page']; $query->query = array(); set_query_var('post__in', $this->ids); set_query_var('post_type', null); set_query_var('s', null); set_query_var('paged', null); return $query; } return $query; }
/** * tarski_doctitle() - Returns the document title. * * The order (site name first or last) can be set on the Tarski Options page. * While the function ultimately returns a string, please note that filters * are applied to an array! This allows plugins to easily alter any aspect * of the title. For example, one might write a plugin to change the separator. * @since 1.5 * @param string $sep * @return string $doctitle * @hook filter tarski_doctitle * Filter document titles. */ function tarski_doctitle($sep = '·') { $site_name = get_bloginfo('name'); if (is_404()) { $content = __(sprintf('Error %s', '404'), 'tarski'); } elseif (get_option('show_on_front') == 'posts' && is_home()) { if (get_bloginfo('description')) { $content = get_bloginfo('description'); } } elseif (is_search()) { $content = sprintf(__('Search results for %s', 'tarski'), attribute_escape(get_search_query())); } elseif (is_month()) { $content = single_month_title(' ', false); } elseif (is_tag()) { $content = multiple_tag_titles(); } else { $content = trim(wp_title('', false)); } if ($content) { $elements = array('site_name' => $site_name, 'separator' => $sep, 'content' => $content); } else { $elements = array('site_name' => $site_name); } if (get_tarski_option('swap_title_order')) { $elements = array_reverse($elements, true); } // Filters should return an array $elements = apply_filters('tarski_doctitle', $elements); // But if they don't, it won't try to implode if (check_input($elements, 'array')) { $doctitle = implode(' ', $elements); } echo $doctitle; }
/** * 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(); } }
function featureText() { if (is_front_page()) { the_field('feature_text'); } elseif (is_home() || is_single()) { _e('Rock Theme Official Blog'); } elseif (is_archive()) { _e('Rock Theme Official Blog'); _e('<br>'); single_term_title('Browsing: '); if (is_month()) { $monthNum = get_query_var('monthnum'); $month = date('F', mktime(0, 0, 0, $monthNum)); $year = get_query_var('year'); echo 'Posts from ' . $month . ' ' . $year; } } elseif (is_page_template('page-news.php') || is_page_template('page-about.php') || is_page_template('page-contact.php')) { bloginfo('name'); _e('<br>'); the_title(); } elseif (is_404()) { _e('Whoops, were a little lost.'); } elseif (is_search()) { _e('Rock Theme Official Blog'); _e('<br>'); printf('Search results for: %s', get_search_query()); } }
/** * 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(); } }
function etheme_search($atts) { extract(shortcode_atts(array('products' => 1, 'posts' => 1, 'portfolio' => 1, 'pages' => 1, 'images' => 1, 'count' => 3, 'class' => ''), $atts)); $search_input = $output = ''; $post_type = "post"; if ($products == 1) { $post_type = "product"; } else { $post_type = "post"; } if (get_search_query() != '') { $search_input = get_search_query(); } $output .= '<div class="et-mega-search ' . $class . '" data-products="' . $products . '" data-count="' . $count . '" data-posts="' . $posts . '" data-portfolio="' . $portfolio . '" data-pages="' . $pages . '" data-images="' . $images . '">'; $output .= '<form method="get" action="' . home_url('/') . '">'; $output .= '<input type="text" value="' . $search_input . '" name="s" id="s" autocomplete="off" placeholder="' . __('Search', ETHEME_DOMAIN) . '"/>'; $output .= '<input type="hidden" name="post_type" value="' . $post_type . '"/>'; $output .= '<input type="submit" value="' . __('Go', ETHEME_DOMAIN) . '" class="button active filled" /> '; $output .= '</form>'; $output .= '<span class="et-close-results"></span>'; $output .= '<div class="et-search-result">'; $output .= '</div>'; $output .= '</div>'; return $output; }
/** * Returns the document title. * * The order (site name first or last) can be set on the Tarski Options page. * While the function ultimately returns a string, please note that filters * are applied to an array! This allows plugins to easily alter any aspect * of the title. For example, one might write a plugin to change the separator. * * @since 1.5 * @deprecated 3.2.0 * * @param string $sep * @return string * * @hook filter tarski_doctitle * Filter document titles. */ function tarski_doctitle($sep = '·') { _deprecated_function('wp_title', '3.2.0'); $site_name = get_bloginfo('name'); $content = trim(wp_title('', false)); if (is_404()) { $content = sprintf(__('Error %s', 'tarski'), '404'); } elseif (get_option('show_on_front') == 'posts' && is_home()) { $content = get_bloginfo('description', 'display'); } elseif (is_search()) { $content = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query())); } elseif (is_month()) { $content = single_month_title(' ', false); } elseif (is_tag()) { $content = multiple_tag_titles(); } $elements = strlen($content) > 0 ? array('site_name' => $site_name, 'separator' => $sep, 'content' => $content) : array('site_name' => $site_name); if (get_tarski_option('swap_title_order')) { $elements = array_reverse($elements, true); } // Filters should return an array $elements = apply_filters('tarski_doctitle', $elements); // But if they don't, it won't try to implode if (is_array($elements)) { $doctitle = implode(' ', $elements); } echo $doctitle; }
/** * 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(); } }
function add_head() { $query = attribute_escape(get_search_query()); if (strlen($query) > 0) { echo '<script type="text/javascript">var hls_query = "' . $query . '";</script>'; } }
/** * Creates the document title. * * The order (site name first or last) can be set on the Tarski Options page. * While the function ultimately returns a string, please note that filters * are applied to an array! This allows plugins to easily alter any aspect * of the title. For example, one might write a plugin to change the separator. * * @since 1.5 * * @param string $sep * @return string * * @hook filter tarski_doctitle * Filter document titles. */ function tarski_document_title($title, $sep, $seplocation) { $title = trim($title); $sitename = get_bloginfo('name'); $enc = get_option('blog_charset'); if (!(isset($enc) && strlen($enc) > 0)) { $enc = "utf-8"; } $slen = mb_strlen($sep, $enc); $tlen = mb_strlen($title, $enc); if ($seplocation == 'right') { $doctitle = mb_substr($title, 0, $tlen - $slen, $enc); } else { $doctitle = mb_substr($title, $slen, $tlen - $slen, $enc); } $doctitle = trim($doctitle); if (is_404()) { $doctitle = sprintf(__('Error %s', 'tarski'), '404'); } elseif (get_option('show_on_front') == 'posts' && is_home()) { $doctitle = get_bloginfo('description', 'display'); } elseif (is_search()) { $doctitle = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query())); } elseif (is_month()) { $doctitle = single_month_title(' ', false); } elseif (is_tag()) { $doctitle = multiple_tag_titles(); } $title = array($sitename, $sep, $doctitle); if (get_tarski_option('swap_title_order')) { $title = array_reverse($title); } return implode(" ", $title); }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <div class="search-widget"> <form role="search" method="get" action="<?php echo site_url(); ?> "> <fieldset> <input id="s" class="search_input" type="text" name="s" value="<?php get_search_query(); ?> "/> <input class="submit" id="searchsubmit" type="submit" value="<?php _e('Search', GETTEXT_DOMAIN); ?> "/> </fieldset> </form> </div> <?php echo $after_widget; }
static function vossen_jubi_get_search_form($echo = true) { $format = current_theme_supports('html5', 'search-form') ? 'html5' : 'xhtml'; $format = apply_filters('search_form_format', $format); if ('html5' == $format) { $form = ' <div class="widget-search"><form role="search" method="get" class="search-form" action="' . esc_url(home_url('/')) . '"> <div class="input-group"> <input type="search" class="form-control search-input" placeholder="' . esc_attr_x('Search …', 'placeholder') . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x('Search for:', 'label') . '" /> <span class="input-group-btn"> <button class="btn btn-default search-button" type="submit"> <i class="fa fa-search"></i> </button> </span> </div> </form></div>'; } else { $form = ' <div class="widget-search"><form role="search" method="get" id="searchform" class="searchform" action="' . esc_url(home_url('/')) . '"> <div class="input-group"> <input type="text" class="form-control search-input" placeholder="' . esc_attr_x('Search …', 'placeholder') . '" value="' . get_search_query() . '" name="s" id="s" /> <span class="input-group-btn"> <button class="btn btn-default search-button" type="submit"> <i class="fa fa-search"></i> </button> </span> </div> </form></div>'; } return $form; }
/** * Get current page URL for layered nav items. * @return string */ protected function get_page_base_url() { if (defined('SHOP_IS_ON_FRONT')) { $link = home_url(); } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) { $link = get_post_type_archive_link('product'); } else { $link = get_term_link(get_query_var('term'), get_query_var('taxonomy')); } // Min/Max if (isset($_GET['min_price'])) { $link = add_query_arg('min_price', wc_clean($_GET['min_price']), $link); } if (isset($_GET['max_price'])) { $link = add_query_arg('max_price', wc_clean($_GET['max_price']), $link); } // Orderby if (isset($_GET['orderby'])) { $link = add_query_arg('orderby', wc_clean($_GET['orderby']), $link); } // Search Arg if (get_search_query()) { $link = add_query_arg('s', get_search_query(), $link); } // Post Type Arg if (isset($_GET['post_type'])) { $link = add_query_arg('post_type', wc_clean($_GET['post_type']), $link); } return $link; }