Instead of echoing out these images, just store them as strings inside an array and choose one of the array items at random.
<?php $headerimage_options = get_option('headerimage_options' );
$images = array();
$images[] = '<img title="'.get_bloginfo('name').'" src="'.esc_url( $headerimage_options['image'] ).'"/>';
$images[] = '<img title="'.get_bloginfo('name').'" src="'.esc_url( $headerimage_options['image2'] ).'"/>';
$images[] = '<img title="'.get_bloginfo('name').'" src="'.esc_url( $headerimage_options['image3'] ).'"/>';
$v = array_rand($images);
echo $images[$v];
Related Posts:
- How to get WordPress Time Zone setting?
- Limit the number of inactive widgets
- Custom plugin: Trying to show saved data on frontend
- Add extra field to users
- Remove/unset options field from backend Settings->General?
- Site Title and Tagline in Theme Options Page
- Editor role cannot save custom theme options
- WordPress customizer: load controls in a custom div
- Site Title and Tagline in Pagelines DMS Options Panel
- Enqueue Javascript Correctly for 3.5
- Refresh page after update_post_meta
- Passing array in add_option()
- Implement a multi-value input field where the number of entries is not limited
- Select dropdown not showing selected value php
- How do I output a database option that is an array into a get_posts array?
- Delete option value from array using update_option()
- How to get bool with `get_option()` when already registered setting with type `boolean`
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Settings API – sanitize_callback is not called and it leads to an incorrect behavior
- Store and Work with huge array in WP [closed]
- SQL QUERY – Select a value directly from the database
- Adding Default Settings to Theme My Login plugin
- How to add values to media “whitelist_options” in wp-admin/options.php template?
- WSoD being caused by this piece of code
- Ajax – Call to undefined function get_option()
- Multiple options not staying selected after saving
- Whitelisting items from custom options page
- Options API get_option() and update_option() Not Correctly Updating or Returning
- Why Won’t My Inputs in a form with a Get method work together?
- Setting default category base on theme activation
- Error: options page not found
- How to store options in an array
- how to update and display an option without reloading the page
- Saving plugin settings – ERROR: options page not found
- Security for data obtained from the database
- Pull GetOption() variable into jQuery dynamically created html
- Filtering a Database Query
- Is a series of update_option calls safe, performance wise?
- wp-options keep crashing please help
- WP_OPTIONS table, active_plugins entry [closed]
- Warning: Illegal string offset on theme options page [closed]
- Link blogname and blogdescription to the Options Framework
- retain querystring values when savincustom options in admin
- How to Change CSS Colors from Custom Plugin Settings Page
- Decimal values via get_option() with custom local (decimal point = comma)
- How to show every second user different types of banners?
- WordPress language switcher doesn’t work
- How to make blog post entries appear as input form instead of just text?
- Get value from db for custom contact form
- Page Options Saving But Not Updating In Backend
- Add a custom WooCommerce settings tab with sections
- Set all WooCommerce Products to Simple, Virtual & Downloadable
- How to make a pagination with dropdown selection?
- No more get_option(‘date_time’) in WordPress 5.5?
- getting the values of hidden inputs to use them in a php mysql query
- How to update option field in database on clicking the publish button in customizer
- Echo Option Value Based On WordPress User Role
- New term taxonomy and description in front page. Input’s
- If input field has value Require another field – PHP
- Use get_option with $emailTo on contact page
- WordPress Setting page can not be saved by html radio
- Name Input from widget displays Sidebar name instead of saved data
- Save Option on Database
- Integrating CSS Into a WP Function Call [closed]
- Options.php loop won’t show!
- Echo get_option displays as text
- Dynamic Email Handler with ‘header (“Location: …’
- save array of objects with update_option
- WordPress Customizer add_control Dropdown of Pages with Multi Select?
- Quiz page template, checked attribute missing when option selected
- How to connect input of information in wordpress and sending it using php to the VDS?
- Can’t save php string to a custom field
- HTML escaping data with ajax requests
- add_filter only for front office
- WordPress comment submit button substitutes/options
- Blob file download problem
- How to make container class in PHP
- Using and saving custom dropdown boxes on user profiles
- Copy taxonomy terms from one post to another programmatically
- Error using WordPress $wpdb object to get result from custom table
- How to loop through all the attached images in a post, and get their url one by one
- How to array only one key from another array
- Sidebar not appearing in footer, but it appears everywhere else!
- How to create table in wordpress without plugin? [closed]
- Use Tags to initiate Search
- How can i show post_class() within output loop?
- Search form does not work in my website
- Show About and Contact Us page when they’re clicked in the top menu.
- How to remove ?p= from wordpress short links
- How to Disable WordPress Page Revisions?
- Display custom field on 404 page outside loop
- single.php with different look by category
- How i can get post data from database when i am getting post id from url in wordpress
- WordPress Block developer from exporting Database via PHP
- How to retrieve the data from the sever and displaying it in a page?
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Hook called before text widget save
- Is There A Way To Make Theme Files Accept Shortcodes?
- WordPress Ajax Always returning 0
- Is there any way to get a drop down list of time zones?