本文整理汇总了PHP中woocommerce_get_page_id函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_get_page_id函数的具体用法?PHP woocommerce_get_page_id怎么用?PHP woocommerce_get_page_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_get_page_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: add_edit_address_subscription_action
/**
* Add a "Change Shipping Address" button to the "My Subscriptions" table for those subscriptions
* which require shipping.
*
* @param array $all_actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table
* @param array $subscriptions All of a given users subscriptions that will be displayed on the "My Subscriptions" table
* @since 1.3
*/
public static function add_edit_address_subscription_action($all_actions, $subscriptions)
{
foreach ($all_actions as $subscription_key => $actions) {
$order = new WC_Order($subscriptions[$subscription_key]['order_id']);
$needs_shipping = false;
foreach ($order->get_items() as $item) {
if ($item['product_id'] !== $subscriptions[$subscription_key]['product_id']) {
continue;
}
$product = $order->get_product_from_item($item);
if (!is_object($product)) {
// In case a product has been deleted
continue;
}
if ($product->needs_shipping()) {
$needs_shipping = true;
}
}
if ($needs_shipping && in_array($subscriptions[$subscription_key]['status'], array('active', 'on-hold'))) {
// WC 2.1+
if (function_exists('wc_get_endpoint_url')) {
$all_actions[$subscription_key] = array('change_address' => array('url' => add_query_arg(array('subscription' => $subscription_key), wc_get_endpoint_url('edit-address', 'shipping')), 'name' => __('Change Address', 'woocommerce-subscriptions'))) + $all_actions[$subscription_key];
} else {
$all_actions[$subscription_key] = array('change_address' => array('url' => add_query_arg(array('address' => 'shipping', 'subscription' => $subscription_key), get_permalink(woocommerce_get_page_id('edit_address'))), 'name' => __('Change Address', 'woocommerce-subscriptions'))) + $all_actions[$subscription_key];
}
}
}
return $all_actions;
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:37,代码来源:class-wc-subscriptions-addresses.php
示例2: init
/**
* Prevent caching on dynamic pages.
*
* @access public
* @return void
*/
public function init()
{
if (false === ($wc_page_uris = get_transient('woocommerce_cache_excluded_uris'))) {
if (woocommerce_get_page_id('cart') < 1 || woocommerce_get_page_id('checkout') < 1 || woocommerce_get_page_id('myaccount') < 1) {
return;
}
$wc_page_uris = array();
$cart_page = get_post(woocommerce_get_page_id('cart'));
$checkout_page = get_post(woocommerce_get_page_id('checkout'));
$account_page = get_post(woocommerce_get_page_id('myaccount'));
$wc_page_uris[] = '/' . $cart_page->post_name;
$wc_page_uris[] = '/' . $checkout_page->post_name;
$wc_page_uris[] = '/' . $account_page->post_name;
$wc_page_uris[] = 'p=' . $cart_page->ID;
$wc_page_uris[] = 'p=' . $checkout_page->ID;
$wc_page_uris[] = 'p=' . $account_page->ID;
set_transient('woocommerce_cache_excluded_uris', $wc_page_uris);
}
if (is_array($wc_page_uris)) {
foreach ($wc_page_uris as $uri) {
if (strstr($_SERVER['REQUEST_URI'], $uri)) {
$this->nocache();
break;
}
}
}
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:33,代码来源:class-wc-cache-helper.php
示例3: widget
function widget($args, $instance)
{
$me = wp_get_current_user();
if ($me->ID == 0) {
return;
}
$funds = get_user_meta($me->ID, 'account_funds', true);
if (empty($funds)) {
$funds = 0;
}
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
?>
<p><?php
printf(__('You currently have <b>%s</b> in your account', 'wc_account_funds'), woocommerce_price($funds));
?>
</p>
<p style="text-align:center;"><a class="button" href="<?php
echo get_permalink(woocommerce_get_page_id('myaccount'));
?>
"><?php
_e('Deposit Funds', 'wc_account_funds');
?>
</a></p>
<?php
echo $after_widget;
}
开发者ID:bulbulbigboss,项目名称:bigboss-woocommerce-deposit-funds,代码行数:31,代码来源:widget.php
示例4: sk_wcmenucart
function sk_wcmenucart($menu, $args)
{
// Проверяем, установлен ли и активирован плагин WooCommerce и добавляем новый элемент в меню, назначенному основным меню навигации
if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || 'mainmenu' !== $args->theme_location) {
return $menu;
}
ob_start();
global $woocommerce;
$viewing_cart = __('View your shopping cart', 'your-theme-slug');
$start_shopping = __('Start shopping', 'your-theme-slug');
$cart_url = $woocommerce->cart->get_cart_url();
$shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
$cart_contents_count = $woocommerce->cart->cart_contents_count;
$cart_contents = sprintf(_n('%d item', '%d items', $cart_contents_count, 'your-theme-slug'), $cart_contents_count);
$cart_total = $woocommerce->cart->get_cart_total();
// Раскомментируйте строку ниже для того, чтобы скрыть иконку корзины в меню, когда нет добавленных товаров в корзине.
if ($cart_contents_count > 0) {
if ($cart_contents_count == 0) {
$menu_item = '<li class="right"><a class="wcmenucart-contents" href="' . $shop_page_url . '" title="' . $start_shopping . '">';
} else {
$menu_item = '<li class="right"><a class="wcmenucart-contents" href="' . $cart_url . '" title="' . $viewing_cart . '">';
}
$menu_item .= '<i class="fa fa-shopping-cart"></i> ';
$menu_item .= $cart_contents . ' - ' . $cart_total;
$menu_item .= '</a></li>';
// Раскомментируйте строку ниже для того, чтобы скрыть иконку корзины в меню, когда нет добавленных товаров в корзине.
}
echo $menu_item;
$social = ob_get_clean();
return $menu . $social;
}
开发者ID:agalardo,项目名称:mal-mala,代码行数:31,代码来源:functions.php
示例5: continue_shopping_button
function continue_shopping_button()
{
$shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
echo '<div class="">';
echo ' <a href="' . $shop_page_url . '" class="button">Continue Shopping →</a>';
echo '</div>';
}
开发者ID:jay7134,项目名称:wordpress-speedup-hooks,代码行数:7,代码来源:wooCommerce-continue-shopping-button.php
示例6: include_woocommerce_template
function include_woocommerce_template($tmpl)
{
global $gantry;
$find = array('woocommerce.php');
$file = '';
if (is_single() && get_post_type() == 'product') {
$file = 'single-product.php';
$find[] = $file;
} elseif (is_tax('product_cat') || is_tax('product_tag')) {
$term = get_queried_object();
$file = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
$find[] = 'taxonomy-' . $term->taxonomy . '.php';
$find[] = $file;
} elseif (is_post_type_archive('product') || is_page(woocommerce_get_page_id('shop'))) {
$file = 'archive-product.php';
$find[] = $file;
}
$find = array_reverse($find);
$template = GantryBodyLayout::locate_type($find);
if ($template && $template != '') {
return $template;
} else {
woocommerce_content();
return '';
}
return $tmpl;
}
开发者ID:rotoballer,项目名称:emily,代码行数:27,代码来源:woocommerce.php
示例7: __construct
/**
* Constructor
*/
public function __construct()
{
global $woocommerce;
$this->method_title = 'Amazon Payments Advanced';
$this->id = 'amazon_payments_advanced';
$this->has_fields = function_exists('is_checkout_pay_page') ? is_checkout_pay_page() : is_page(woocommerce_get_page_id('pay'));
$this->icon = apply_filters('woocommerce_amazon_pa_logo', plugins_url(basename(dirname(dirname(__FILE__))) . '/assets/images/amazon-payments.gif'));
// Load the form fields.
$this->init_form_fields();
// Load the settings.
$this->init_settings();
// Define user set variables
$this->title = $this->settings['title'];
$this->seller_id = $this->settings['seller_id'];
$this->mws_access_key = $this->settings['mws_access_key'];
$this->secret_key = $this->settings['secret_key'];
$this->sandbox = $this->settings['sandbox'] == 'yes' ? true : false;
$this->payment_capture = isset($this->settings['payment_capture']) ? $this->settings['payment_capture'] : '';
// Get endpoint
$location = in_array($woocommerce->countries->get_base_country(), array('US', 'GB', 'DE')) ? $woocommerce->countries->get_base_country() : 'US';
$this->endpoint = $this->sandbox ? $this->endpoints['sandbox'][$location] : $this->endpoints['production'][$location];
// Get refererence ID
$this->reference_id = !empty($_REQUEST['amazon_reference_id']) ? $_REQUEST['amazon_reference_id'] : '';
if (isset($_POST['post_data'])) {
parse_str($_POST['post_data'], $post_data);
if (isset($post_data['amazon_reference_id'])) {
$this->reference_id = $post_data['amazon_reference_id'];
}
}
add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
}
开发者ID:sergioblanco86,项目名称:git-gitlab.com-kinivo-kinivo.com,代码行数:34,代码来源:class-wc-gateway-amazon-payments-advanced.php
示例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);
}
开发者ID:noman90rauf,项目名称:wp-content,代码行数:38,代码来源:mod-wc-template-config.php
示例9: custom_add_to_cart_message
function custom_add_to_cart_message()
{
global $woocommerce;
$return_to = get_permalink(woocommerce_get_page_id('shop'));
$message = sprintf('<a href="%s" class="button wc-forward">%s</a> %s', $return_to, __('Continue Shopping', 'woocommerce'), __('<p>Product successfully added to your cart.</p>', 'woocommerce'));
return $message;
}
开发者ID:pixelstorm,项目名称:woocommerce,代码行数:7,代码来源:custom-add-to-cart-message.php
示例10: wpex_wcmenucart_menu_item
function wpex_wcmenucart_menu_item()
{
// Vars
global $woocommerce;
// URL
if ('custom-link' == get_theme_mod('woo_menu_icon_style', 'drop-down') && ($custom_link = get_theme_mod('woo_menu_icon_custom_link'))) {
$url = esc_url($custom_link);
} else {
$url = get_permalink(woocommerce_get_page_id('shop'));
}
// Cart total
if (get_theme_mod('woo_menu_icon_amount')) {
$cart_total = $woocommerce->cart->get_cart_total();
} else {
$cart_total = '';
}
ob_start();
?>
<a href="<?php
echo $url;
?>
" class="wcmenucart" title="<?php
_e('Your Cart', 'wpex');
?>
">
<span class="wcmenucart-count"><span class="fa fa-shopping-cart"></span><?php
echo $cart_total;
?>
</span>
</a>
<?php
return ob_get_clean();
}
开发者ID:sergey-h,项目名称:naman,代码行数:33,代码来源:woo-menucart.php
示例11: loginForm
function loginForm()
{
do_action('loginx_before_login_form');
if (parent::useWoo() && !$_GET['password'] && !$_POST['reset'] && !$_GET['reset'] && !$_GET['resend'] && !$_GET['act']) {
print '<script>window.location.href = "' . get_permalink(woocommerce_get_page_id('myaccount')) . '";</script>';
exit;
}
require_once PHPX_DIR . '/phpx_form.php';
$form = new phpx_form();
if (parent::loginx_successMessage()) {
$text = '<div class="loginx_success">' . parent::loginx_successMessage('get') . '</div>';
} else {
if ($_GET['password'] || $_POST['reset']) {
$form->startForm(parent::loginx_getURL() . '?password=1');
if (parent::loginx_errorMessage()) {
$form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
}
$form->freeText($this->options['password_text']);
$form->textField('Email/Username', 'email', '', true);
$form->hidden('nonce', wp_create_nonce('loginx'));
$text = '<div id="loginx_password">' . $form->endForm() . '</div>';
} else {
if ($_GET['reset']) {
$user_id = $this->wpdb->get_var($this->wpdb->prepare('select user_id from ' . $this->wpdb->prefix . 'loginx_key where loginx_key = %s and loginx_expire > %d limit 1', $_GET['reset'], time()));
if (!$user_id) {
$text = '<div class="loginx_error">' . $this->options['bad_key'] . '</div>';
} else {
$form->startForm(parent::loginx_getURL());
if (parent::loginx_errorMessage()) {
$form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
}
$form->freeText($this->options['password_reset_text']);
$form->password('Password', 'pass', true, 6);
$form->password('Confirm Password', 'pass_confirm', true, 6, true);
$form->hidden('nonce', wp_create_nonce('loginx'));
$form->hidden('reset', $_GET['reset']);
$text = '<div id="loginx_password">' . $form->endForm() . '</div>';
}
} else {
$form->startForm($this->loginx_getURL());
if (parent::loginx_errorMessage()) {
$form->freeText(parent::loginx_errorMessage('get'), 'loginx_error');
}
$form->textField('Username', 'username', '', true);
$form->password('Password', 'password', true, 4);
//$form->checkBox('Remember Me?', 'remember', 0);
$form->hidden('remember', 'forever');
$form->hidden('nonce', wp_create_nonce('loginx'));
$form->freeText('<div id="loginx_password_link"><a href="' . get_permalink() . '?password=1">Forgot Login/Password?</a></div>');
$form->freeText('<div id="loginx_register_link"><a href="' . get_permalink($this->options['register_page']) . '">Register</a></div>');
if (function_exists('rpx_init')) {
$form->freeText(do_shortcode('[rpxlogin]'));
}
$text = '<div id="loginx_form">' . $form->endForm() . '</div>';
}
}
}
do_action('loginx_after_login_form');
return $text;
}
开发者ID:laiello,项目名称:suitex,代码行数:60,代码来源:loginx_login_obj.php
示例12: showProfile
function showProfile()
{
global $current_user;
get_currentuserinfo();
$username = !isset($_GET['u']) || $_GET['u'] == '' ? $current_user->user_nicename : $_GET['u'];
$user = get_user_by('slug', $username);
$GLOBALS['avatar_user_id'] = $user->ID;
$trans['::AVATAR::'] = get_avatar($user->user_email, 92);
$trans['::DISPLAYNAME::'] = $user->display_name;
$trans['::REGDATE::'] = date(get_option('date_format'), strtotime($user->user_registered));
$trans['::INFO::'] = str_replace("\r\n", '<br />', $user->user_description);
if ($user->ID == $current_user->ID) {
$passwordLink = '<a href="' . get_permalink($this->options['profile_page']) . '?password=1">Change Password</a>';
if (parent::useWoo()) {
$passwordLink = '<a href="' . get_permalink(woocommerce_get_page_id('change_password')) . '">Change Password</a> | <a href="' . get_permalink(woocommerce_get_page_id('myaccount')) . '">My Account</a>';
}
$trans['::LINKS::'] = '<a href="' . get_permalink($this->options['profile_page']) . '?edit=1">Edit Profile</a> | ' . $passwordLink . $myAccountLink;
} else {
$trans['::LINKS::'] = '';
}
$trans['::POSTS::'] = $this->formatList('Latest Posts', $user, $this->getPosts($user->ID));
$trans['::COMMENTS::'] = $this->formatList('Latest Comments', $user, $this->getComments($user->ID), 'comment');
$trans['::PURCHASES::'] = $this->formatList('Latest Purchases', $user, $this->getPurchases($user->ID, 'woo'), 'purchase');
$this->text = strtr(file_get_contents(LOGINX_DIR . 'templates/showProfile.tpl.php'), $trans);
}
开发者ID:laiello,项目名称:suitex,代码行数:25,代码来源:loginx_profile_obj.php
示例13: _initHooks
/**
* Срабатывает на событие Init.
* метод приватный, публичный доступ оставлен для корректной работы user_function_call
*/
public function _initHooks()
{
remove_all_filters('woocommerce_cart_link');
//удаляем ссылку на корзину
remove_all_filters('woo_nav_after');
//удаляем сам блок корзины
remove_all_filters('woocommerce_simple_add_to_cart');
remove_action('woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30);
/**
* удаляем станицу корзины из базы
*/
$cart_id = woocommerce_get_page_id('cart');
if ($cart_id) {
wp_delete_post($cart_id);
}
/**
* Меняем работу ссылки добавления в корзину. Теперь она переадресовывает на партнёрку.
*/
add_action('woocommerce_simple_add_to_cart', array($this, 'hook_change_link'), 1, 2);
add_filter('woocommerce_loop_add_to_cart_link', array($this, 'hook_change_link'), 1, 2);
/**
* Подгружаем изображение из мета-поля поста
*/
add_filter('woocommerce_single_product_image_html', array($this, 'hook_woocommerce_single_product_image_html'), 1, 2);
add_action('woocommerce_placeholder_img', array($this, 'hook_woocommerce_placeholder_img'), 11, 1);
}
开发者ID:ArCoLab,项目名称:wp-affiliate-shop,代码行数:30,代码来源:woocommerce.php
示例14: 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;
}
开发者ID:gpsidhuu,项目名称:alphaReputation,代码行数:39,代码来源:helpers.php
示例15: woocommerce_prevent_admin_access
/**
* Prevent non-admin access to backend
*/
function woocommerce_prevent_admin_access()
{
if (get_option('woocommerce_lock_down_admin') == 'yes' && !is_ajax() && !current_user_can('edit_posts')) {
wp_safe_redirect(get_permalink(woocommerce_get_page_id('myaccount')));
exit;
}
}
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:10,代码来源:woocommerce-admin-functions.php
示例16: activello_woomenucart
/**
* Place a cart icon with number of items and total cost in the menu bar.
*/
function activello_woomenucart($menu, $args)
{
// Check if WooCommerce is active and add a new item to a menu assigned to Primary Navigation Menu location
if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || 'primary' !== $args->theme_location) {
return $menu;
}
ob_start();
global $woocommerce;
$viewing_cart = __('View your shopping cart', 'activello');
$start_shopping = __('Start shopping', 'activello');
$cart_url = $woocommerce->cart->get_cart_url();
$shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
$cart_contents_count = $woocommerce->cart->cart_contents_count;
$cart_contents = sprintf(_n('%d item', '%d items', $cart_contents_count, 'activello'), $cart_contents_count);
$cart_total = $woocommerce->cart->get_cart_total();
// Uncomment the line below to hide nav menu cart item when there are no items in the cart
// if ( $cart_contents_count > 0 ) {
if ($cart_contents_count == 0) {
$menu_item = '<li class="menu-item"><a class="woo-menu-cart" href="' . $shop_page_url . '" title="' . $start_shopping . '">';
} else {
$menu_item = '<li class="menu-item"><a class="woo-menu-cart" href="' . $cart_url . '" title="' . $viewing_cart . '">';
}
$menu_item .= '<i class="fa fa-shopping-cart"></i> ';
$menu_item .= $cart_contents . ' - ' . $cart_total;
$menu_item .= '</a></li>';
// Uncomment the line below to hide nav menu cart item when there are no items in the cart
// }
echo $menu_item;
$social = ob_get_clean();
return $menu . $social;
}
开发者ID:dydek,项目名称:Activello,代码行数:34,代码来源:woo-setup.php
示例17: woocommerce_archive_product_content
function woocommerce_archive_product_content()
{
if (!is_search()) {
$shop_page = get_post(woocommerce_get_page_id('shop'));
$shop_page_title = apply_filters('the_title', get_option('woocommerce_shop_page_title') ? get_option('woocommerce_shop_page_title') : $shop_page->post_title);
if (is_object($shop_page)) {
$shop_page_content = $shop_page->post_content;
}
} else {
$shop_page_title = __('Search Results:', 'woocommerce') . ' “' . get_search_query() . '”';
if (get_query_var('paged')) {
$shop_page_title .= ' — ' . __('Page', 'woocommerce') . ' ' . get_query_var('paged');
}
$shop_page_content = '';
}
?>
<h1 class="page-title"><?php
echo $shop_page_title;
?>
</h1>
<?php
if (!empty($shop_page_content)) {
echo apply_filters('the_content', $shop_page_content);
}
?>
<?php
woocommerce_get_template_part('loop', 'shop');
?>
<?php
do_action('woocommerce_pagination');
}
开发者ID:pmariopereira,项目名称:peter-sassy,代码行数:34,代码来源:woocommerce-template.php
示例18: wbst_woomenucart
function wbst_woomenucart($menu, $args)
{
// Check if WooCommerce is active and add a new item to a menu assigned to "Navbar Upper Right" (Primary Navigation Menu) location
if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || 'navbar_upper_right' !== $args->theme_location) {
return $menu;
}
ob_start();
global $woocommerce;
$viewing_cart = __('View your shopping cart', 'wbst');
$start_shopping = __('Start shopping', 'wbst');
$cart_url = $woocommerce->cart->get_cart_url();
$shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
$cart_contents_count = $woocommerce->cart->cart_contents_count;
$cart_contents = sprintf(_n('%d item', '%d items', $cart_contents_count, 'wbst'), $cart_contents_count);
$cart_total = $woocommerce->cart->get_cart_total();
if ($cart_contents_count == 0) {
$menu_item = '<li class="pull-right"><a class="woo-menu-cart" href="' . $shop_page_url . '" title="' . $start_shopping . '">';
} else {
$menu_item = '<li class="pull-right"><a class="woo-menu-cart" href="' . $cart_url . '" title="' . $viewing_cart . '">';
}
$menu_item .= '<i class="fa fa-shopping-cart"></i> ';
$menu_item .= $cart_contents . ' - ' . $cart_total;
$menu_item .= '</a></li>';
echo $menu_item;
$social = ob_get_clean();
return $menu . $social;
}
开发者ID:KarmaGraphic,项目名称:WBST,代码行数:27,代码来源:woocommerce-setup.php
示例19: get_sidebar
/**
* called by the action get_sidebar. this is what places this into the theme
*/
public static function get_sidebar($index = 'default-sidebar')
{
wp_reset_query();
global $wp_query;
$post = $wp_query->get_queried_object();
if (is_post_type_archive('product')) {
$post = get_post(woocommerce_get_page_id('shop'));
}
if (isset($post->ID)) {
$selected_sidebar = get_post_meta($post->ID, '_selected_sidebar', true);
} else {
$selected_sidebar = "";
}
if ($selected_sidebar != '' && $selected_sidebar != "0") {
echo "\n\n<!-- begin generated sidebar [{$selected_sidebar}] -->\n";
//echo "<!-- selected: $selected_sidebar -->";
dynamic_sidebar('ht_' . $selected_sidebar);
echo "\n<!-- end generated sidebar -->\n\n";
} else {
//dynamic_sidebar($index);
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar($index)) {
//echo '<div id="search" class="widget widget_search">';
//get_search_form();
//echo '</div>';
}
}
}
开发者ID:naffan2014,项目名称:greenhomeland,代码行数:30,代码来源:sidebar_generator.php
示例20: ep_addVCCustomCss
function ep_addVCCustomCss()
{
$shortcodes_custom_css = '';
//if is main-page
if (is_page_template('main-page.php')) {
$page_ids = get_all_page_ids();
$current_page_id = get_the_ID();
if (count($page_ids) > 0) {
foreach ($page_ids as $page_id) {
$separate_page = get_post_meta($page_id, "page-position-switch", true);
if ($separate_page !== "0" && $page_id != $current_page_id) {
$shortcodes_custom_css .= get_post_meta($page_id, '_wpb_shortcodes_custom_css', true);
}
}
if ($shortcodes_custom_css != '') {
echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
echo $shortcodes_custom_css;
echo '</style>';
}
}
} else {
if (function_exists("is_shop")) {
$shortcodes_custom_css = get_post_meta(woocommerce_get_page_id('shop'), '_wpb_shortcodes_custom_css', true);
if (is_shop() && $shortcodes_custom_css != '') {
echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
echo $shortcodes_custom_css;
echo '</style>';
}
}
}
}
开发者ID:rmilano24,项目名称:moto,代码行数:31,代码来源:utilities.php
注:本文中的woocommerce_get_page_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论