/** * Manages product conditional functions * * Here all plugin conditional functions are defined and managed. * * @version 1.0.0 * @package ecommerce-product-catalog/functions * @author Norbert Dreszer */ function is_ic_catalog_page() { if (is_ic_product_page() || is_ic_product_listing() || is_ic_taxonomy_page() || is_ic_product_search()) { return true; } return false; }
/** * Replaces auto products listing, product category pages and product search title with appropriate entries * * @param string $page_title * @param int $id * @return string */ function override_product_page_title($page_title, $id = null) { if (!is_admin() && is_ic_catalog_page() && !is_ic_product_page() && !in_the_loop() && !is_ic_shortcode_query() && (empty($id) || get_quasi_post_type(get_post_type($id)) == 'al_product')) { $archive_names = get_archive_names(); if (is_ic_taxonomy_page()) { $the_tax = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $page_title = $archive_names['all_prefix'] . ' ' . $the_tax->name; } else { if (is_ic_product_search()) { $page_title = __('Search Results for:', 'ecommerce-product-catalog') . ' ' . $_GET['s']; } else { if (is_ic_product_listing()) { $page_title = get_product_listing_title(); } } } } return $page_title; }
/** * Shows product listing title tag */ function add_product_listing_name() { if (is_ic_taxonomy_page()) { $archive_names = get_archive_names(); //$the_tax = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $the_tax = get_queried_object(); if (!empty($archive_names['all_prefix'])) { $title = $archive_names['all_prefix'] . ' ' . $the_tax->name; } else { $title = $the_tax->name; } } else { if (is_ic_product_search()) { $title = __('Search Results for:', 'ecommerce-product-catalog') . ' ' . $_GET['s']; } else { if (is_ic_product_listing()) { $title = get_product_listing_title(); } else { $title = get_the_title(); } } } echo '<h1 class="entry-title product-listing-name">' . $title . '</h1>'; }