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?
- What is PHPSESSID?
- WordPress Themes and PHP unit
- Enforcing password complexity
- How to insert PHP code in a WordPress Post
- Adding a search form inside a div
- Dynamically change feature image in customiser
- Creating wordpress user registration form
- How to reduce the database query-es
- category not display in word press grammatically
- Getting a fatal error while updating
- “Notice: Undefined variable: content” is showing [closed]
- How should I best target dynamically served content?
- Way to display “Yesterday”, “Today”
- Have CSS Class Added with `is_page()` WP function
- Slide in Panel WordPress Post
- Shortcode Inside Class Not Working
- Custom admin page: How to save changes specific to users
- the_title gives me the page’s title not the post title in the following code
- comments_number display outside specified span
- class click counter save number
- Get stock by custom meta field on all Woocommerce variable products
- Set a condition based on WooCommerce checkout city field while placing order
- My form action url is being prepended with a directory that does not exists
- Getting id of poll from WP database
- Passing the custom field values in the wp_get_current_user array function
- PHP 8, AJAX mail form to function.php doesn’t work
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- How to create a php variable using WordPress the_title() function
- PHP Warning: Attempt to read property “id” on null
- WP_Error Object in wp_remote_post & wp_remote_get
- Can’t programmatically log user in php