本文整理匯總了PHP中is_shop函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_shop函數的具體用法?PHP is_shop怎麽用?PHP is_shop使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_shop函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: xt_get_page_ID
function xt_get_page_ID()
{
global $wp_query, $post;
$page_id = false;
if (is_home() && get_option('page_for_posts')) {
$page_id = get_option('page_for_posts');
} elseif (is_front_page() && get_option('page_on_front')) {
$page_id = get_option('page_on_front');
} else {
if (function_exists('is_shop') && is_shop() && get_option('woocommerce_shop_page_id') != '') {
$page_id = get_option('woocommerce_shop_page_id');
} else {
if (function_exists('is_cart') && is_cart() && get_option('woocommerce_cart_page_id') != '') {
$page_id = get_option('woocommerce_cart_page_id');
} else {
if (function_exists('is_checkout') && is_checkout() && get_option('woocommerce_checkout_page_id') != '') {
$page_id = get_option('woocommerce_checkout_page_id');
} else {
if (function_exists('is_account_page') && is_account_page() && get_option('woocommerce_myaccount_page_id') != '') {
$page_id = get_option('woocommerce_myaccount_page_id');
} else {
if ($wp_query && !empty($wp_query->queried_object) && !empty($wp_query->queried_object->ID)) {
$page_id = $wp_query->queried_object->ID;
} else {
if (!empty($post->ID)) {
$page_id = $post->ID;
}
}
}
}
}
}
}
return $page_id;
}
示例2: global_get_post_id
function global_get_post_id() {
if (function_exists('is_woocommerce') && is_woocommerce() && is_shop()) {
return wc_get_page_id('shop');
}
else if (is_singular()) {
global $post;
return $post->ID;
}
else if (is_home()) {
$page_on_front = get_option('page_on_front');
$show_on_front = get_option('show_on_front');
if ($page_on_front == 'page' && !empty($page_on_front)) {
global $post;
return $post->ID;
}
else {
return false;
}
}
else {
return false;
}
}
示例3: woa_remove_sidebar_shop_page
function woa_remove_sidebar_shop_page()
{
if (is_shop() || is_tax('product_cat') || get_post_type() == 'product') {
remove_action('storefront_sidebar', 'storefront_get_sidebar', 10);
add_filter('body_class', 'woa_remove_sidebar_class_body', 10);
}
}
示例4: vantage_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @since vantage 1.0
*/
function vantage_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author
if (is_multi_author()) {
$classes[] = 'group-blog';
}
if (siteorigin_setting('layout_responsive')) {
$classes[] = 'responsive';
}
$classes[] = 'layout-' . siteorigin_setting('layout_bound');
$classes[] = 'no-js';
$is_full_width_template = is_page_template('templates/template-full.php') || is_page_template('templates/template-full-notitle.php');
if (!$is_full_width_template) {
$wc_shop_sidebar = vantage_is_woocommerce_active() && is_shop() && is_active_sidebar('shop');
if (!is_active_sidebar('sidebar-1') && !$wc_shop_sidebar) {
$classes[] = 'no-sidebar';
} else {
$classes[] = 'has-sidebar';
}
}
if (wp_is_mobile()) {
$classes[] = 'so-vantage-mobile-device';
}
$mega_menu_active = function_exists('max_mega_menu_is_enabled') && max_mega_menu_is_enabled('primary');
if (siteorigin_setting('navigation_menu_search') && !$mega_menu_active) {
$classes[] = 'has-menu-search';
}
if (siteorigin_setting('layout_force_panels_full')) {
$classes[] = 'panels-style-force-full';
}
return $classes;
}
示例5: jbst_layout
function jbst_layout()
{
global $jbst_layout;
global $jbstecommerce;
global $post;
if ($jbst_layout) {
return;
}
/* get the page layout */
$jbst_layout = jbst_default_page_layout;
if (is_singular(array('page', 'post'))) {
if (!($jbst_layout = get_post_meta($post->ID, '_cmb_page_layout', true))) {
$jbst_layout = of_get_option('default_page_layout', jbst_default_page_layout);
}
} else {
if (is_page() || is_home()) {
$jbst_layout = of_get_option('default_page_layout', jbst_default_page_layout);
} elseif (is_search()) {
$jbst_layout = of_get_option('default_search_layout', jbst_default_page_layout);
} elseif (is_archive()) {
$jbst_layout = of_get_option('default_archive_layout', jbst_default_page_layout);
} else {
$jbst_layout = of_get_option('default_blog_layout', jbst_default_page_layout);
}
if ($jbstecommerce == true) {
if (is_shop()) {
$jbst_layout = of_get_option('default_shop_layout', jbst_default_page_layout);
}
if (is_product()) {
$jbst_layout = of_get_option('default_product_layout', jbst_default_page_layout);
}
}
}
}
示例6: page_id
/**
* get the current page ID.
*
* @return int the current page ID.
*/
public function page_id()
{
global $post;
if (isset($post)) {
/**
* Get the current post ID
*/
$id = $post->ID;
/**
* If we're on the posts page, get the ID of the page
* using the 'page_for_posts' option.
*/
if (is_home()) {
$id = get_option('page_for_posts');
} else {
/**
* I we're on the WooCommerce shop page, get the ID of the page
* using the 'woocommerce_shop_page_id' option
*/
if (function_exists('is_shop') && is_shop()) {
$id = get_option('woocommerce_shop_page_id');
} else {
/**
* If this is a singular page/post then set ID to the page ID.
* If not, then set it to false.
*/
$id = is_singular() ? $post->ID : false;
}
}
} else {
$id = false;
}
return $id;
}
示例7: dt_woocommerce_configure_template
/**
* Init theme config for shop.
*
* @param string $name
*/
function dt_woocommerce_configure_template($name = '')
{
dt_woocommerce_configure_mini_cart();
// Add template configuration actions.
$config = presscore_config();
$mod_wc_config = dt_woocommerce_template_config($config);
add_action('dt_wc_loop_start', array($mod_wc_config, 'setup'));
add_action('dt_wc_loop_end', array($mod_wc_config, 'cleanup'));
// Stop if not on woocommerce page.
if ('shop' !== $name) {
return;
}
// From what page get settings?
$post_id = null;
if (is_shop()) {
$post_id = woocommerce_get_page_id('shop');
} else {
if (is_cart()) {
$post_id = woocommerce_get_page_id('cart');
} else {
if (is_checkout()) {
$post_id = woocommerce_get_page_id('checkout');
}
}
}
if ($post_id) {
$config->set('post_id', $post_id);
}
if (!is_product()) {
add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20);
}
// Replace theme breadcrumbs.
add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2);
}
示例8: dt_woocommerce_init_template_config
/**
* Init theme config for shop.
*
*/
function dt_woocommerce_init_template_config($name = '')
{
dt_woocommerce_add_config_actions();
if ('shop' != $name) {
return;
}
$config = presscore_get_config();
$post_id = null;
if (is_shop()) {
$post_id = woocommerce_get_page_id('shop');
} else {
if (is_cart()) {
$post_id = woocommerce_get_page_id('cart');
} else {
if (is_checkout()) {
$post_id = woocommerce_get_page_id('checkout');
}
}
}
presscore_config_base_init($post_id);
if (is_product_category() || is_product_tag()) {
$post_id = woocommerce_get_page_id('shop');
if ($post_id) {
$config->set('post_id', $post_id);
presscore_config_populate_sidebar_and_footer_options();
$config->set('post_id', null);
}
}
if (!is_product()) {
add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20);
}
// replace theme breadcrumbs
add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2);
}
示例9: woothemes_add_javascript
function woothemes_add_javascript()
{
global $woo_options;
wp_register_script('prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array('jquery'));
wp_register_script('enable-lightbox', get_template_directory_uri() . '/includes/js/enable-lightbox.js', array('jquery', 'prettyPhoto'));
wp_register_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
wp_register_script('google-maps-markers', get_template_directory_uri() . '/includes/js/markers.js');
wp_register_script('flexslider', get_template_directory_uri() . '/includes/js/jquery.flexslider-min.js', array('jquery'));
wp_register_script('featured-slider', get_template_directory_uri() . '/includes/js/featured-slider.js', array('jquery', 'flexslider'));
wp_register_script('infinite-scroll', get_template_directory_uri() . '/includes/js/jquery.infinitescroll.min.js', array('jquery'));
wp_register_script('masonry', get_template_directory_uri() . '/includes/js/jquery.masonry.min.js', array('jquery'));
wp_enqueue_script('third party', get_template_directory_uri() . '/includes/js/third-party.js', array('jquery'));
wp_enqueue_script('tiptip', get_template_directory_uri() . '/includes/js/jquery.tiptip.min.js', array('jquery'));
wp_enqueue_script('general', get_template_directory_uri() . '/includes/js/general.js', array('jquery'));
// Load Google Script on Contact Form Page Template
if (is_page_template('template-contact.php')) {
wp_enqueue_script('google-maps');
wp_enqueue_script('google-maps-markers');
}
// End If Statement
// Load infinite scroll on shop page / product cats
if (is_woocommerce_activated()) {
if ($woo_options['woocommerce_archives_infinite_scroll'] == 'true' && (is_shop() || is_product_category())) {
wp_enqueue_script('infinite-scroll');
}
}
// Load Masonry on the blog grid layout
if (is_page_template('template-blog-grid.php')) {
wp_enqueue_script('masonry');
add_action('wp_head', 'woo_fire_masonry');
}
do_action('woothemes_add_javascript');
}
示例10: wc_custom_shop_archive_title
/**
* Change the Shop archive page title.
* @param string $title
* @return string
*/
function wc_custom_shop_archive_title($title)
{
if (is_shop()) {
return str_replace(__('Products', 'woocommerce'), 'Artwork', $title);
}
return $title;
}
示例11: ts_get_opt
/**
* Get theme option value
* @param string $option
* @return mix|boolean
*/
function ts_get_opt($option)
{
global $ts_theme_options;
$local = false;
//get local from main shop page
if (class_exists('WooCommerce') && (is_shop() || is_product_category() || is_product_tag())) {
$shop_page = woocommerce_get_page_id('shop');
if (!empty($shop_page)) {
$value = ts_get_post_opt($option . '-local', (int) $shop_page);
$local = true;
}
//get local from metaboxes for the post value and override if not empty
} else {
if (is_singular()) {
$value = ts_get_post_opt($option . '-local');
$local = true;
}
}
//return local value if exists
if ($local === true) {
//if $value is an array we need to check if first element is not empty before we return $value
$first_element = null;
if (is_array($value)) {
$first_element = reset($value);
}
if (is_string($value) && (strlen($value) > 0 || !empty($value)) || is_array($value) && !empty($first_element)) {
return $value;
}
}
if (isset($ts_theme_options[$option])) {
return $ts_theme_options[$option];
}
return false;
}
示例12: wcva_register_shop_scripts
public function wcva_register_shop_scripts()
{
if (is_shop() || is_product_category() || is_product_tag()) {
wp_enqueue_script('wcva-shop-frontend', '' . wcva_PLUGIN_URL . 'js/shop-frontend.js', array('jquery'));
wp_enqueue_style('wcva-shop-frontend', '' . wcva_PLUGIN_URL . 'css/shop-frontend.css');
}
}
示例13: tesseract_woocommerce_wrapper_start
function tesseract_woocommerce_wrapper_start()
{
$layout_loop = get_theme_mod('tesseract_woocommerce_loop_layout');
$layout_product = get_theme_mod('tesseract_woocommerce_product_layout');
if (is_shop() || is_product_category() || is_product_tag()) {
if ($layout_loop == 'sidebar-left' || $layout_loop == 'sidebar-right') {
$primclass = 'with-sidebar';
$primclass .= $layout_loop == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
} else {
if ($layout_loop == 'fullwidth' || !$layout_loop) {
$primclass = 'no-sidebar';
}
}
} else {
if (is_product()) {
if ($layout_product == 'sidebar-left' || $layout_product == 'sidebar-right') {
$primclass = 'with-sidebar';
$primclass .= $layout_product == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
} else {
if ($layout_product == 'fullwidth' || !$layout_product) {
$primclass = 'no-sidebar';
}
}
} else {
$primclass = 'sidebar-default';
}
}
echo '<div id="primary" class="content-area ' . $primclass . '">';
}
示例14: siw_remove_unnecessary_scripts
function siw_remove_unnecessary_scripts()
{
//variatie als radiobuttons
if (!is_product()) {
wp_dequeue_script('kt-wc-add-to-cart-variation-radio');
}
//woocommerce ajax filter
if (!is_shop() && !is_product_category() && !is_product_tag()) {
wp_dequeue_script('yith-wcan-script');
wp_dequeue_style('yith-wcan-frontend');
}
//woocommerce
wp_dequeue_script('woocommerce');
//wp-embed
wp_deregister_script('wp-embed');
//search&filter
wp_dequeue_style('search-filter-chosen-styles');
wp_dequeue_style('search-filter-plugin-styles');
wp_deregister_script('search-filter-chosen-script');
wp_deregister_script('jquery-ui-datepicker');
wp_deregister_script('search-filter-plugin-build');
wp_register_script('search-filter-plugin-build', plugins_url('search-filter-pro/public/assets/js/search-filter-build.min.js'), array('jquery'), '', TRUE);
//kadence slider wordt alleen gebruikt op de homepage.
if (!is_front_page()) {
wp_dequeue_script('kadence_slider_js');
wp_dequeue_style('kadence_slider_css');
}
//ncf font
wp_dequeue_style('ncf_lato_font');
//styling van mailpoet widget
wp_deregister_style('validate-engine-css');
}
示例15: flatsome_admin_bar_helper
function flatsome_admin_bar_helper()
{
global $wp_admin_bar;
$optionUrl = get_admin_url() . 'themes.php?page=optionsframework';
$adminUrl = get_admin_url();
if (is_category() || is_home()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Blog Layout', 'href' => $optionUrl . '&tab=of-option-blog'));
}
if (ux_is_woocommerce_active()) {
if (is_checkout() || is_cart()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Checkout Settings', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=checkout'));
}
if (is_product()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Product Page Layout', 'href' => $optionUrl . '&tab=of-option-productpage'));
}
if (is_account_page()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'My Account Page', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=account'));
}
if (is_shop() || is_product_category()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Shop Settings'));
$wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_flatsome', 'title' => 'Category Page Layout', 'href' => $optionUrl . '&tab=of-option-categorypage'));
$wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_woocommerce', 'title' => 'Shop Page Display', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=products§ion=display'));
}
}
}