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;
 }
 function getPost()
 {
     $data = new stdClass();
     $categoryId = (int) get_query_var('cat');
     if (is_tag()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $tagQuery = get_query_var('tag');
         $tagData = get_tags(array('slug' => $tagQuery));
         $data->post->post_title = esc_html($tagData[0]->name);
     } elseif (is_category($categoryId)) {
         $category = get_category($categoryId);
         $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
         $data->post->post_title = ThemeHelper::esc_html($category->name);
     } elseif (is_day()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = get_the_date();
     } elseif (is_archive()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = single_month_title(' ', false);
     } elseif (is_search()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
     } elseif (is_404()) {
         $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
         $data->post->post_title = $data->post->post_title;
     } else {
         return false;
     }
     return $data;
 }
Пример #3
0
/**
 * Display a list categories
 * @param array $args
 * @return bool
 */
function zfwca_list_categories($args = array())
{
    $defaults = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'exclude' => '', 'include' => '', 'exclude_tree' => '', 'current_category' => 0, 'taxonomy' => 'category');
    $r = wp_parse_args($args, $defaults);
    $r['walker'] = new ZFWCA_Post_Category_Walker();
    if (!isset($r['class'])) {
        $r['class'] = 'category' == $r['taxonomy'] ? 'categories' : $r['taxonomy'];
    }
    extract($r);
    if (!taxonomy_exists($taxonomy)) {
        return false;
    }
    $categories = get_categories($r);
    $output = '';
    if (empty($categories)) {
        $output .= 'No categories';
    } else {
        if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
            $current_term_object = get_queried_object();
            if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
                $r['current_category'] = get_queried_object_id();
            }
        }
        $output .= walk_category_tree($categories, 0, $r);
    }
    $output = apply_filters('zfwca_wp_list_categories', $output, $args);
    return $output;
}
Пример #4
0
 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 . '>';
 }
Пример #5
0
 function widget($args, $instance)
 {
     global $wp_query;
     $facets = elasticsearch\Faceting::all();
     $url = null;
     if (is_category() || is_tax()) {
         $url = get_term_link($wp_query->queried_object);
     } elseif (is_tag()) {
         $url = get_tag_link($wp_query->queried_object->term_id);
     } elseif (is_archive()) {
         $url = get_post_type_archive_link($wp_query->queried_object->query_var);
     } elseif (is_search()) {
         $url = home_url('/');
     }
     foreach ($facets as $type => $facet) {
         if (count($facet['selected']) > 0) {
             $name = $type;
             if (taxonomy_exists($type)) {
                 $name = get_taxonomy($type)->label;
             }
             echo '<aside id="facet-' . $type . '-selected" class="widget facets facets-selected">';
             echo '<h3 class="widget-title">' . $name . '</h3>';
             echo '<ul>';
             foreach ($facet['selected'] as $option) {
                 $url = elasticsearch\Faceting::urlRemove($url, $type, $option['slug']);
                 echo '<li id="facet-' . $type . '-' . $option['slug'] . '" class="facet-item">';
                 echo '<a href="' . $url . '">' . $option['name'] . '</a>';
                 echo '</li>';
             }
             echo '</ul>';
             echo '</aside>';
         }
     }
 }
Пример #6
0
 /**
  * Shim for `sociallyviral_archive_title()`.
  *
  * Display the archive title based on the queried object.
  *
  * @todo Remove this function when WordPress 4.3 is released.
  *
  * @param string $before Optional. Content to prepend to the title. Default empty.
  * @param string $after  Optional. Content to append to the title. Default empty.
  */
 function sociallyviral_archive_title($before = '', $after = '')
 {
     if (is_category()) {
         $title = sprintf(__('Category: %s', 'sociallyviral'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(__('Tag: %s', 'sociallyviral'), single_tag_title('', false));
     } elseif (is_author()) {
         $title = sprintf(__('Author: %s', 'sociallyviral'), '<span class="vcard">' . get_the_author() . '</span>');
     } elseif (is_year()) {
         $title = sprintf(__('Year: %s', 'sociallyviral'), get_the_date(_x('Y', 'yearly archives date format', 'sociallyviral')));
     } elseif (is_month()) {
         $title = sprintf(__('Month: %s', 'sociallyviral'), get_the_date(_x('F Y', 'monthly archives date format', 'sociallyviral')));
     } elseif (is_day()) {
         $title = sprintf(__('Day: %s', 'sociallyviral'), get_the_date(_x('F j, Y', 'daily archives date format', 'sociallyviral')));
     } elseif (is_post_type_archive()) {
         $title = sprintf(__('Archives: %s', 'sociallyviral'), post_type_archive_title('', false));
     } elseif (is_tax()) {
         $tax = get_taxonomy(get_queried_object()->taxonomy);
         /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
         $title = sprintf(__('%1$s: %2$s', 'sociallyviral'), $tax->labels->singular_name, single_term_title('', false));
     } else {
         $title = __('Archives', 'sociallyviral');
     }
     /**
      * Filter the archive title.
      *
      * @param string $title Archive title to be displayed.
      */
     $title = apply_filters('get_the_archive_title', $title);
     if (!empty($title)) {
         echo $before . $title . $after;
     }
 }
Пример #7
0
function namespace_add_custom_types($query)
{
    if (is_category() || is_tag() && empty($query->query_vars['suppress_filters'])) {
        $query->set('post_type', array('post', 'nav_menu_item', 'custom_type'));
        return $query;
    }
}
Пример #8
0
/**
 * Title filter 
 */
function mediamaven_filter_wp_title($old_title, $sep, $sep_location)
{
    $site_name = get_bloginfo('name');
    $site_description = get_bloginfo('description');
    // add padding to the sep
    $ssep = ' ' . $sep . ' ';
    if ($site_description && (is_home() || is_front_page())) {
        return $site_name . ' | ' . $site_description;
    } else {
        // find the type of index page this is
        if (is_category()) {
            $insert = $ssep . __('Kategorija', 'media-maven');
        } elseif (is_tag()) {
            $insert = $ssep . __('Žymos', 'media-maven');
        } elseif (is_author()) {
            $insert = $ssep . __('Autorius', 'media-maven');
        } elseif (is_year() || is_month() || is_day()) {
            $insert = $ssep . __('Archyvai', 'media-maven');
        } else {
            $insert = NULL;
        }
        // get the page number we're on (index)
        if (get_query_var('paged')) {
            $num = $ssep . __('Page ', 'media-maven') . get_query_var('paged');
        } elseif (get_query_var('page')) {
            $num = $ssep . __('Page ', 'media-maven') . get_query_var('page');
        } else {
            $num = NULL;
        }
        // concoct and return new title
        return $site_name . $insert . $old_title . $num;
    }
}
Пример #9
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(' &gt; ', apply_filters('habakiri_bread_crumb', $bread_crumb)));
 }
Пример #10
0
function get_index_headline()
{
    if (is_home()) {
        $index_headline = 'Blog Index';
    } else {
        if (is_category()) {
            $category = single_term_title("", false);
            $index_headline = 'Archives for the "' . $category . '" Category';
        } elseif (is_tag()) {
            $tag = single_term_title("", false);
            $index_headline = 'Archives for the "' . $tag . '" Category';
        } elseif (is_day()) {
            $index_headline = 'Archive for ' . get_the_time('F jS, Y');
        } elseif (is_month()) {
            $index_headline = 'Archive for ' . get_the_time('F Y');
        } elseif (is_year()) {
            $index_headline = 'Archive for ' . get_the_time('Y');
        } elseif (is_author()) {
            $index_headline = 'Author Archive';
        } else {
            $index_headline = 'Blog Archives';
        }
    }
    return $index_headline;
}
function custom_intro()
{
    echo "<div class='intro'>";
    if (is_front_page()) {
        if (get_header_image()) {
            echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . get_bloginfo('description') . '" />';
        }
    } else {
        // get title
        $id = get_option('page_for_posts');
        if (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post') || is_home()) {
            $the_title = get_the_title($id);
        } else {
            $the_title = get_the_title();
        }
        if (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            } elseif (get_header_image()) {
                echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . $the_title . '" />';
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        } elseif (get_header_image()) {
            echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . $the_title . '" />';
        }
    }
    echo "</div>";
}
Пример #12
0
 /**
  * Test to see if the page is a date based archive page cpt archive
  *
  * @since  1.0.0
  * @access public
  * @param
  * @return boolean
  */
 public function isCptArchive()
 {
     if (is_category() || is_author() || is_tag() || is_date() || is_front_page() || is_home()) {
         return false;
     }
     return true;
 }
function tcp_add_post_types_in_category_and_tag_template($query)
{
    if (is_category()) {
        $tcp_add_category = get_option('tcp_add_category');
        $tcp_add_category_array = explode(',', $tcp_add_category);
        $tcp_add_category_array[] = 'post';
        $post_type = get_query_var('post_type');
        if ($post_type) {
            $post_type = $post_type;
        } else {
            $post_type = $tcp_add_category_array;
        }
        $query->set('post_type', $post_type);
        return $query;
    }
    if (is_tag()) {
        $tcp_add_tag = get_option('tcp_add_tag');
        $tcp_add_tag_array = explode(',', $tcp_add_tag);
        $tcp_add_tag_array[] = 'post';
        $post_type = get_query_var('post_type');
        if ($post_type) {
            $post_type = $post_type;
        } else {
            $post_type = $tcp_add_tag_array;
        }
        $query->set('post_type', $post_type);
        return $query;
    }
}
Пример #14
0
/**
 * Gets the layout for the current post, page or taxonomy. If none is specified, use 'layout-default'.
 *
 * @since StartBox 2.5
 * @return string The layout for the given page.
 */
function sb_get_layout()
{
    global $wp_query;
    /* Get the available post layouts and store them in an array */
    foreach (get_theme_support('sb-layouts') as $layout => $key) {
        $layouts[] = $layout;
    }
    /* Set the layout to an empty string. */
    $layout = '';
    /* If viewing a singular post/page, check if a layout has been specified. */
    if (is_singular()) {
        /* Get the current post ID. */
        $post_id = $wp_query->get_queried_object_id();
        /* Get the post layout. */
        $layout = sb_get_post_layout($post_id);
    }
    /* If viewing a taxonomy, check if a layout has been specified */
    if (is_category() || is_tag() || is_tax() || is_archive()) {
        global $wp_query;
        $term = $wp_query->get_queried_object();
        $layout = $term->meta['layout'];
    }
    /* Make sure the given layout is in the array of available post layouts for the theme. */
    if (empty($layout) || !in_array($layout, $layouts) || $layout == 'default') {
        $layout = apply_filters('sb_get_post_layout_default', 'default');
    }
    /* Return the layout and allow plugin/theme developers to override it. */
    return esc_attr(apply_filters('get_theme_layout', "layout-{$layout}"));
}
Пример #15
0
 /**
  * optimizeMember's Security Gate ( protects WordPress content ).
  *
  * @package optimizeMember\Security
  * @since 3.5
  *
  * @attaches-to ``add_action("wp");``
  *
  * @return null May redirect a browser *(exiting script execution)*, when/if content is NOT available to the current User/Member.
  */
 public static function security_gate()
 {
     do_action("ws_plugin__optimizemember_before_security_gate", get_defined_vars());
     /**/
     if (is_category()) {
         /* Categories & other inclusives. */
         c_ws_plugin__optimizemember_catgs::check_catg_level_access();
     } else {
         if (is_tag()) {
             /* Post/Page Tags & other inclusives. */
             c_ws_plugin__optimizemember_ptags::check_ptag_level_access();
         } else {
             if (is_single()) {
                 /* All Posts & other inclusives. */
                 c_ws_plugin__optimizemember_posts::check_post_level_access();
             } else {
                 if (is_page()) {
                     /* All Pages & other inclusives. */
                     c_ws_plugin__optimizemember_pages::check_page_level_access();
                 } else {
                     /* Else, we simply look at URIs & other inclusives. */
                     c_ws_plugin__optimizemember_ruris::check_ruri_level_access();
                 }
             }
         }
     }
     /**/
     do_action("ws_plugin__optimizemember_after_security_gate", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
Пример #16
0
/**
 * 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 = '&middot;')
{
    _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;
}
Пример #17
0
 function semifolio_filter_wp_title($old_title, $sep, $sep_location)
 {
     // add padding to the sep
     $ssep = ' ' . $sep . ' ';
     // find the type of index page this is
     if (is_category()) {
         $insert = $ssep . __('Category', 'slaves');
     } elseif (is_tag()) {
         $insert = $ssep . __('Tag', 'slaves');
     } elseif (is_author()) {
         $insert = $ssep . __('Author', 'slaves');
     } elseif (is_year() || is_month() || is_day()) {
         $insert = $ssep . __('Archives', 'slaves');
     } elseif (is_home()) {
         $insert = $ssep . bloginfo('description');
     } else {
         $insert = NULL;
     }
     // get the page number we're on (index)
     if (get_query_var('paged')) {
         $num = $ssep . __('Page ', 'slaves') . get_query_var('paged');
     } elseif (get_query_var('page')) {
         $num = $ssep . __('Page ', 'slaves') . get_query_var('page');
     } else {
         $num = NULL;
     }
     // concoct and return new title
     return bloginfo('name') . $insert . $old_title . $num;
 }
Пример #18
0
function wcr_default_category_title($headline, $term)
{
    if ((is_category() || is_tag()) && empty($headline)) {
        $headline = $term->name;
    }
    return $headline;
}
Пример #19
0
function description()
{
    if (is_home() || is_front_page()) {
        echo trim(of_get_option('site_description'));
    } elseif (is_category()) {
        $description = strip_tags(category_description());
        echo trim($description);
    } elseif (is_single()) {
        if (get_the_excerpt()) {
            echo get_the_excerpt();
        } else {
            global $post;
            $description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($post->post_content))));
            echo mb_substr($description, 0, 220, 'utf-8');
        }
    } elseif (is_search()) {
        echo '“';
        the_search_query();
        echo '”为您找到结果 ';
        global $wp_query;
        echo $wp_query->found_posts;
        echo ' 个';
    } elseif (is_tag()) {
        $description = strip_tags(tag_description());
        echo trim($description);
    } else {
        $description = strip_tags(term_description());
        echo trim($description);
    }
}
Пример #20
0
function check_guide_page($type)
{
    if (is_tag()) {
        $tag = get_queried_object();
        $args = array('post_type' => 'guides', 'posts_per_page' => 1, 'name' => $tag->slug);
        $query = new WP_Query($args);
        $has_guide = $query->have_posts();
        if ($has_guide) {
            while ($query->have_posts()) {
                $query->the_post();
                if ($type === 'title') {
                    $title = get_field('guide_meta_title');
                    if ($title) {
                        return $title;
                    }
                }
                if ($type === 'description') {
                    $desc = get_field('guide_meta_description');
                    if ($desc) {
                        return $desc;
                    }
                }
                if ($type === 'image' && has_post_thumbnail()) {
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                    return $image[0];
                }
            }
        } else {
            if ($type === 'title') {
                $new_title = ucwords($tag->name);
                return $new_title . ' Archives | What The Flicka??';
            }
        }
    }
}
function woocommerce_category_archive_description()
{
    if (is_tax(array('product_cat', 'product_tag')) && get_query_var('paged') == 0) {
        $description = wc_format_content(term_description());
        $image = false;
        if (is_tax() || is_tag() || is_category()) {
            $term = get_queried_object();
            $thumbnail_id = absint(get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true));
            if ($thumbnail_id) {
                $image = wp_get_attachment_image($thumbnail_id, 250);
            } else {
                $image = wc_placeholder_img_src();
            }
        }
        if ($description) {
            $string = '<div class="row margin-bottom">';
            if ($image) {
                $string .= '<div class="col-sm-4 col-sm-push-8">' . $image . '</div>';
            }
            $string .= '<div class="term-description col-sm-8';
            if ($image) {
                $string .= ' col-sm-pull-4';
            }
            $string .= '">' . $description . '</div></div>';
            echo $string;
        }
    }
}
Пример #22
0
/**
 * Prints better page title
 */
function perfect_title()
{
    echo '<title>';
    if (function_exists('is_tag') && is_tag()) {
        single_tag_title(__('Tag Archive for') . '&quot;');
        $output .= '&quot; - ';
    } elseif (is_archive()) {
        wp_title('');
        echo __('Archive') . ' - ';
    } elseif (is_search()) {
        echo __('Search for') . '&quot;' . esc_html($s) . '&quot; - ';
    } elseif (!is_404() && is_single() || is_page()) {
        wp_title('');
        echo ' - ';
    } elseif (is_404()) {
        echo __('Not Found') . '-';
    }
    if (is_home()) {
        bloginfo('name');
        echo ' - ';
        bloginfo('description');
    } else {
        bloginfo('name');
    }
    if ($paged > 1) {
        echo ' - ' . __('page') . ' ' . $paged;
    }
    echo '</title>';
}
Пример #23
0
function family_banner()
{
    ?>
	<div class="banner">
		<div class="wrap">
			<?php 
    if (is_front_page()) {
        family_get_header_image();
    } elseif (!is_front_page() && get_theme_mod('family_header_home')) {
        echo '';
    } else {
        // get title
        $id = get_option('page_for_posts');
        if ('posts' == get_option('show_on_front') && (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post') || is_home())) {
            family_get_header_image();
        } elseif (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            } else {
                family_get_header_image();
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        } else {
            family_get_header_image();
        }
    }
    ?>
		</div><!-- .wrap -->
  	</div><!-- .banner -->
<?php 
}
Пример #24
0
function mypace_custom_navi_menu($classes, $item)
{
    global $wp_query;
    $singular_slug = 'service';
    $page_for_custom_type_title = 'サービス';
    $page_for_posts = get_option('page_for_posts');
    $post_type_query = $wp_query->query_vars['post_type'];
    $del_flag = true;
    $add_flag = false;
    if (is_singular('post') || is_category() || is_tag()) {
        $del_flag = false;
    } elseif (is_author() || is_date() || is_author()) {
        if (in_array($post_type_query, array('', 'post'))) {
            $del_flag = false;
        } elseif ($post_type_query == $custom_post_type) {
            $add_flag = true;
        }
    } elseif (is_tax()) {
        $taxonomy = get_taxonomy($wp_query->query_vars['taxonomy']);
        if (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == 'post') {
            $del_flag = false;
        } elseif (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == $singular_slug) {
            $add_flag = true;
        }
    } elseif (is_singular($singular_slug)) {
        $add_flag = true;
    }
    if ($del_flag && is_numeric($page_for_posts) && $item->object_id == $page_for_posts && $item->object == 'page' && ($key = array_search('current_page_parent', $classes))) {
        unset($classes[$key]);
    } elseif ($add_flag && $item->title == $page_for_custom_type_title && $item->object == 'page') {
        $classes[] = 'current_page_parent';
    }
    return $classes;
}
Пример #25
0
 /**
  * s2Member's Security Gate (protects WordPress content).
  *
  * @package s2Member\Security
  * @since 3.5
  *
  * @attaches-to ``add_action("wp");``
  *
  * @return null May redirect a browser *(exiting script execution)*, when/if content is NOT available to the current User/Member.
  */
 public static function security_gate()
 {
     do_action("ws_plugin__s2member_before_security_gate", get_defined_vars());
     if (is_category()) {
         // Categories & other inclusives.
         c_ws_plugin__s2member_catgs::check_catg_level_access();
     } else {
         if (is_tag()) {
             // Post/Page Tags & other inclusives.
             c_ws_plugin__s2member_ptags::check_ptag_level_access();
         } else {
             if (is_single()) {
                 // All Posts & other inclusives.
                 c_ws_plugin__s2member_posts::check_post_level_access();
             } else {
                 if (is_page()) {
                     // All Pages & other inclusives.
                     c_ws_plugin__s2member_pages::check_page_level_access();
                 } else {
                     // Else, we simply look at URIs & other inclusives.
                     c_ws_plugin__s2member_ruris::check_ruri_level_access();
                 }
             }
         }
     }
     do_action("ws_plugin__s2member_after_security_gate", get_defined_vars());
     return;
 }
Пример #26
0
 public function tags()
 {
     if (!did_action('pre_get_posts')) {
         return array();
     }
     $queried_object = get_queried_object();
     $tags = array();
     $default_tags = array('og:type' => 'website', 'og:locale' => get_locale(), 'og:site_name' => get_bloginfo('name'), 'og:image' => $this->get_image_url());
     if (is_front_page()) {
         $tags = array('og:url' => home_url('/'), 'og:title' => get_bloginfo('name'), 'og:description' => get_bloginfo('description'));
     } else {
         if (is_singular()) {
             $tags = array('og:type' => 'article', 'og:url' => get_permalink($queried_object), 'og:title' => get_the_title($queried_object), 'og:description' => $this->generate_preview($queried_object->post_content), 'article:published_time' => date('c', strtotime($queried_object->post_date_gmt)), 'article:modified_time' => date('c', strtotime($queried_object->post_modified_gmt)), 'article:author' => get_author_posts_url($queried_object->post_author));
         } else {
             if (is_tax() || is_category() || is_tag()) {
                 $tags = array('og:url' => get_term_link($queried_object), 'og:title' => $queried_object->name, 'og:description' => $this->generate_preview($queried_object->description));
             } else {
                 if (is_author()) {
                     $tags = array('og:type' => 'profile', 'og:url' => get_author_posts_url($queried_object->ID), 'og:title' => $queried_object->display_name, 'og:description' => $this->generate_preview($queried_object->user_description), 'profile:first_name' => get_the_author_meta('first_name', $queried_object->ID), 'profile:last_name' => get_the_author_meta('last_name', $queried_object->ID));
                 }
             }
         }
     }
     $tags = array_merge($default_tags, $tags);
     return apply_filters('appthemes_open_graph_meta_tags', $tags);
 }
Пример #27
0
/**
 * Modifies the page title text on archive pages
 * This can be done on the Options page as of v2.5.1
 *
 * @param $text
 *
 * @return string
 */
function wpd_filter_archive_page_title($text)
{
    if (is_tag()) {
        $text = 'We are on a Tag Archive page';
    }
    return $text;
}
Пример #28
0
 public function check_language_code_in_url()
 {
     global $wp_query, $post;
     if (is_single() || is_page()) {
         if (isset($post->ID) && $this->model->is_translated_post_type($post->post_type)) {
             $language = $this->model->get_post_language((int) $post->ID);
         }
     } elseif (is_category() || is_tag() || is_tax()) {
         $obj = $wp_query->get_queried_object();
         if ($this->model->is_translated_taxonomy($obj->taxonomy)) {
             $language = $this->model->get_term_language((int) $obj->term_id);
         }
     } elseif ($wp_query->is_posts_page) {
         $obj = $wp_query->get_queried_object();
         $language = $this->model->get_post_language((int) $obj->ID);
     }
     // the language is not correctly set so let's redirect to the correct url for this object
     if (!empty($language)) {
         $requested_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         $redirect_url = $this->links_model->switch_language_in_link($requested_url, $language);
         if ($requested_url != $redirect_url) {
             wp_redirect($redirect_url, 301);
             exit;
         }
     }
 }
Пример #29
0
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);
}
Пример #30
0
 function type()
 {
     global $pl_404;
     if (is_404() && $pl_404) {
         $type = '404_page';
     } elseif (is_post_type_archive()) {
         $type = pl_get_post_type_plural();
     } elseif (is_tag()) {
         $type = 'tag';
     } elseif (is_search()) {
         $type = 'search';
     } elseif (is_category()) {
         $type = 'category';
     } elseif (is_author()) {
         $type = 'author';
     } elseif (is_archive()) {
         $type = 'archive';
     } elseif (is_home()) {
         $type = 'blog';
     } elseif (pl_is_cpt()) {
         $type = get_post_type();
     } elseif (is_page()) {
         $type = 'page';
     } elseif (is_single()) {
         $type = 'post';
     } else {
         $type = 'other';
     }
     return $type;
 }