php 事件日历:将所有网站搜索重定向为Tribe Bar关键字搜索。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 事件日历:将所有网站搜索重定向为Tribe Bar关键字搜索。相关的知识,希望对你有一定的参考价值。

<?php
/**
 * The Events Calendar: Redirect all site searches to be Tribe Bar Keyword searches.
 *
 * Should only be used if you want only Event posts to appear in general search
 * queries. Again, Posts, Pages, and custom post types allowed to appear in
 * search results will no longer be included--ONLY Events will appear.
 * Example redirect:
 * From: http://example.dev/?s=Weekly+Screening
 *   To: http://example.dev/events/?tribe-bar-search=Weekly%20Screening
 *
 * @link https://gist.github.com/cliffordp/23536ca604bca074a9d2f169277cfe59
 * @link https://gist.github.com/cliffordp/51586f8c6f98ed9e1e1f2adbdd1dcb0a Similar snippet but for Post Tags (requires Filter Bar).
 */
add_action( 'template_redirect', 'cliff_redirect_site_search_to_tribe_bar_search' );
function cliff_redirect_site_search_to_tribe_bar_search() {
	if (
		! is_search() // is FALSE for Tribe Bar searches
		|| ! function_exists( 'tribe_get_events_link' )
	) {
		return;
	}

	$url = add_query_arg( 'tribe-bar-search', get_search_query( false ), tribe_get_events_link() );

	wp_redirect( esc_url_raw( $url ) );
	exit;
}

以上是关于php 事件日历:将所有网站搜索重定向为Tribe Bar关键字搜索。的主要内容,如果未能解决你的问题,请参考以下文章

php 将事件日历“所有事件”页面重定向到custon URL

php 事件日历PRO:将{pro_addl_fields}变量添加到tribe_event_inline短代码中。

php 事件日历PRO:即使对于tribe_events短代码,也使tribe_is_week()返回TRUE。

php 事件日历PRO:即使对于tribe_events短代码,也使tribe_is_week()返回TRUE。

php 如何将自定义过滤器字段添加到没有过滤器插件的Tribe事件日历(在此示例中 - 按类别和标记过滤)。示例:https:

php 事件日历:从Mini Calendar小部件中删除`tribe-event-featured`类。