Question

I have a problem with my google custom search engine. I want only the latest post to show in my search engine at the top. But now it from 2009 to 2013. I want to show it from 2013 to 2009.

Here is my code for search box,

<div id="google_search_main">
<form id="cse-search-box" action="/pages/other/search_results.html">            
<input type="hidden" name="cx" value="xxxxxxxxxxxxxx" />
<input type="hidden" name="cof" value="FORID:11" />
<input type="hidden" name="ie" value="UTF-8" />
<LookAndFeel text_font="Arial, sans-serif"/> <Logo />
<table cellspacing="0" cellpadding="0" border="0">
    <tr>        <!-- Commenting out the 100 icon -->                
        <td valign="middle"><input name="q" type="text" id="google_custom_search_0" class="google_search_img" style="border:1px solid #d0cece;width:<?php echo $width; ?>px;height:26px;line-height:26px;margin-top:0px;" />
        </td>
        <td valign="middle"><input type="image" src="<?php echo $path; ?>images/go_button.gif" name="sa" value="Go" /></td>
    </tr>
</table>

</form>
</div>

And this one is my snippet code,

<div id="results_xxxxxxxxx:9bykknrld80" style="width:100%"></div>
  <script type="text/javascript">
    var googleSearchIframeName = "results_xxxxxxxxxxxx:9bykknrld80";
    var googleSearchFormName = "searchbox_xxxxxxxxxxxx:9bykknrld80";
    var googleSearchFrameWidth = 824;
    var googleSearchFrameborder = 0;
    var googleSearchDomain = "www.google.com";
    var googleSearchPath = "/cse";  
  </script>
  <script type="text/javascript" src="'/cse'/brand'?form='cref" ></script>
  <script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>

Help me find the solution for this issue.

Thanks

Was it helpful?

Solution

Add one more line in this code,

<form id="cse-search-box" action="/pages/other/search_results.html">            
<input type="hidden" name="cx" value="xxxxxxxxxxxxxx" />
<input type="hidden" name="cof" value="FORID:11" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="hidden" name="sort" value="date:d" />

name="sort" & value="date:d"

It works for me as a descending order view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top