예제 #1
0
    function form($instance)
    {
        /* Set the default values  */
        $defaults = array('title' => '', 'posts_number1' => '3', 'posts_number2' => '3', 'posts_number3' => '3');
        $instance = wp_parse_args((array) $instance, $defaults);
        $valuesCategories = pego_get_all_categories();
        $valuesFormat = array('image', 'gallery', 'video', 'audio', 'standard');
        $valuesType = array('Type#1', 'Type#2');
        ?>

		<label for="<?php 
        echo $this->get_field_id('title1');
        ?>
">
		<?php 
        _e('Tab#1 - Title:', 'meganews');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('title1');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('title1');
        ?>
" 
				 value="<?php 
        echo $instance['title1'];
        ?>
" />
		</label>
																													
		<label for="<?php 
        echo $this->get_field_id('posts_number1');
        ?>
">
		<?php 
        _e('Tab#1 - Number of posts:', 'meganews');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('posts_number1');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('posts_number1');
        ?>
" 
				 value="<?php 
        echo $instance['posts_number1'];
        ?>
" />
		</label>

	<?php 
        if ($valuesCategories) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('category_select1');
            ?>
">
        <?php 
            _e('Tab #1 - Category (if none is choosen, all will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('category_select1');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('category_select1');
            ?>
"
                class="widefat">
                <option value="">Select Category</option>
          <?php 
            foreach ($valuesCategories as $value) {
                ?>
                <option <?php 
                if ($instance['category_select1'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesFormat) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('format_select1');
            ?>
">
        <?php 
            _e('Tab #1 - Format (if none is choosen, all will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('format_select1');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('format_select1');
            ?>
"
                class="widefat">
                <option value="">Select Format</option>
          <?php 
            foreach ($valuesFormat as $value) {
                ?>
                <option <?php 
                if ($instance['format_select1'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesType) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('type_select1');
            ?>
">
        <?php 
            _e('Tab #1 - Showing Type (if none is choosen, Type#1 will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('type_select1');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('type_select1');
            ?>
"
                class="widefat">
                <option value="">Select Type</option>
          <?php 
            foreach ($valuesType as $value) {
                ?>
                <option <?php 
                if ($instance['type_select1'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		
		
		<label for="<?php 
        echo $this->get_field_id('title2');
        ?>
">
		<?php 
        _e('Tab#2 - Title:', 'meganews');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('title2');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('title2');
        ?>
" 
				 value="<?php 
        echo $instance['title2'];
        ?>
" />
		</label>
																													
		<label for="<?php 
        echo $this->get_field_id('posts_number2');
        ?>
">
		<?php 
        _e('Tab#2 - Number of posts:', 'meganews');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('posts_number2');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('posts_number2');
        ?>
" 
				 value="<?php 
        echo $instance['posts_number2'];
        ?>
" />
		</label>

	<?php 
        if ($valuesCategories) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('category_select2');
            ?>
">
        <?php 
            _e('Tab #2 - Category (if none is choosen, all will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('category_select2');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('category_select2');
            ?>
"
                class="widefat">
                <option value="">Select Category</option>
          <?php 
            foreach ($valuesCategories as $value) {
                ?>
                <option <?php 
                if ($instance['category_select2'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesFormat) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('format_select2');
            ?>
">
        <?php 
            _e('Tab #2 - Format (if none is choosen, all will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('format_select2');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('format_select2');
            ?>
"
                class="widefat">
                <option value="">Select Format</option>
          <?php 
            foreach ($valuesFormat as $value) {
                ?>
                <option <?php 
                if ($instance['format_select2'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesType) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('type_select2');
            ?>
">
        <?php 
            _e('Tab #2 - Showing Type (if none is choosen, Type#2 will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('type_select2');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('type_select2');
            ?>
"
                class="widefat">
                <option value="">Select Type</option>
          <?php 
            foreach ($valuesType as $value) {
                ?>
                <option <?php 
                if ($instance['type_select2'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		
				<label for="<?php 
        echo $this->get_field_id('title3');
        ?>
">
		<?php 
        _e('Tab#3 - Title:', 'meganews');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('title3');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('title3');
        ?>
" 
				 value="<?php 
        echo $instance['title3'];
        ?>
" />
		</label>
																													
		<label for="<?php 
        echo $this->get_field_id('posts_number3');
        ?>
">
		<?php 
        _e('Tab#3 - Number of posts:', 'meganews');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('posts_number3');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('posts_number3');
        ?>
" 
				 value="<?php 
        echo $instance['posts_number3'];
        ?>
" />
		</label>

	<?php 
        if ($valuesCategories) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('category_select3');
            ?>
">
        <?php 
            _e('Tab #3 - Category (if none is choosen, all will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('category_select3');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('category_select3');
            ?>
"
                class="widefat">
                <option value="">Select Category</option>
          <?php 
            foreach ($valuesCategories as $value) {
                ?>
                <option <?php 
                if ($instance['category_select3'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesFormat) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('format_select3');
            ?>
">
        <?php 
            _e('Tab #3 - Format (if none is choosen, all will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('format_select3');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('format_select3');
            ?>
"
                class="widefat">
                <option value="">Select Format</option>
          <?php 
            foreach ($valuesFormat as $value) {
                ?>
                <option <?php 
                if ($instance['format_select3'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesType) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('type_select3');
            ?>
">
        <?php 
            _e('Tab #3 - Showing Type (if none is choosen, Type#3 will be taken):', 'meganews');
            ?>
          <select name="<?php 
            echo $this->get_field_name('type_select3');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('type_select3');
            ?>
"
                class="widefat">
                <option value="">Select Type</option>
          <?php 
            foreach ($valuesType as $value) {
                ?>
                <option <?php 
                if ($instance['type_select3'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
			
	<?php 
    }
예제 #2
0
파일: map.php 프로젝트: ImtiH/BAPWD
// get all testimonials
$allTests = pego_get_all_test();
$list_testimonials = '';
$number_of_testimonials_item = count($allTests);
$current = 0;
if ($allTests) {
    foreach ($allTests as $value) {
        $current++;
        if ($current == $number_of_testimonials_item) {
            $list_testimonials .= " and " . $value;
        } else {
            $list_testimonials .= $value . ", ";
        }
    }
}
$allCategoriesList = pego_get_all_categories();
$list_cats = '';
$number_of_cats_item = count($allCategoriesList);
$current1 = 0;
if ($allCategoriesList) {
    foreach ($allCategoriesList as $value) {
        $current1++;
        if ($current1 == $number_of_cats_item) {
            $list_cats .= $value;
        } else {
            $list_cats .= $value . ", ";
        }
    }
}
$allIcons4 = array(__("None", "meganews") => "none", "" => "icon-plus", __("Alarm clock icon", "meganews") => "wpb_alarm_clock", __("Anchor icon", "meganews") => "wpb_anchor", __("Application Image icon", "meganews") => "wpb_application_image", __("Arrow icon", "meganews") => "wpb_arrow", __("Asterisk icon", "meganews") => "wpb_asterisk", __("Hammer icon", "meganews") => "wpb_hammer", __("Balloon icon", "meganews") => "wpb_balloon", __("Balloon Buzz icon", "meganews") => "wpb_balloon_buzz", __("Balloon Facebook icon", "meganews") => "wpb_balloon_facebook", __("Balloon Twitter icon", "meganews") => "wpb_balloon_twitter", __("Battery icon", "meganews") => "wpb_battery", __("Binocular icon", "meganews") => "wpb_binocular", __("Document Excel icon", "meganews") => "wpb_document_excel", __("Document Image icon", "meganews") => "wpb_document_image", __("Document Music icon", "meganews") => "wpb_document_music", __("Document Office icon", "meganews") => "wpb_document_office", __("Document PDF icon", "meganews") => "wpb_document_pdf", __("Document Powerpoint icon", "meganews") => "wpb_document_powerpoint", __("Document Word icon", "meganews") => "wpb_document_word", __("Bookmark icon", "meganews") => "wpb_bookmark", __("Camcorder icon", "meganews") => "wpb_camcorder", __("Camera icon", "meganews") => "wpb_camera", __("Chart icon", "meganews") => "wpb_chart", __("Chart pie icon", "meganews") => "wpb_chart_pie", __("Clock icon", "meganews") => "wpb_clock", __("Fire icon", "meganews") => "wpb_fire", __("Heart icon", "meganews") => "wpb_heart", __("Mail icon", "meganews") => "wpb_mail", __("Play icon", "meganews") => "wpb_play", __("Shield icon", "meganews") => "wpb_shield", __("Video icon", "meganews") => "wpb_video");
$argsPosts = array('post_type' => 'post', 'posts_per_page' => -1, 'order' => 'DESC', 'orderby' => 'post_date');
예제 #3
0
 function post_section_sh($atts, $content = null)
 {
     extract(shortcode_atts(array('post_section_type' => '', 'postposition1' => '', 'postposition2' => '', 'postposition3' => '', 'postposition4' => '', 'postposition5' => '', 'postposition6' => '', 'postposition7' => '', 'postposition8' => '', 'background_color' => '', 'categories' => '', 'postfill' => 'latest', 'grid_teasers_offset' => '', 'cat' => '', 'css_animation' => '', 'type6_index' => '', 'format' => '', 'height' => '300', 'margins' => ''), $atts));
     //$data = get_option(OPTIONS);
     $dateFormat = get_option('date_format');
     $postsNeeded = array();
     $offset_number = 0;
     $numberOfItemsToRead = 8;
     if ($grid_teasers_offset != '') {
         $offset_number = $grid_teasers_offset - 1;
         $numberOfItemsToRead = $numberOfItemsToRead + $grid_teasers_offset + 1;
     }
     $extracss = '';
     if ($height != '' || $background_color != '') {
         $extracss = ' style = " ';
         if ($background_color != '') {
             $extracss .= ' background: ' . $background_color . '; padding: 20px; ';
         }
         if ($height != '') {
             $extracss .= ' height: ' . $height . 'px; ';
         }
         $extracss .= ' " ';
     }
     $pb20 = '';
     $pr20 = '';
     $pb10 = '';
     $pt10 = '';
     $pl10 = '';
     $pr10 = '';
     if ($margins != '') {
         $pb20 = ' pb20';
         $pr20 = ' pr20';
         $pb10 = ' pb10';
         $pt10 = ' pt10';
         $pl10 = ' pl10';
         $pr10 = ' pr10';
     }
     if ($postfill == 'latest') {
         $allCategories = pego_get_all_categories();
         $key = array_search($categories, $allCategories);
         $valuesFormat = array('', 'image', 'gallery', 'video', 'audio', 'standard');
         if ($key != '') {
             if ($format != '') {
                 $argsPosts = array('post_type' => 'post', 'posts_per_page' => 8, 'order' => 'DESC', 'orderby' => 'post_date', 'cat' => $key, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-' . $format))));
             } else {
                 $argsPosts = array('post_type' => 'post', 'posts_per_page' => 8, 'order' => 'DESC', 'orderby' => 'post_date', 'cat' => $key);
             }
         } else {
             if ($format != '') {
                 $argsPosts = array('post_type' => 'post', 'offset' => $offset_number, 'posts_per_page' => $numberOfItemsToRead, 'order' => 'DESC', 'orderby' => 'post_date', 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-' . $format))));
             } else {
                 $argsPosts = array('post_type' => 'post', 'offset' => $offset_number, 'posts_per_page' => $numberOfItemsToRead, 'order' => 'DESC', 'orderby' => 'post_date');
             }
         }
         $postsPosts = get_posts($argsPosts);
         $counter = 0;
         foreach ($postsPosts as $postsPost) {
             $postsNeeded[$counter]['id'] = $postsPost->ID;
             $postsNeeded[$counter]['format'] = get_post_format($postsPost->ID);
             $postsNeeded[$counter]['title'] = $postsPost->post_title;
             $postsNeeded[$counter]['date'] = get_the_date($dateFormat, $postsPost->ID);
             $postsNeeded[$counter]['permalink'] = get_permalink($postsPost->ID);
             $postsNeeded[$counter]['average_rate'] = "";
             $postsNeeded[$counter]['PostSection1'] = wp_get_attachment_image(get_post_thumbnail_id($postsPost->ID), 'PostSection1');
             $postsNeeded[$counter]['image_src'] = wp_get_attachment_image_src(get_post_thumbnail_id($postsPost->ID), 'full');
             $postsNeeded[$counter]['post_alternative_cat_tag'] = get_post_meta($postsPost->ID, 'post_alternative_cat_tag', true);
             $postsNeeded[$counter]['post_tag_new'] = get_post_meta($postsPost->ID, 'post_tag_new', true);
             $post_categories = wp_get_post_categories($postsPost->ID);
             if ($post_categories) {
                 $cats = array();
                 foreach ($post_categories as $c) {
                     $cat = get_category($c);
                     $cats[] = array('id' => $cat->cat_ID, 'name' => $cat->name);
                     if ($cat->category_parent == 0) {
                     } else {
                         $cats[0] = array('id' => $cat->cat_ID, 'name' => $cat->name);
                     }
                 }
                 $postsNeeded[$counter]['cats'] = $cats;
                 $postsNeeded[$counter]['cat_id'] = $cats[0]['id'];
                 $postsNeeded[$counter]['cat_name'] = $cats[0]['name'];
                 $postsNeeded[$counter]['cat_link'] = get_category_link($cats[0]['id']);
             } else {
                 $postsNeeded[$counter]['cat_id'] = '';
                 $postsNeeded[$counter]['cat_name'] = '';
                 $postsNeeded[$counter]['cat_link'] = '';
             }
             $counter++;
         }
     }
     $output = '';
     $post_section_type = 'type1';
     if ($post_section_type == 'type1') {
         $output .= '<div class="post-section-wrapper post-section-height wpb_content_element1"' . $extracss . '>';
         $output .= '<div class="post-section-single post-section-hover fullheight post-section-width6' . $pr20 . '">';
         $output .= '<div class="post-section-inner">';
         $output .= ' <a class="entire-post" title="' . $postsNeeded[0]['title'] . '" href="' . $postsNeeded[0]['permalink'] . '">';
         $output .= '<div class="post-thumb-class" style="background-image: url(' . $postsNeeded[0]['image_src'][0] . '); ">';
         $output .= '</div>';
         $output .= '</a>';
         $output .= '<div class="post-tags big-tags">';
         $output .= '<a title="' . $postsNeeded[0]['title'] . '" href="' . $postsNeeded[0]['permalink'] . '" class="url-wrapper-absolute"></a>';
         foreach ($postsNeeded[0]['cats'] as $single_cat) {
             $catlink = get_category_link($single_cat['id']);
             $output .= '<a  href="' . $catlink . '" title="' . esc_attr($single_cat['name']) . '" class="cat-url post_cat_tag fl category-bg-color-' . $single_cat['id'] . '">';
             $output .= esc_html($single_cat['name']);
             $output .= '</a>';
         }
         $output .= '</div>';
         $output .= '<a class="post-section-title post-secton-post-title-big" href="' . $postsNeeded[0]['permalink'] . '" title="' . $postsNeeded[0]['title'] . '"><h1>' . $postsNeeded[0]['title'] . '</h1></a>';
         $output .= '</div>';
         $output .= '</div>';
         $output .= '<div class="post-section-width4 fullheight fullheight1">';
         $output .= '<div class="small1 post-section-single halfheight post-section-hover' . $pb10 . $pr20 . '">';
         $output .= '<div class="post-section-inner">';
         $output .= ' <a class="entire-post" title="' . $postsNeeded[1]['title'] . '" href="' . $postsNeeded[1]['permalink'] . '">';
         $output .= '<div class="post-thumb-class" style="background-image: url(' . $postsNeeded[1]['image_src'][0] . '); ">';
         $output .= '</div>';
         $output .= '</a>';
         $output .= '<div class="post-tags big-tags">';
         $output .= '<a title="' . $postsNeeded[1]['title'] . '" href="' . $postsNeeded[1]['permalink'] . '" class="url-wrapper-absolute"></a>';
         foreach ($postsNeeded[1]['cats'] as $single_cat) {
             $catlink = get_category_link($single_cat['id']);
             $output .= '<a  href="' . $catlink . '" title="' . esc_attr($single_cat['name']) . '" class="cat-url post_cat_tag fl category-bg-color-' . $single_cat['id'] . '">';
             $output .= esc_html($single_cat['name']);
             $output .= '</a>';
         }
         $output .= '</div>';
         $output .= '<a class="post-section-title post-secton-post-title-small" href="' . $postsNeeded[1]['permalink'] . '" title="' . $postsNeeded[1]['title'] . '"><h1>' . $postsNeeded[1]['title'] . '</h1></a>';
         $output .= '</div>';
         $output .= '</div>';
         $output .= '<div class="small1 post-section-single halfheight post-section-hover' . $pr20 . $pt10 . '">';
         $output .= '<div class="post-section-inner">';
         $output .= ' <a class="entire-post" title="' . $postsNeeded[2]['title'] . '" href="' . $postsNeeded[2]['permalink'] . '">';
         $output .= '<div class="post-thumb-class" style="background-image: url(' . $postsNeeded[2]['image_src'][0] . '); ">';
         $output .= '</div>';
         $output .= '</a>';
         $output .= '<div class="post-tags big-tags">';
         $output .= '<a title="' . $postsNeeded[2]['title'] . '" href="' . $postsNeeded[2]['permalink'] . '" class="url-wrapper-absolute"></a>';
         foreach ($postsNeeded[2]['cats'] as $single_cat) {
             $catlink = get_category_link($single_cat['id']);
             $output .= '<a  href="' . $catlink . '" title="' . esc_attr($single_cat['name']) . '" class="cat-url post_cat_tag fl category-bg-color-' . $single_cat['id'] . '">';
             $output .= esc_html($single_cat['name']);
             $output .= '</a>';
         }
         $output .= '</div>';
         $output .= '<a class="post-section-title post-secton-post-title-small" href="' . $postsNeeded[2]['permalink'] . '" title="' . $postsNeeded[2]['title'] . '"><h1>' . $postsNeeded[2]['title'] . '</h1></a>';
         $output .= '</div>';
         $output .= '</div>';
         $output .= '</div>';
         $output .= '<div class="post-section-single post-section-hover fullheight post-section-width2">';
         $output .= '<div class="post-section-inner">';
         $output .= ' <a class="entire-post" title="' . $postsNeeded[3]['title'] . '" href="' . $postsNeeded[3]['permalink'] . '">';
         $output .= '<div class="post-thumb-class" style="background-image: url(' . $postsNeeded[3]['image_src'][0] . '); ">';
         $output .= '</div>';
         $output .= '</a>';
         $output .= '<div class="post-tags big-tags">';
         $output .= '<a title="' . $postsNeeded[3]['title'] . '" href="' . $postsNeeded[3]['permalink'] . '" class="url-wrapper-absolute"></a>';
         foreach ($postsNeeded[3]['cats'] as $single_cat) {
             $catlink = get_category_link($single_cat['id']);
             $output .= '<a  href="' . $catlink . '" title="' . esc_attr($single_cat['name']) . '" class="cat-url post_cat_tag fl category-bg-color-' . $single_cat['id'] . '">';
             $output .= esc_html($single_cat['name']);
             $output .= '</a>';
         }
         $output .= '</div>';
         $output .= '<a class="post-section-title post-secton-post-title-small" href="' . $postsNeeded[3]['permalink'] . '" title="' . $postsNeeded[3]['title'] . '"><h1>' . $postsNeeded[3]['title'] . '</h1></a>';
         $output .= '</div>';
         $output .= '</div>';
         $output .= '<div class="clear"></div>';
         $output .= '</div>';
     }
     return $output;
 }
예제 #4
0
    function form($instance)
    {
        /* Set the default values  */
        $defaults = array('title' => 'Post Widget', 'posts_number' => '3');
        $instance = wp_parse_args((array) $instance, $defaults);
        $valuesCategories = pego_get_all_categories();
        $valuesFormat = array('image', 'gallery', 'video', 'audio', 'standard');
        $valuesType = array('Type#1', 'Type#2');
        $valuesOrderBy = array('date', 'title', 'modified', 'comment_count');
        //$valuesOrderBy = array('date', 'title', 'modified');
        $valuesOrder = array('DESC', 'ASC');
        ?>

		<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
		<?php 
        _e('Title:', 'paulblack');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('title');
        ?>
" 
				 value="<?php 
        echo $instance['title'];
        ?>
" />
		</label>
																													
		<label for="<?php 
        echo $this->get_field_id('posts_number');
        ?>
">
		<?php 
        _e('Number of posts:', 'paulblack');
        ?>
		<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('posts_number');
        ?>
" 
				 name="<?php 
        echo $this->get_field_name('posts_number');
        ?>
" 
				 value="<?php 
        echo $instance['posts_number'];
        ?>
" />
		</label>

	<?php 
        if ($valuesCategories) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('category_select');
            ?>
">
        <?php 
            _e('Category (if none is choosen, all will be taken):', 'paulblack');
            ?>
          <select name="<?php 
            echo $this->get_field_name('category_select');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('category_select');
            ?>
"
                class="widefat">
                <option value="">Select Category</option>
          <?php 
            foreach ($valuesCategories as $value) {
                ?>
                <option <?php 
                if ($instance['category_select'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesFormat) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('format_select');
            ?>
">
        <?php 
            _e('Format (if none is choosen, all will be taken):', 'paulblack');
            ?>
          <select name="<?php 
            echo $this->get_field_name('format_select');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('format_select');
            ?>
"
                class="widefat">
                <option value="">Select Format</option>
          <?php 
            foreach ($valuesFormat as $value) {
                ?>
                <option <?php 
                if ($instance['format_select'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesOrderBy) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('order_select');
            ?>
">
        <?php 
            _e('Order by:', 'paulblack');
            ?>
          <select name="<?php 
            echo $this->get_field_name('order_select');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('order_select');
            ?>
"
                class="widefat">
               
          <?php 
            foreach ($valuesOrderBy as $value) {
                ?>
                <option <?php 
                if ($instance['order_select'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		<?php 
        if ($valuesOrder) {
            ?>
		<label for="<?php 
            echo $this->get_field_id('order_direction_select');
            ?>
">
        <?php 
            _e('Order direction:', 'paulblack');
            ?>
          <select name="<?php 
            echo $this->get_field_name('order_direction_select');
            ?>
" 
                  id="<?php 
            echo $this->get_field_id('order_direction_select');
            ?>
"
                class="widefat">
               
          <?php 
            foreach ($valuesOrder as $value) {
                ?>
                <option <?php 
                if ($instance['order_direction_select'] == $value) {
                    echo 'selected="selected"';
                }
                ?>
   value="<?php 
                echo $value;
                ?>
"><?php 
                echo $value;
                ?>
</option>
              <?php 
            }
            ?>
          </select> 
        </label>
		<?php 
        }
        ?>
		
			
	<?php 
    }