Untitled

Uploaded anonymously on April 22, 2013, 6:06 pm

     



  1. <?php
  2. /**
  3.  * Plugin Name: Scoreboard Widget
  4.  */
  5.  
  6. add_action( 'widgets_init', 'gd_scoreboard_load_widgets' );
  7.  
  8. function gd_scoreboard_load_widgets() {
  9.   register_widget( 'gd_scoreboard_widget' );
  10. }
  11.  
  12. class gd_scoreboard_widget extends WP_Widget {
  13.  
  14.   /**
  15.    * Widget setup.
  16.    */
  17.   function gd_scoreboard_widget() {
  18.     /* Widget settings. */
  19.     $widget_ops = array( 'classname' => 'gd_scoreboard_widget', 'description' => __('A scoreboard widget.', 'gd_scoreboard_widget') );
  20.  
  21.     /* Widget control settings. */
  22.     $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'gd_scoreboard_widget' );
  23.  
  24.     /* Create the widget. */
  25.     $this->WP_Widget( 'gd_scoreboard_widget', __('Gameday: Scoreboard Widget', 'gd_scoreboard_widget'), $widget_ops, $control_ops );
  26.   }
  27.  
  28.   /**
  29.    * How to display the widget on the screen.
  30.    */
  31.   function widget( $args, $instance ) {
  32.     extract( $args );
  33.  
  34.     /* Our variables from the widget settings. */
  35.     $score_name1 = $instance['score_name1'];
  36.     $score_cat1 = $instance['score_cat1'];
  37.     $score_name2 = $instance['score_name2'];
  38.     $score_cat2 = $instance['score_cat2'];
  39.     $score_name3 = $instance['score_name3'];
  40.     $score_cat3 = $instance['score_cat3'];
  41.     $score_name4 = $instance['score_name4'];
  42.     $score_cat4 = $instance['score_cat4'];
  43.     $score_name5 = $instance['score_name5'];
  44.     $score_cat5 = $instance['score_cat5'];
  45.     $score_name6 = $instance['score_name6'];
  46.     $score_cat6 = $instance['score_cat6'];
  47.     $score_name7 = $instance['score_name7'];
  48.     $score_cat7 = $instance['score_cat7'];
  49.     $score_name8 = $instance['score_name8'];
  50.     $score_cat8 = $instance['score_cat8'];
  51.  
  52.     ?>
  53.  
  54.       <div class="score-wrapper tabber-container">
  55.         <ul class="score-nav tabs">
  56.           <?php if($score_name1) { ?><li><a href="#tab1"><?php echo $score_name1; ?></a></li><?php } ?>
  57.           <?php if($score_name2) { ?><li><a href="#tab2"><?php echo $score_name2; ?></a></li><?php } ?>
  58.           <?php if($score_name3) { ?><li><a href="#tab3"><?php echo $score_name3; ?></a></li><?php } ?>
  59.           <?php if($score_name4) { ?><li><a href="#tab4"><?php echo $score_name4; ?></a></li><?php } ?>
  60.           <?php if($score_name5) { ?><li><a href="#tab5"><?php echo $score_name5; ?></a></li><?php } ?>
  61.           <?php if($score_name6) { ?><li><a href="#tab6"><?php echo $score_name6; ?></a></li><?php } ?>
  62.           <?php if($score_name7) { ?><li><a href="#tab7"><?php echo $score_name7; ?></a></li><?php } ?>
  63.           <?php if($score_name8) { ?><li><a href="#tab8"><?php echo $score_name8; ?></a></li><?php } ?>
  64.         </ul>
  65.         <?php if($score_name1) { ?>
  66.         <div id="tab1" class="carousel es-carousel es-carousel-wrapper tabber-content">
  67.           <ul class="score-list">
  68.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat1 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  69.             <li>
  70.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  71.               <div class="score-teams">
  72.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  73.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  74.               </div><!--score-teams-->
  75.               <div class="score-right">
  76.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  77.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  78.               </div><!--score-right-->
  79.             </li>
  80.             <?php endwhile; ?>
  81.           </ul><!--score-list-->
  82.         </div><!--tab1-->
  83.         <?php } ?>
  84.         <?php if($score_name2) { ?>
  85.         <div id="tab2" class="carousel es-carousel es-carousel-wrapper tabber-content">
  86.           <ul class="score-list">
  87.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat2 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  88.             <li>
  89.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  90.               <div class="score-teams">
  91.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  92.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  93.               </div><!--score-teams-->
  94.               <div class="score-right">
  95.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  96.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  97.               </div><!--score-right-->
  98.             </li>
  99.             <?php endwhile; ?>
  100.           </ul><!--score-list-->
  101.         </div><!--tab2-->
  102.         <?php } ?>
  103.         <?php if($score_name3) { ?>
  104.         <div id="tab3" class="carousel es-carousel es-carousel-wrapper tabber-content">
  105.           <ul class="score-list">
  106.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat3 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  107.             <li>
  108.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  109.               <div class="score-teams">
  110.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  111.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  112.               </div><!--score-teams-->
  113.               <div class="score-right">
  114.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  115.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  116.               </div><!--score-right-->
  117.             </li>
  118.             <?php endwhile; ?>
  119.           </ul><!--score-list-->
  120.         </div><!--tab2-->
  121.         <?php } ?>
  122.         <?php if($score_name4) { ?>
  123.         <div id="tab4" class="carousel es-carousel es-carousel-wrapper tabber-content">
  124.           <ul class="score-list">
  125.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat4 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  126.             <li>
  127.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  128.               <div class="score-teams">
  129.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  130.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  131.               </div><!--score-teams-->
  132.               <div class="score-right">
  133.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  134.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  135.               </div><!--score-right-->
  136.             </li>
  137.             <?php endwhile; ?>
  138.           </ul><!--score-list-->
  139.         </div><!--tab2-->
  140.         <?php } ?>
  141.         <?php if($score_name5) { ?>
  142.         <div id="tab5" class="carousel es-carousel es-carousel-wrapper tabber-content">
  143.           <ul class="score-list">
  144.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat5 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  145.             <li>
  146.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  147.               <div class="score-teams">
  148.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  149.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  150.               </div><!--score-teams-->
  151.               <div class="score-right">
  152.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  153.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  154.               </div><!--score-right-->
  155.             </li>
  156.             <?php endwhile; ?>
  157.           </ul><!--score-list-->
  158.         </div><!--tab2-->
  159.         <?php } ?>
  160.         <?php if($score_name6) { ?>
  161.         <div id="tab6" class="carousel es-carousel es-carousel-wrapper tabber-content">
  162.           <ul class="score-list">
  163.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat6 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  164.             <li>
  165.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  166.               <div class="score-teams">
  167.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  168.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  169.               </div><!--score-teams-->
  170.               <div class="score-right">
  171.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  172.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  173.               </div><!--score-right-->
  174.             </li>
  175.             <?php endwhile; ?>
  176.           </ul><!--score-list-->
  177.         </div><!--tab2-->
  178.         <?php } ?>
  179.         <?php if($score_name7) { ?>
  180.         <div id="tab7" class="carousel es-carousel es-carousel-wrapper tabber-content">
  181.           <ul class="score-list">
  182.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat7 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  183.             <li>
  184.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  185.               <div class="score-teams">
  186.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  187.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  188.               </div><!--score-teams-->
  189.               <div class="score-right">
  190.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  191.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  192.               </div><!--score-right-->
  193.             </li>
  194.             <?php endwhile; ?>
  195.           </ul><!--score-list-->
  196.         </div><!--tab2-->
  197.         <?php } ?>
  198.         <?php if($score_name8) { ?>
  199.         <div id="tab8" class="carousel es-carousel es-carousel-wrapper tabber-content">
  200.           <ul class="score-list">
  201.             <?php global $post; $recent = new WP_Query(array( 'post_type' => 'scoreboard', 'showposts' => '999', 'tax_query' => array(array( 'taxonomy' => 'scores_cat', 'field' => 'slug', 'terms' => $score_cat8 ))  )); while($recent->have_posts()) : $recent->the_post();?>
  202.             <li>
  203.               <span class="score-status"><?php echo get_post_meta($post->ID, "gd_status", true); ?></span>
  204.               <div class="score-teams">
  205.                 <?php echo get_post_meta($post->ID, "gd_away_team", true); ?><br />
  206.                 <?php echo get_post_meta($post->ID, "gd_home_team", true); ?>
  207.               </div><!--score-teams-->
  208.               <div class="score-right">
  209.                 <?php echo get_post_meta($post->ID, "gd_away_team_score", true); ?><br />
  210.                 <?php echo get_post_meta($post->ID, "gd_home_team_score", true); ?>
  211.               </div><!--score-right-->
  212.             </li>
  213.             <?php endwhile; ?>
  214.           </ul><!--score-list-->
  215.         </div><!--tab2-->
  216.         <?php } ?>
  217.       </div><!--score-wrapper-->
  218.  
  219.     <?php
  220.  
  221.   }
  222.  
  223.   /**
  224.    * Update the widget settings.
  225.    */
  226.   function update( $new_instance, $old_instance ) {
  227.     $instance = $old_instance;
  228.  
  229.     /* Strip tags for title and name to remove HTML (important for text inputs). */
  230.     $instance['score_name1'] = strip_tags( $new_instance['score_name1'] );
  231.     $instance['score_cat1'] = strip_tags( $new_instance['score_cat1'] );
  232.     $instance['score_name2'] = strip_tags( $new_instance['score_name2'] );
  233.     $instance['score_cat2'] = strip_tags( $new_instance['score_cat2'] );
  234.     $instance['score_name3'] = strip_tags( $new_instance['score_name3'] );
  235.     $instance['score_cat3'] = strip_tags( $new_instance['score_cat3'] );
  236.     $instance['score_name4'] = strip_tags( $new_instance['score_name4'] );
  237.     $instance['score_cat4'] = strip_tags( $new_instance['score_cat4'] );
  238.     $instance['score_name5'] = strip_tags( $new_instance['score_name5'] );
  239.     $instance['score_cat5'] = strip_tags( $new_instance['score_cat5'] );
  240.     $instance['score_name6'] = strip_tags( $new_instance['score_name6'] );
  241.     $instance['score_cat6'] = strip_tags( $new_instance['score_cat6'] );
  242.     $instance['score_name7'] = strip_tags( $new_instance['score_name7'] );
  243.     $instance['score_cat7'] = strip_tags( $new_instance['score_cat7'] );
  244.     $instance['score_name8'] = strip_tags( $new_instance['score_name8'] );
  245.     $instance['score_cat8'] = strip_tags( $new_instance['score_cat8'] );
  246.  
  247.  
  248.     return $instance;
  249.   }
  250.  
  251.  
  252.   function form( $instance ) {
  253.  
  254.     /* Set up some default widget settings. */
  255.     $instance = wp_parse_args( (array) $instance, $defaults ); ?>
  256.  
  257.     <!-- Category Name 1 -->
  258.     <p>
  259.       <label for="<?php echo $this->get_field_id( 'score_name1' ); ?>">Name of Category #1:</label>
  260.       <input id="<?php echo $this->get_field_id( 'score_name1' ); ?>" name="<?php echo $this->get_field_name( 'score_name1' ); ?>" value="<?php echo $instance['score_name1']; ?>" style="width:90%;" />
  261.     </p>
  262.  
  263.     <!-- Category Slug 1 -->
  264.     <p>
  265.       <label for="<?php echo $this->get_field_id('score_cat1'); ?>">Select Scoreboard Category #1:</label>
  266.       <select id="<?php echo $this->get_field_id('score_cat1'); ?>" name="<?php echo $this->get_field_name('score_cat1'); ?>" style="width:100%;">
  267.         <option value='all' <?php if ('all' == $instance['score_cat1']) echo 'selected="selected"'; ?>>Select a category:</option>
  268.         <?php $scores = get_terms('scores_cat'); ?>
  269.         <?php foreach($scores as $score) { ?>
  270.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat1']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  271.         <?php } ?>
  272.       </select>
  273.     </p>
  274.  
  275.     <!-- Category Name 2 -->
  276.     <p>
  277.       <label for="<?php echo $this->get_field_id( 'score_name2' ); ?>">Name of Category #2:</label>
  278.       <input id="<?php echo $this->get_field_id( 'score_name2' ); ?>" name="<?php echo $this->get_field_name( 'score_name2' ); ?>" value="<?php echo $instance['score_name2']; ?>" style="width:90%;" />
  279.     </p>
  280.  
  281.     <!-- Category Slug 2 -->
  282.     <p>
  283.       <label for="<?php echo $this->get_field_id('score_cat2'); ?>">Select Scoreboard Category #2:</label>
  284.       <select id="<?php echo $this->get_field_id('score_cat2'); ?>" name="<?php echo $this->get_field_name('score_cat2'); ?>" style="width:100%;">
  285.         <option value='all' <?php if ('all' == $instance['score_cat2']) echo 'selected="selected"'; ?>>Select a category:</option>
  286.         <?php $scores = get_terms('scores_cat'); ?>
  287.         <?php foreach($scores as $score) { ?>
  288.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat2']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  289.         <?php } ?>
  290.       </select>
  291.     </p>
  292.  
  293.     <!-- Category Name 3 -->
  294.     <p>
  295.       <label for="<?php echo $this->get_field_id( 'score_name3' ); ?>">Name of Category #3:</label>
  296.       <input id="<?php echo $this->get_field_id( 'score_name3' ); ?>" name="<?php echo $this->get_field_name( 'score_name3' ); ?>" value="<?php echo $instance['score_name3']; ?>" style="width:90%;" />
  297.     </p>
  298.  
  299.     <!-- Category Slug 3 -->
  300.     <p>
  301.       <label for="<?php echo $this->get_field_id('score_cat3'); ?>">Select Scoreboard Category #3:</label>
  302.       <select id="<?php echo $this->get_field_id('score_cat3'); ?>" name="<?php echo $this->get_field_name('score_cat3'); ?>" style="width:100%;">
  303.         <option value='all' <?php if ('all' == $instance['score_cat3']) echo 'selected="selected"'; ?>>Select a category:</option>
  304.         <?php $scores = get_terms('scores_cat'); ?>
  305.         <?php foreach($scores as $score) { ?>
  306.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat3']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  307.         <?php } ?>
  308.       </select>
  309.     </p>
  310.  
  311.     <!-- Category Name 4 -->
  312.     <p>
  313.       <label for="<?php echo $this->get_field_id( 'score_name4' ); ?>">Name of Category #4:</label>
  314.       <input id="<?php echo $this->get_field_id( 'score_name4' ); ?>" name="<?php echo $this->get_field_name( 'score_name4' ); ?>" value="<?php echo $instance['score_name4']; ?>" style="width:90%;" />
  315.     </p>
  316.  
  317.     <!-- Category Slug 4 -->
  318.     <p>
  319.       <label for="<?php echo $this->get_field_id('score_cat4'); ?>">Select Scoreboard Category #4:</label>
  320.       <select id="<?php echo $this->get_field_id('score_cat4'); ?>" name="<?php echo $this->get_field_name('score_cat4'); ?>" style="width:100%;">
  321.         <option value='all' <?php if ('all' == $instance['score_cat4']) echo 'selected="selected"'; ?>>Select a category:</option>
  322.         <?php $scores = get_terms('scores_cat'); ?>
  323.         <?php foreach($scores as $score) { ?>
  324.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat4']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  325.         <?php } ?>
  326.       </select>
  327.     </p>
  328.  
  329.     <!-- Category Name 5 -->
  330.     <p>
  331.       <label for="<?php echo $this->get_field_id( 'score_name5' ); ?>">Name of Category #5:</label>
  332.       <input id="<?php echo $this->get_field_id( 'score_name5' ); ?>" name="<?php echo $this->get_field_name( 'score_name5' ); ?>" value="<?php echo $instance['score_name5']; ?>" style="width:90%;" />
  333.     </p>
  334.  
  335.     <!-- Category Slug 5 -->
  336.     <p>
  337.       <label for="<?php echo $this->get_field_id('score_cat5'); ?>">Select Scoreboard Category #5:</label>
  338.       <select id="<?php echo $this->get_field_id('score_cat5'); ?>" name="<?php echo $this->get_field_name('score_cat5'); ?>" style="width:100%;">
  339.         <option value='all' <?php if ('all' == $instance['score_cat5']) echo 'selected="selected"'; ?>>Select a category:</option>
  340.         <?php $scores = get_terms('scores_cat'); ?>
  341.         <?php foreach($scores as $score) { ?>
  342.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat5']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  343.         <?php } ?>
  344.       </select>
  345.     </p>
  346.  
  347.     <!-- Category Name 6 -->
  348.     <p>
  349.       <label for="<?php echo $this->get_field_id( 'score_name6' ); ?>">Name of Category #6:</label>
  350.       <input id="<?php echo $this->get_field_id( 'score_name6' ); ?>" name="<?php echo $this->get_field_name( 'score_name6' ); ?>" value="<?php echo $instance['score_name6']; ?>" style="width:90%;" />
  351.     </p>
  352.  
  353.     <!-- Category Slug 6 -->
  354.     <p>
  355.       <label for="<?php echo $this->get_field_id('score_cat6'); ?>">Select Scoreboard Category #6:</label>
  356.       <select id="<?php echo $this->get_field_id('score_cat6'); ?>" name="<?php echo $this->get_field_name('score_cat6'); ?>" style="width:100%;">
  357.         <option value='all' <?php if ('all' == $instance['score_cat6']) echo 'selected="selected"'; ?>>Select a category:</option>
  358.         <?php $scores = get_terms('scores_cat'); ?>
  359.         <?php foreach($scores as $score) { ?>
  360.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat6']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  361.         <?php } ?>
  362.       </select>
  363.     </p>
  364.  
  365.     <!-- Category Name 7 -->
  366.     <p>
  367.       <label for="<?php echo $this->get_field_id( 'score_name7' ); ?>">Name of Category #7:</label>
  368.       <input id="<?php echo $this->get_field_id( 'score_name7' ); ?>" name="<?php echo $this->get_field_name( 'score_name7' ); ?>" value="<?php echo $instance['score_name7']; ?>" style="width:90%;" />
  369.     </p>
  370.  
  371.     <!-- Category Slug 7 -->
  372.     <p>
  373.       <label for="<?php echo $this->get_field_id('score_cat7'); ?>">Select Scoreboard Category #7:</label>
  374.       <select id="<?php echo $this->get_field_id('score_cat7'); ?>" name="<?php echo $this->get_field_name('score_cat7'); ?>" style="width:100%;">
  375.         <option value='all' <?php if ('all' == $instance['score_cat7']) echo 'selected="selected"'; ?>>Select a category:</option>
  376.         <?php $scores = get_terms('scores_cat'); ?>
  377.         <?php foreach($scores as $score) { ?>
  378.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat7']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  379.         <?php } ?>
  380.       </select>
  381.     </p>
  382.  
  383.     <!-- Category Name 8 -->
  384.     <p>
  385.       <label for="<?php echo $this->get_field_id( 'score_name8' ); ?>">Name of Category #8:</label>
  386.       <input id="<?php echo $this->get_field_id( 'score_name8' ); ?>" name="<?php echo $this->get_field_name( 'score_name8' ); ?>" value="<?php echo $instance['score_name8']; ?>" style="width:90%;" />
  387.     </p>
  388.  
  389.     <!-- Category Slug 8 -->
  390.     <p>
  391.       <label for="<?php echo $this->get_field_id('score_cat8'); ?>">Select Scoreboard Category #8:</label>
  392.       <select id="<?php echo $this->get_field_id('score_cat8'); ?>" name="<?php echo $this->get_field_name('score_cat8'); ?>" style="width:100%;">
  393.         <option value='all' <?php if ('all' == $instance['score_cat8']) echo 'selected="selected"'; ?>>Select a category:</option>
  394.         <?php $scores = get_terms('scores_cat'); ?>
  395.         <?php foreach($scores as $score) { ?>
  396.         <option value='<?php echo $score->slug; ?>' <?php if ($score->slug == $instance['score_cat8']) echo 'selected="selected"'; ?>><?php echo $score->slug; ?></option>
  397.         <?php } ?>
  398.       </select>
  399.     </p>
  400.  
  401.  
  402.   <?php
  403.   }
  404. }
  405.  
  406. ?>





blog comments powered by Disqus