wordpress
发布时间:2022-05-06 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了修改 WordPress 搜索结果的链接样式,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
站长朋友们在使用wordpress建站的过程中会发现,wordpress 默认的搜索结果页面的链接样式是这个样子的:http://www.yourdomain.com/?s=[search query],下面来举个例子说明一下:
Crayon-5c891cbe4f7f7004268095" class="
Crayon-
Syntax Crayon-theme-classic
Crayon-font-monaco
Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mou
SEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mou
SEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-title">Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button
Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button
Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button
Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button
Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button
Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button
Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-main" style="">
Crayon-table">Crayon-row">Crayon-nums " data-settings="show">Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"> Crayon-num" data-line=" Crayon-5c891cbe4f7f7004268095-1">1 | Crayon-code">Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"> |
这样的链接看起来实在是有些混乱,您可以将它修改为
Crayon-5c891cbe4f800453678649" class="
Crayon-
Syntax Crayon-theme-classic
Crayon-font-monaco
Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mou
SEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mou
SEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-title">Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button
Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button
Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button
Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button
Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button
Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button
Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-main" style="">
Crayon-table">Crayon-row">Crayon-nums " data-settings="show">Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"> Crayon-num" data-line=" Crayon-5c891cbe4f800453678649-1">1 | Crayon-code">Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"> |
切换到主题目录,打开 functions.PHP 文件,加入以下代码即可:
Crayon-5c891cbe4f802312836037" class="
Crayon-
Syntax Crayon-theme-classic
Crayon-font-monaco
Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mou
SEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mou
SEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-title">functions.PHPCrayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button
Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button
Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button
Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button
Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button
Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button
Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-language">PHPCrayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-main" style="">
Crayon-table">Crayon-row">Crayon-nums " data-settings="show">Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"> Crayon-num" data-line=" Crayon-5c891cbe4f802312836037-1">1 Crayon-num Crayon-striped-num" data-line=" Crayon-5c891cbe4f802312836037-2">2 Crayon-num" data-line=" Crayon-5c891cbe4f802312836037-3">3 Crayon-num Crayon-striped-num" data-line=" Crayon-5c891cbe4f802312836037-4">4 Crayon-num" data-line=" Crayon-5c891cbe4f802312836037-5">5 Crayon-num Crayon-striped-num" data-line=" Crayon-5c891cbe4f802312836037-6">6 Crayon-num" data-line=" Crayon-5c891cbe4f802312836037-7">7 Crayon-num Crayon-striped-num" data-line=" Crayon-5c891cbe4f802312836037-8">8 | Crayon-code">Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"> Crayon-line" id=" Crayon-5c891cbe4f802312836037-1"> Crayon-c">//修改搜索结果的链接Crayon-line Crayon-striped-line" id=" Crayon-5c891cbe4f802312836037-2"> Crayon-t">functionCrayon-h"> Crayon-e">redirect_searchCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-line" id=" Crayon-5c891cbe4f802312836037-3"> Crayon-h"> Crayon-st">ifCrayon-h"> Crayon-sy">(Crayon-e">is_searchCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-o">&&Crayon-h"> Crayon-o">!Crayon-k ">emptyCrayon-sy">(Crayon-v">$_GETCrayon-sy">[Crayon-s">'s'Crayon-sy">]Crayon-sy">)Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-line Crayon-striped-line" id=" Crayon-5c891cbe4f802312836037-4"> Crayon-h"> Crayon-e">wp_redirectCrayon-sy">(Crayon-e">home_urlCrayon-sy">(Crayon-s">"/search/"Crayon-sy">)Crayon-sy">.Crayon-e">urlencodeCrayon-sy">(Crayon-e">get_query_varCrayon-sy">(Crayon-s">'s'Crayon-sy">)Crayon-sy">)Crayon-sy">)Crayon-sy">;Crayon-line" id=" Crayon-5c891cbe4f802312836037-5"> Crayon-h"> Crayon-k ">exitCrayon-sy">(Crayon-sy">)Crayon-sy">;Crayon-line Crayon-striped-line" id=" Crayon-5c891cbe4f802312836037-6"> Crayon-h"> Crayon-sy">}Crayon-line" id=" Crayon-5c891cbe4f802312836037-7"> Crayon-sy">}Crayon-line Crayon-striped-line" id=" Crayon-5c891cbe4f802312836037-8"> Crayon-e">add_actionCrayon-sy">(Crayon-s">'template_redirect'Crayon-sy">,Crayon-h"> Crayon-s">'redirect_search'Crayon-h"> Crayon-sy">)Crayon-sy">; |
大佬总结
以上是大佬教程为你收集整理的修改 WordPress 搜索结果的链接样式全部内容,希望文章能够帮你解决修改 WordPress 搜索结果的链接样式所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。