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
- Output a WooCommerce product custom field in WooCommerce using get_post_meta()
- Does wp-cron runs all tasks scheduled at same time together or one after other?
- WordPress blockquote removes “ tag
- Output 2 items within the Loop
- Why does running get_the_excerpt() when generating JSON file take 28 seconds vs. 599 milliseconds without it?
- How can i upload images in an admin page?
- WordPress: Access a plugin from within a theme
- wordpress archive a user
- How to change theme programmatically from a external application?
- Hide Featured Image Meta Box on Editor Screen
- require_once() if a product in woocommerce contains a tag [closed]
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- How to suppress template-parts in undescores?
- How run a non-WordPress PHP Program on a WordPress site?
- Page Options Saving But Not Updating In Backend
- How to WP_Query posts order by parent title?
- Adding variable in WordPress shortcode
- Use WP Cron to Clear a Page Cache?
- extract url from a hyperlinked string in PHP [closed]
- Include a php file that is above WP installation hierarchically?
- Two loops in one function
- What is proper way to use the php if statement? [closed]