
內容簡介
拯救您的訪客免受無用的 404 錯誤!
不要讓訪客在到達不存在的內容時馬上放棄,而是努力猜測他們最初需要的內容。此外掛會使用來自
請求 URL 的關鍵字,在您的文章、頁面、標籤和分類中進行搜索。如果有匹配的,則重定向到該內容,而不是顯示錯誤。如果有多個匹配,則
404 模板可以使用一些範本標籤向訪客提供建議列表。
範本標籤
genius404_has_suggestions
如果有建議,則返回 true,否則返回 false
genius404_get_suggestions
檢索用於手動呈現的文章對象數組。
genius404_suggestions
列出建議文章的清單。
將參數「list」傳遞給函數,以列表方式呈現建議。
genius404_loop
查詢用於循環使用的文章。例如:
<?php genius404_loop(); ?>
<?php while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php endwhile; ?>
請注意,此循環無法正確顯示頁面,因為它不支持它們。如果您使用上述循環,不建議啟用頁面搜索。
genius404_get_search_terms
檢索用於填充建議列表的搜索詞組數組,供上下文突出顯示等使用。
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
Save your visitors from unhelpful 404 errors!
Instead of quickly giving up when a visitor reaches content that doesn’t exist, make an effort to guess what they were
after in the first place. This plugin will perform a search of your posts, pages, tags and categories, using keywords from the requested
URL. If there’s a match, redirect to that content instead of showing the error. If there’s more than one match, the
404 template can use some template tags to provide a list of suggestions to the visitor.
Template tags
genius404_has_suggestions
Returns true if there are some suggestions, false otherwise
genius404_get_suggestions
Retrieve an array of post objects for rendering manually.
genius404_suggestions
Draw a list of suggested posts.
Pass the parameter “list” to render suggestions as a list.
genius404_loop
Query posts for use in a Loop. Eg:
Note that the loop will not display pages correctly, as it is not built to support them. It is recommended that if you use
a loop like that above, do not enable searching of pages.
genius404_get_search_terms
Retrieve an array of search terms used to populate the suggestions list, for use with contextual highlighting, etc.
