[ create a new paste ] login | about

Link: http://codepad.org/d2j1zHCP    [ raw code | output | fork ]

PHP, pasted on Feb 2:
#LOOP

<?php if($fix_name1) { ?>
<div id="tab1" class="tabber-content">
<ul>

<?php global $post; $recent = new WP_Query(array( 'post_type' => 'match', 'posts_per_page' => $fix_num1, 'tax_query' => array(array( 'taxonomy' => 'fixs_cat', 'field' => 'slug', 'terms' => $fix_cat1 ))  )); while($recent->have_posts()) : $recent->the_post();?>
						
<li>        
<?php endwhile; ?> 
</li>
</ul>
</div>
                 
<?php } ?>


#WIDGET ADMIN

/* Widget variables. */
        $fix_name1 = $instance['fix_name1'];
		$fix_cat1 = $instance['fix_cat1'];
		$fix_num1 = $instance['fix_num1'];


/* Strip tags (if needed) and update the widget settings. */
        $instance['fix_name1'] = strip_tags( $new_instance['fix_name1'] );
		$instance['fix_cat1'] = strip_tags( $new_instance['fix_cat1'] );
		$instance['fix_num1'] = strip_tags( $new_instance['fix_num1'] );


public function form( $instance ) {

		// TODO: Define default values for your variables
		$defaults = array( 'sort' => 'latest', '$fix_name1' => 10, '$fix_name2' => 10, '$fix_name3' => 10, '$fix_name4' => 10, '$fix_name5' => 10, 
			                                   '$fix_name6' => 10, '$fix_name7' => 10, '$fix_name8' => 10, '$fix_name9' => 10, '$fix_name10' => 10
		);
		$instance = wp_parse_args(
			(array) $instance
		);

#WIDGET PUBLIC

  <!-- Category Title 1 -->
		<p>
			<label for="<?php echo $this->get_field_id( 'fix_name1' ); ?>">Enter Category #1 Title:</label>
			<input id="<?php echo $this->get_field_id( 'fix_name1' ); ?>" name="<?php echo $this->get_field_name( 'fix_name1' ); ?>" value="<?php echo $instance['fix_name1']; ?>" style="width:90%;" />
		</p>

		<!-- Category Select 2 -->
		<p>
			<label for="<?php echo $this->get_field_id('fix_cat1'); ?>">Select Category #1:</label>
			<select id="<?php echo $this->get_field_id('fix_cat1'); ?>" name="<?php echo $this->get_field_name('fix_cat1'); ?>" style="width:100%;">
				<option value='all' <?php if ('all' == $instance['fix_cat1']) echo 'selected="selected"'; ?>>Select a category:</option>
				<?php $fixs = get_terms('fixs_cat'); ?>
				<?php foreach($fixs as $fix) { ?>
				<option value='<?php echo $fix->slug; ?>' <?php if ($fix->slug == $instance['fix_cat1']) echo 'selected="selected"'; ?>><?php echo $fix->slug; ?></option>
				<?php } ?>
			</select>
		</p>

		<!-- Enter Number of Fixtures to Display in Category 1-->

		<p>
			<label for="<?php echo $this->get_field_id('fix_num1'); ?>">Enter Number of Fixtures to show from Cat  #1:</label>
			<input id="<?php echo $this->get_field_id( 'fix_num1' ); ?>" name="<?php echo $this->get_field_name( 'fix_num1' ); ?>" value="<?php echo $instance['fix_num1']; ?>" style="width:30px" />
			
		</p>


Output:


#LOOP



#WIDGET ADMIN

/* Widget variables. */
        $fix_name1 = $instance['fix_name1'];
		$fix_cat1 = $instance['fix_cat1'];
		$fix_num1 = $instance['fix_num1'];


/* Strip tags (if needed) and update the widget settings. */
        $instance['fix_name1'] = strip_tags( $new_instance['fix_name1'] );
		$instance['fix_cat1'] = strip_tags( $new_instance['fix_cat1'] );
		$instance['fix_num1'] = strip_tags( $new_instance['fix_num1'] );


public function form( $instance ) {

		// TODO: Define default values for your variables
		$defaults = array( 'sort' => 'latest', '$fix_name1' => 10, '$fix_name2' => 10, '$fix_name3' => 10, '$fix_name4' => 10, '$fix_name5' => 10, 
			                                   '$fix_name6' => 10, '$fix_name7' => 10, '$fix_name8' => 10, '$fix_name9' => 10, '$fix_name10' => 10
		);
		$instance = wp_parse_args(
			(array) $instance
		);

#WIDGET PUBLIC

  <!-- Category Title 1 -->
		<p>
			<label for="
Fatal error: Using $this when not in object context on line 48


Create a new paste based on this one


Comments: