WordPress.org

Ready to get started?Download WordPress

Forums

Drop down menu widget not working on mobiles (3 posts)

  1. vickym
    Member
    Posted 1 year ago #

    I am using a custom widget on a web page which is a dropdown menu to other pages on the site. It works fine on the desktop version (www.theoldstationnursery.co.uk), and on the most recent mobiles I have tested on, but it appears that on an iPhone for example, on anything previous to ios 5.0.1, the menu simply doesn't work. I can't work out what I need to change in order to make the links work, and I'd be really grateful for any help. This is the widget code used so far, so if anyone spots anything glaringly obvious, I'd be so grateful if they could point it out as I'm drawing a blank.

    class Widget_subpages_custom extends WP_Widget {
    
    	function Widget_subpages_custom() {
    		$widget_ops = array('description' => __( "Custom Subpages" ), 'classname' => 'widget-subpages_custom' );
    		$this->WP_Widget('subpages_custom', __('Custom Subpages Widget'), $widget_ops);
    	}
    
    	function widget($args, $instance) {
    		extract( $args );
    		$title = apply_filters('widget_title', empty($instance['title']) ? __('Custom Subpages Widget') : $instance['title']);
    		$title = esc_attr($instance['title']);
    		$page_id = esc_attr($instance['page_id']);
    		echo $before_widget;
    		query_posts( 'post_parent='.$page_id.'&post_type=page&posts_per_page=-1' );
    		if (have_posts()) : ?>
    			<h2><?php echo html_entity_decode($title); ?></h2>
    			<form class="" action="#">
    				<fieldset>
    					<select class="sel">
    						<option value="select-location">select a location</option>
    					<?php while (have_posts()) : the_post();?>
    						<option value="<?php the_permalink(); ?>"><?php the_title(); ?></option>
    					<?php endwhile; ?>
    					</select>
    				</fieldset>
    			</form>
    		<?php endif; ?>
    		<?php wp_reset_query();
    		echo $after_widget;
    	}
    
    	function update($new_instance, $old_instance) {
    		return $new_instance;
    	}
    
    	function form($instance) {
    		$title = esc_attr($instance['title']);
    		$page_id = esc_attr($instance['page_id']);
    		?>
    			<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
    
    			<p>
    			<label for="<?php echo $this->get_field_id('page_id'); ?>"><?php _e('Page ID:'); ?><br />
    				<input class="widefat" id="<?php echo $this->get_field_id('page_id'); ?>" name="<?php echo $this->get_field_name('page_id'); ?>" type="text" value="<?php echo $page_id; ?>" /></p>
    			</label>
    			</p>
    
    		<?php
    	}
    }
    
    add_action('widgets_init', create_function('', 'return register_widget("Widget_subpages_custom");'));

    Many thanks

    Vicky

  2. Andrew Bartel
    Member
    Posted 1 year ago #

    I appreciate your thoroughness, but what percent of your visitors are really running iOS 4.x? I'm sure it doesn't work on IE6 either.

  3. vickym
    Member
    Posted 1 year ago #

    Hi Andrew
    Thank you for replying. Sorry, I was misleading in what I wrote. It's not working on iOS 5 either - that's my real problem!
    Vicky

Topic Closed

This topic has been closed to new replies.

About this Topic