function layers_get_page_title() { global $post; // Setup return $title_array = array(); if (!empty($parentpage) && !is_search()) { $parentpage = get_template_link(get_post_type() . ".php"); $title_array['title'] = $parentpage->post_title; if ($parentpage->post_excerpt != '') { $title_array['excerpt'] = $parentpage->post_excerpt; } } elseif (is_page()) { while (have_posts()) { the_post(); $title_array['title'] = get_the_title(); if ($post->post_excerpt != "") { $title_array['excerpt'] = strip_tags(get_the_excerpt()); } } } elseif (is_search()) { $title_array['title'] = __('Search', 'layerswp'); $title_array['excerpt'] = get_search_query(); } elseif (is_tag()) { $title_array['title'] = single_tag_title('', false); $title_array['excerpt'] = get_the_archive_description(); } elseif (!is_page() && is_category()) { $title_array['title'] = single_cat_title('', false); $title_array['excerpt'] = get_the_archive_description(); } elseif (!is_page() && get_query_var('term') != '') { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $title_array['title'] = $term->name; $title_array['excerpt'] = $term->description; } elseif (is_author()) { $title_array['title'] = get_the_author(); $title_array['excerpt'] = get_the_author_meta('user_description'); } elseif (is_day()) { $title_array['title'] = sprintf(__('Daily Archives: %s', 'layerswp'), get_the_date()); } elseif (is_month()) { $title_array['title'] = sprintf(__('Monthly Archives: %s', 'layerswp'), get_the_date(_x('F Y', 'monthly archives date format', 'layerswp'))); } elseif (is_year()) { $title_array['title'] = sprintf(__('Yearly Archives: %s', 'layerswp'), get_the_date(_x('Y', 'yearly archives date format', 'layerswp'))); } elseif (function_exists('is_shop') && (is_post_type_archive('product') || get_post_type() == "product")) { if (function_exists('woocommerce_get_page_id') && -1 != woocommerce_get_page_id('shop')) { $shop_page = get_post(woocommerce_get_page_id('shop')); if (is_object($shop_page)) { $title_array['title'] = $shop_page->post_title; } } else { $title_array['title'] = __('Shop', 'layerswp'); } } elseif (is_single()) { $title_array['title'] = get_the_title(); } else { $title_array['title'] = __('Archives', 'layerswp'); } return apply_filters('layers_get_page_title', $title_array); }
<?php get_header(); global $post; $terms = get_the_terms($post->ID, 'portfolio-category'); if (is_array($terms)) { $first_term = array_shift($terms); } $parentpage = get_template_link("portfolio.php"); $cat_list = get_terms("portfolio-category", "orderby=count&hide_empty=0"); ?> <h2 class="section-title"> <a href="<?php echo get_permalink($parentpage->ID); ?> "><?php echo $parentpage->post_title; ?> </a> <?php if (is_array($terms) && $first_term->name != '') { ?> / <a href="<?php echo bloginfo('url') . '/' . $first_term->taxonomy . '/' . $first_term->slug . '/'; ?> "><?php echo $first_term->name; ?>