Skip to main content

I have a custom page "resources-search.php"resources-search.php template which handles search results for the search form. And in my function.phpfunction.php I have the following array:

$YearList = array('2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013');

Yes, You guessed it right. Its an array of year. In my resources-search.phpresources-search.php I' am using this code:

<select name="year" id="opt_year">
<option value="0" selected="true" disabled="true">Year</option>
<?php
foreach($YearList as $key => $value){
echo '<option value="'.$value.'">'.$value.'</option>'; //close your tags!!
}
 ?>
</select>

Its a drop-down menu from the array above. This method doesn't actually works for me. In other pages it does work but not in resources-search.phpresources-search.php.

Any Ideas pleaseideas anyone?

I have a custom page "resources-search.php" template which handles search results for the search form. And in my function.php I have the following array

$YearList = array('2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013');

Yes, You guessed it right. Its an array of year. In my resources-search.php I' am using this code

<select name="year" id="opt_year">
<option value="0" selected="true" disabled="true">Year</option>
<?php
foreach($YearList as $key => $value){
echo '<option value="'.$value.'">'.$value.'</option>'; //close your tags!!
}
 ?>
</select>

Its a drop-down menu from the array above. This method doesn't actually works for me. In other pages it does work but not in resources-search.php.

Any Ideas please anyone?

I have a custom page resources-search.php template which handles search results for the search form. And in my function.php I have the following array:

$YearList = array('2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013');

Yes, You guessed it right. Its an array of year. In my resources-search.php I' am using this code:

<select name="year" id="opt_year">
<option value="0" selected="true" disabled="true">Year</option>
<?php
foreach($YearList as $key => $value){
echo '<option value="'.$value.'">'.$value.'</option>'; //close your tags!!
}
 ?>
</select>

Its a drop-down menu from the array above. This method doesn't actually works for me. In other pages it does work but not in resources-search.php.

Any ideas anyone?

Replaces completely unrelated title and tags
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459

Wordpress - Cannot Use function.php on Custom Post Type Search results in custom template

Source Link

Wordpress - Cannot Use function.php on Custom Post Type

I have a custom page "resources-search.php" template which handles search results for the search form. And in my function.php I have the following array

$YearList = array('2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013');

Yes, You guessed it right. Its an array of year. In my resources-search.php I' am using this code

<select name="year" id="opt_year">
<option value="0" selected="true" disabled="true">Year</option>
<?php
foreach($YearList as $key => $value){
echo '<option value="'.$value.'">'.$value.'</option>'; //close your tags!!
}
 ?>
</select>

Its a drop-down menu from the array above. This method doesn't actually works for me. In other pages it does work but not in resources-search.php.

Any Ideas please anyone?