Tag Info

New answers tagged

0

Thanks to both of you. From this i figured out how to make them display only the images that had something actually in the input fields. So no broken image or empty div if the input field is empty. I used the following code: <?php $headerimage_options = get_option('headerimage_options' ); $images = array(); if ( "" != $headerimage_options['image'] ) : ...


1

Don't use update_usermeta, it is deprecated, update_user_meta is the one to use. You get the previously saved value out with get_user_meta. <input type='text' name='group[]' id='group[]' class="regular-text" value="<?php echo esc_attr( get_user_meta( $user->ID, 'group', true ) ); ?>" />


0

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 ...


1

You could do it this way (assumes that you know that all 3 images are there every time): <?php $headerimage_options = get_option( 'headerimage_options' ); $number = rand(1,3); if($number == 1) $number = ''; ?> <img title="<?php bloginfo( 'name' ); ?>" src="<?php echo esc_url( $headerimage_options['image' . $number] ); ...



Top 50 recent answers are included