So I’ve a dropdown menu that has an inventory of all pages utilizing a sure template, when the consumer selects a dropdown merchandise id like them to be re-directed to that web page.
Here’s what I’ve up to now…
<div class="col-md-6 col-md-offset-3">
<?php
//create a var utilizing get_pages create an array and get all web page names
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'template-services.php'
));
?>
<p>Searching for one thing else?</p>
<choose id="cat" class="form-control">
<?php
// for every merchandise in pages array assign to the brand new var web page
foreach( $pages as $web page ) {
//echo out var web page for every merchandise within the array
echo '<possibility>' . $page->post_title . '</possibility>';
}?>
</choose>
</div>
Might somebody present me how I can obtain this? I do know there’s a script on the WordPress codex that means that you can do that for classes however I do not know the best way to modify it to work for my wants