Ⅰ wordpress站內搜索代碼怎麼寫
親,你好,很高興為你回答。
首先你要准備2個文件
1個辯慶是在wordpress主題下的search.php文件
1個是檢索頁面需要放入html代碼。
<form action="/" method="get">
<input name="s" type="text" placeholder="網站檢索" id="s" value="<? the_search_query(); ?>" />
<input name="sa" value="檢索" type="image" src="<?php bloginfo('template_url'); ?>/images/search_icon.gif" align="top" class="btn" />
</form>
上面這些是放在頁面的form表單
========================================================================
下面這些是放在search.php里的代碼
<?php
/**
*.
*
*.
*
*andthatother'pages'onyourWordPresssitewillusea
*differenttemplate.
*
*@packageHotlink
*@subpackageHotlinkTheme
*/
//検索結果用
$search_query=&newWP_Query("s=$s&showposts=-1");
get_header();?>
<sectionclass="mainclearfix">
<?phpif(have_posts()):while(have_posts()):the_post();?>
<divid="post-<?phpthe_ID();?>"class="search_post">
<divclass="search_title">
<ahref="<?phpthe_permalink();?>"title="<?phpthe_title_attribute();?>"rel="bookmark">
<?phpthe_title();?>
<spanclass="search_text"><?phpthe_excerpt();?>納胡</span>
</a></div>
<?phpthe_date()?><?phpthe_time()?>
</div>
<?phpendwhile;else:?>
<pclass="search_text">
<?php_e('您要搜索的內容不存在');?>
</p>
<?phpendif;?>
<divclass="nav-previous">
<?phpprevious_posts_link(__('«OlderEntries','kubrick'));?>
</div>
<divclass="nav-next">
<?phpnext_posts_link(__('NewerEntries»','kubrick'));?>
攜茄握</div>
</section>
<?phpget_footer();?>
如果可以使用,記得採納呦。。有問題繼續追問我。
Ⅱ 在網站中添加360的搜索代碼是多少啊
<form action=" http://www.so.com/s" target="_blacnk">
<span id="input-container">
<input type="hidden" name="ie" value="畝早utf-8">
<input type="hidden" name="src" value="360sou_home">
<!--input-inner的功能是為了定位需要,可以自定義去除哦-->拆耐蔽
<div id="input-inner">
<div id="suggest-align">
<img src=" http://p0.qhimg.com/t01b5a8f44b7454cc03.png" width="100 height="30" />
<input name="q" type="text" id="input" value="<FONT color=red>中國FPS聯盟論壇</FONT>" suggestWidth="188px" autocomplete="off" x-webkit-speech>
<input name="submit" type="submit" id="search-button" onmousedown="this.className='mousedown'" onmouseover="this.className='hover'" onmouseout="this.className=''" value="360搜索" />
</div>
</div>
</span>
</form>
1,其中搜索引擎代碼中的id="input" value=「中國FPS聯盟」這一句代旅州碼中的「中國FPS聯盟」關鍵詞可以替換成你自己的網站關鍵詞!
2,<img src=" http://p0.qhimg.com/t01b5a8f44b7454cc03.png" width="100 height="30" />這句代碼可以定義搜索LOGO的大小,視情況而定。
Ⅲ 請問:Hao123.com中的百度的搜索框是如何作的我的網站也想有,該加啥代碼呀
將代碼放入網頁中:
代碼如下:
<form action="http://www..com/" target="_blank"賣運>
<table bgcolor="#FFFFFF"><tr><td>
<input name=tn type=hidden value=>
<a href="http://www..com/"><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-80px.gif" alt="Bai" align="bottom" border="0"></a>
<input type=text name=word size=30>
<input type="submit" value="網路搜索">
</td></tr></table>
</form>
-------------------
另一個:
<SCRIPT language=javascript>
function g(formname) {
var url = "http://www..com/";
if (formname.s[1].checked) {
formname.ct.value = "2097152";
}
else {
formname.ct.value = "0";
}
formname.action = url;
return true;
}
</SCRIPT>
<form name="f1" onsubmit="return g(this)">
<table bgcolor="#FFFFFF" style="font-size:9pt;">
<tr height="60"><td valign="top"><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-137px.gif" border="0" alt=""></td>
<td>
<input name=word size="30" maxlength="100">
<input type="submit" value="網路搜索"><br>
<input name=tn type=hidden value="bds">
<input name=cl type=hidden value="3">
<input name=ct type=hidden>
<input name=si type=hidden value="www.guoxue.com">
<input name=s type=radio> 互聯網
<input name=s type=radio checked> www.guoxue.com
</td></tr><蘆派/陪配賀table>
</form>
Ⅳ 求在自己的網頁里加入關鍵字搜索跟分類搜索的代碼!
<h4 class="Ptitle">運喚000000</h4><磨虧div class="Pcontent"><form style="MARGIN: 0px" onsubmit="if (this.SearchContent.value.length<3) {alert('關鍵字不能少於3個子');this.SearchContent.focus();return false}" action="search.asp">
關鍵字 <input class="userpass" name="瞎悄神SearchContent"/>
<div style="OVERFLOW: hidden; HEIGHT: 3px"></div>
類 型 <select name="searchType">
<option value="title" selected="selected">******</option>
<option value="Content">******</option>
<option value="Comments">******</option>
<option value="trackback">******</option>
</select> <input class="userbutton" type="submit" value="查 找"/>
把000000改成標題然後把*****改成分類搜索的關鍵字類型就可以了
Ⅳ 請問要在網站上加什麼內容才能被搜索引摯搜索到
你可以到各個搜索引擎免費登陸你的網陪宏站..
然蘆轎冊後再在每個頁面添加下面代碼
<meta name="keywords" content="這里填寫能體現帆知你的網站的關鍵字" />
<meta name="description" content="這里填寫能體現你的網站的關鍵字" />
這樣就很容易搜索到了..
一般24小時後生效吧
Ⅵ 我想為我自己的網站加一個站內搜索的功能,請問應該怎樣編寫代碼呢
1、用織夢的搜索模版,是search.htm這個模版,你把logo之類的改改就行了
2、自己做一個搜索模版,然後內容用這個搜索代碼:
{dede:list perpage='20'}
<li>
[field:array runphp='yes']@me = (empty(@me['litpic']) ? 「」 : 「<a href=』{@me['arcurl']}』 class=』preview』><img src=』{@me['litpic']}』/></a>」); [/field:array]
<a href=」[field:arcurl/]」 target=」_blank」>[field:title/]</a>
<p>[field:description function='cn_substr(@me,80)'//]…</p>
<span>
<small>分類:</small><a href=」[field:typeurl/]」 target=」_blank」>[field:typename/]</a>
<small>點擊:</small>[field:click/]
<small>日期:喊做</small>[field:stime/]
</span>
</li>
{/dede:list}
首頁搜索用:
<form id=」search」 name=」search」 method=」post」 action=」{dede:global.cfg_cmsurl/}/plus/鄭告衡search.php」>
<input type=」text」 name=」keyword」 value=」請輸入關鍵字」 onMouseOver=」this.focus()」 onBlur=」if (value ==」){value=』請輸入關鍵字』}」 onFocus=」this.select()」 onClick=」if(this.value==』請輸入關鍵字』)this.value=」」 />
<input type=」submit」 value=」友汪站內搜索」 />
</form>
最好自己定義下樣式
Ⅶ 在網頁中如何實現網頁內的搜索功能,可否給提供一段代碼
一、可以用網路或者谷歌螞飢的搜索代碼。優點謹配:簡單易用,把代碼粘過來就能用;不增加空間負擔。
二、可以用asp代碼,可以再網上搜索,很悶晌返多,但我覺得如果是新手,做起來挺麻煩
Ⅷ html製作一個搜索框,代碼是什麼
1、打開Hbuilder編輯器,創建一個input框和button按鈕,將它們橫排擺放在一起:
Ⅸ dede網站搜索代碼
1、織夢CMS的搜索頁面存放在網站根目錄下/plus/advancedsearch.php,如果你的進行過修改,請自己找到相關文件路徑。
2、代敗顫碼調用方式:只要將以下代碼放在模板頁面的指定位置,就可以實現強大的站內搜索了。
以下為引用的內容:
<form?action="/plus/advancedsearch.php"?method="post"><!--這里是你的搜索頁和枯跡面位置-->
<p>?
<input?type="hidden"?name="mid"?value="1"?/>?
<input?type="hidden"?name="dopost"?value="search"?/>?
<span?class="STYLE3?STYLE2"><span?class="STYLE3">關鍵詞:</span></span>?
<input?name="q"?type="text"?class="STYLE2"?size="20"?/>?
<input?name="submit2"?type="submit"?class="STYLE2"?value="開始搜索"?/><!--以上代碼內關鍵詞的搜索代碼-->?
</p>?
<p>
<span?class="STYLE7">文喚並章內容?:</span>?
<input?name="body"?type="text"?class="STYLE2"?size="40"?/>?
<input?name="submit3"?type="submit"?class="STYLE2"?value="開始搜索"?/>
</p>?
</form>
<!--/-->
3.以上代碼可做參考,也可以參照dede原首頁模版裡面的搜索代碼。