关键词:
<?php
/**
* The Events Calendar + Community Events Tickets: Force Global Stock to be
* checked and then hidden (to avoid unchecking), only on the Add New form.
*
* Because this does not apply to the Edit Event form, you may want to modify
* this code to your needs, such as hiding the checkbox even on the Edit form
* but not actually forcing it checked (to avoid affecting events prior to
* implementing this snippet.
*
* @link https://gist.github.com/cliffordp/c483a67a35f7032f586c6813083a998c
*/
add_action( 'wp_footer', 'cliff_community_tickets_force_global_stock' );
function cliff_community_tickets_force_global_stock()
if ( false === cliff_is_community_add_new_form() )
return;
wp_enqueue_script( 'jquery' );
?>
<script type="text/javascript">
jQuery( document ).ready( function ()
jQuery( 'body.tribe_community_edit #tribe-global-stock-settings input#tribe-tickets-enable-global-stock' ).prop( 'checked', true ).hide();
jQuery( 'body.tribe_community_edit #tribe-global-stock-settings label[for="tribe-tickets-enable-global-stock"]' ).hide();
jQuery( 'body.tribe_community_edit #tribe-global-stock-settings #tribe-tickets-global-stock-level' ).show();
);
</script>
<?php
/**
* Return TRUE if we are in the Community Events Add Event form. Return FALSE
* if we are in the Edit form or Events List view.
*
* @return bool
*/
function cliff_is_community_add_new_form()
$main = tribe( 'community.main' );
if ( empty( $main ) )
// Community Events is not active (or may somehow not be loaded correctly)
return false;
$event_post_type = Tribe__Events__Main::POSTTYPE;
$action = Tribe__Utils__Array::get( $main->context, 'action' );
$ce_post_type = Tribe__Utils__Array::get( $main->context, 'post_type', $event_post_type ); // assume event post type if not set
// bail if we are not doing what is expected from the start
if ( $event_post_type !== $ce_post_type )
return false;
if ( 'add' === $action )
return true;
else
// 'edit' for Edit form
// or, if empty, you might be in the Community Events List view
return false;
php活动日历:社区活动门票:在社区活动列表视图上显示“付款选项”按钮。(代码片段)
查看详情
php活动日历:社区活动门票:在社区活动列表视图上显示“付款选项”按钮。(代码片段)
查看详情
php活动日历和活动门票加(et+):如果门票适用于特定类别的活动,则禁用qr码。(代码片段)
查看详情
php活动门票加:woocommerce:强制所有门票“单独出售”。(代码片段)
查看详情
php活动门票加:woocommerce:强制所有门票“单独出售”。(代码片段)
查看详情
php活动日历:eventbrite门票:自定义iframe的高度。(代码片段)
查看详情
php活动日历:eventbrite门票:自定义iframe的高度。(代码片段)
查看详情
php活动日历-社区活动:将高级自定义字段排入社区活动添加/编辑表单页面。(代码片段)
查看详情
php活动日历-社区活动:将高级自定义字段排入社区活动添加/编辑表单页面。(代码片段)
查看详情
php活动日历:社区活动:将图片上传限制为3兆字节。(代码片段)
查看详情
php活动日历:社区活动:将图片上传限制为3兆字节。(代码片段)
查看详情
php活动门票:在门票电子邮件中显示活动日期和时间。(代码片段)
查看详情
php活动门票:在门票电子邮件中显示活动日期和时间。(代码片段)
查看详情
php活动门票:设置每张门票允许的最大数量。(代码片段)
查看详情
php活动门票加:woocommerce门票:将门票购买限制限制为1。(代码片段)
查看详情
php活动门票加:woocommerce门票:将门票购买限制限制为1。(代码片段)
查看详情
php活动门票加:woocommerce购物车:在每个门票名称前加上适用的活动的帖子标题(如果附加到(代码片段)
查看详情
php活动门票加:woocommerce购物车:在每个门票名称前加上适用的活动的帖子标题(如果附加到(代码片段)
查看详情