php 活动门票:自定义“立即购买”按钮的“左侧点”/“左侧门票”文本。截图:https://cl.ly/1j2G372T0f11

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 活动门票:自定义“立即购买”按钮的“左侧点”/“左侧门票”文本。截图:https://cl.ly/1j2G372T0f11相关的知识,希望对你有一定的参考价值。

<?php

/*
 * Event Tickets: Customize the Buy Now button's "spots left" / "tickets left" texts.
 *
 * Screenshot: https://cl.ly/1j2G372T0f11
 * Uses 'ngettext' filter.
 *
 * @link https://gist.github.com/cliffordp/a35f07f81aa14fbf0bca373dd97d9ede This snippet.
 * @link https://github.com/moderntribe/event-tickets/blob/4.7.2/src/template-tags/tickets.php#L221-L223 The text we are customizing.
 * @link https://theeventscalendar.com/support/forums/topic/rewording-tickets-left-to-places-left/ Help Desk request.
 * @link https://theeventscalendar.com/knowledgebase/change-the-wording-of-any-bit-of-text-or-string/ How to use 'gettext' filter for other strings.
 *
 * @see tribe_tickets_buy_button()
 * @see number_format_i18n()
 *
 * @param string $translation Translated text.
 * @param string $single      The text to be used if the number is singular.
 * @param string $plural      The text to be used if the number is plural.
 * @param string $number      The number to compare against to use either the singular or plural form.
 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
 *
 * @return string
 */
function cliff_et_custom_spots_tickets_texts( $translation, $single, $plural, $number, $domain ) {
	if ( 'event-tickets' === $domain ) {
		// Put your custom text here in a key => value pair
		// Example: 'Text you want to change' => 'This is what it will be changed to'
		// The text you want to change is the key, and it is case-sensitive
		// The text you want to change it to is the value
		// You can freely add or remove key => values, but make sure to separate them with a comma
		$custom_text = array(
			'%s spot left'    => '%s RSVPPPPP left',
			'%s spots left'   => '%s RSVPPPPPs left',
			'%s ticket left'  => '%s Placeeee left',
			'%s tickets left' => '%s Placeeees left',
		);

		foreach ( $custom_text as $key => $value ) {
			if ( $key === $translation ) {
				$translation = $value;
				break;
			}
		}
	}

	return $translation;
}

add_filter( 'ngettext', 'cliff_et_custom_spots_tickets_texts', 20, 5 );

以上是关于php 活动门票:自定义“立即购买”按钮的“左侧点”/“左侧门票”文本。截图:https://cl.ly/1j2G372T0f11的主要内容,如果未能解决你的问题,请参考以下文章

php 活动日历:Eventbrite门票:自定义iframe的高度。

php 活动日历:Eventbrite门票:自定义iframe的高度。

如何使用自定义字段制作 PayPal 加密的“立即购买”按钮?

php 活动日历:社区活动门票:在社区活动列表视图上显示“付款选项”按钮。

php 活动日历:社区活动门票:在社区活动列表视图上显示“付款选项”按钮。

PayPal立即购买按钮自定义变量不起作用