Here’s a simple example of a PHP dropdown, hope this helps.
<select name="mydropdownlist">
<?php
$options = array('option1' => 'option 1'
'option2' => 'option 2'
'option3' => 'option 3');
foreach($options as $value => $caption)
{
echo "<option value=\"$value\">$caption</option>";
}
?>
</select>
Related Posts:
- Build a content and excerpt grid loop with paging and options for # of posts
- Alter query on edit.php
- Drop down+sort blog posts date added/most popular
- Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
- How to order posts by modified date without using ‘query_posts’?
- How do I create a drop down menu in a widget?
- Getting movie and serial on actor page
- Second select list values are not saved after clicking update
- Two posts in same div – WP loop
- how to display active, upcoming and past event with featured listing with pagination
- Replacing the NavWalker dropdown element
- Select dropdown not showing selected value php
- Archive dropdown styling not applied
- Include a specific post to the query_posts and remove it if it is already in the returned list
- Getting the dropdown menu to redirect to different pages?
- Insert all post IDs in new database table
- Exclude posts from homepage having a specified tag
- Working with query_posts ( arrays and query strings)
- Can’t search posts using WP_QUERY inside AJAX Function
- How to make drop down post title
- Displaying the last post on static homepage
- Filter Select results based on selection
- Using loop pagination on single.php
- Logged in user ID as post ID
- Sort query_posts for Parent Pages to menue order or the count?
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- How to pick the default selected value in wordpress dropdown?
- how to save selected option in variable for rest api category filter
- Display parent and child taxonomies in separate drop down select fields
- Sort by page information by Ascending Numbers
- wp_dropdown_pages auto submit
- How to list posts from a plugin taxonomy?
- Counting Search results, and displaying the offset per page
- How to get post ID in a Page?
- Pagination broken on is_front_page()
- Isotope Drop Down Categories Filter Function
- HTML dropdown setting not showing last saved value in the database
- change the default order of posts only for specific categories
- Sorting dynamic select/dropdown for Contact Form 7 of Modern Tribe Events posts
- How to use wp_nav_menu to create custom dropdown menu?
- Posts are not looping through correctly
- Save the value of a wp_dropdown_pages
- Custom Taxonomy Select Menu: Setting default option value?
- limit number of post for achive page
- Saving a post ID to use in a form elsewhere on website
- posts_nav_link pulling in multiple post types
- Remove Post if Advanced Custom Field is checked to fix paging
- How to echo the_title from an array of posts?
- How to break up php code to avoid echo
- go to home page when i select default in select-box
- Limit the number of child pages
- How to set value selected using select2 jquery plugin
- search.php to search only the post title
- Hot to check if new posts have been published since page load and notify online users?
- Dropdown category field inside repeatable metabox
- WordPress create custom XML RSS feed template
- WordPress sorting posts by date and title using a dropdown
- How to make a pagination with dropdown selection?
- Is there anyway I can call the year once?
- PHP drop down menu for my get_category child of
- How to only fetch certain Tag ID’s
- Div Missing In Custom Loop Query
- Create a hierarchical loop at predefined markup requirements
- dropdown with no submit
- custom field meta-box with dropdown/autocomplete
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- How to exclude post from being queried based on custom meta value
- Save data of select list after clicking save
- Automatically create a loop for post ID
- Query specific posts per user selections from dropdown menus
- Custom query_posts() parameter
- Does wp_query and query_posts affect website performance? [duplicate]
- Pagination in category.php not functioning
- How to modify this function to exclude also the post belonging to a specific category?
- Open WordPress Page from selected option dropdown
- Contact form with dynamic dropdown and filter
- /page/2/ redirect to 404
- How do I exclude the current post from the upcoming post query
- Exclude first post from wp query
- Category Attachment Pagination 404 Error on 2nd Page
- List taxonomy term slugs within shortcode (do_shortcode)
- Add content after the first post in WP Loop
- Custom array from a query only write the last row of the query
- Find a way to retrive data updated through metabox plugin to web page
- wp_query get the 2nd post
- How to parse multiple links from one variable?
- What is the latest WordPress that will work on PHP 5.2.17?
- get taxonomy thumbnail and use it as a variable in code
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- update_post_meta on multi-dimensional array options
- How to hook code to show after the_content?
- Why doesn’t add_filter have the option to include a callback for each run?
- Issue with php version 7.2 in running search
- Sending a custom form data in email through WP Mail Function
- Woocommerce Email attachments not working – file not being attached
- Run a code only on theme activation only during first activation
- Best way to use a large array in function
- Plugin Generate Unexpected output during activation
- WordPress Environment: Dynamic Page using shortcode – how to change the page name for sharing
- AJAX button action in foreach