<?php the_page_title(); $cse_id = get_cse_id_if_enable(); if (is_search() && $cse_id !== false) { ?> <div id="cse" style="width: 100%">Loading ...</div> <script src="http://ajax.googleapis.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> var searchStr='<?php echo strip_tags($_POST["s"]); ?> '; google.load('search', '1', {language : 'zh-CN',"nocss" : true}); google.setOnLoadCallback(function() { var myCb = function(){scrollToElement("#container");setHoverCursor('.gsc-cursor-page', 'pointer');}; var customSearchControl = new google.search.CustomSearchControl('<?php echo $cse_id; ?> '); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); customSearchControl.setSearchCompleteCallback(this, myCb); customSearchControl.draw('cse'); $('.gsc-input').val(searchStr); $('.gsc-search-button').click(); }, true); </script> <?php } else { if (have_posts()) { while (have_posts()) {
function the_page_title() { if (is_category()) { echo "<h2 class=\"pagetitle\">分类目录:" . single_cat_title("", false) . "</h2>"; } else { if (is_day()) { echo "<h2 class=\"pagetitle\">文章归档:" . get_the_time('Y年m月d日') . "</h2>"; } else { if (is_month()) { echo "<h2 class=\"pagetitle\">文章归档:" . get_the_time('Y年m月') . "</h2>"; } else { if (is_year()) { echo "<h2 class=\"pagetitle\">文章归档:" . get_the_time('Y年') . "</h2>"; } else { if (is_search()) { $searchKey = stripcslashes(strip_tags($_POST["s"])); if (get_cse_id_if_enable() !== false || have_posts()) { echo "<h2 class=\"pagetitle\">“" . $searchKey . "” 的搜索结果</h2>"; } else { echo "<h2 class=\"pagetitle\">很抱歉,找不到关于“" . $searchKey . "” 的文章</h2>"; } } else { if (!have_posts()) { echo "<h2 class=\"pagetitle\">您要访问的资源不存在或由于种种原因暂时不可见!</h2>"; } } } } } } }