Plugin Directory

Changeset 601475


Ignore:
Timestamp:
09/20/2012 08:02:24 AM (14 years ago)
Author:
jubstuff
Message:

fixed posts not showing. Default image is shown

Location:
featured-post-with-thumbnail
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • featured-post-with-thumbnail/tags/1.5.2/index.php

    r588810 r601475  
    6262   ob_start();
    6363   ob_end_clean();
    64    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    65    $first_img = $matches [1] [0];
    66 
    67    if(empty($first_img)) { //Defines a default image
     64   $num_images = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
     65
     66   if($num_images > 0) {
     67       $first_img = $matches[1][0];
     68   } else {
    6869      $first_img = $featured_post_plugin_path . "images/default.gif";
    6970   }
     71
    7072   return $first_img;
    7173}       
     
    144146   
    145147    <ul id="yiw-featured-post">
     148<?php foreach($featured_posts as $post) :
     149setup_postdata($post);
     150?>
    146151       <li>
    147152           <a href="<?php the_permalink() ?>" class="featured-thumb">
     
    159164           </h4>
    160165       </li>
     166<?php endforeach; ?>
    161167    </ul>
    162168   
     
    263269function yiw_add_widget_script(){
    264270    global $featured_post_plugin_path;
    265     wp_enqueue_script('yiw_widget_script', $featured_post_plugin_path . 'js/yiw_widget_script.js');
     271    wp_enqueue_script('yiw_widget_script', $featured_post_plugin_path . 'js/yiw_widget_script.js',
     272        array('jquery'),
     273        false,
     274        true);
    266275}
    267276add_action('admin_head', 'yiw_add_widget_script');
  • featured-post-with-thumbnail/tags/1.5.2/readme.txt

    r588810 r601475  
    55Tags: Post, Posts, highlight, widget, thumbnail, Featured Post with Thumbnail, Featured Post, Post, highlighting best articles,
    66Requires at least: 2.8, PHP4 & PHP5
    7 Tested up to: 2.9
    8 Stable tag: 1.5.1
     7Tested up to: 3.4.2
     8Stable tag: 1.5.2
    99 
    1010A really simple way of putting featured posts on your website.
     
    5757== Changelog ==
    5858
     59= 1.5.2 =
     60* fixed: all featured posts are shown
     61* fixed: in a post without images the default one is shown
     62
    5963= 1.5.1 =
    6064
  • featured-post-with-thumbnail/tags/1.5.2/scripts/yiw-featured-post-widget.php

    r582086 r601475  
    77
    88
    9   /*
     9/*
    1010 * Aggiungiamo la nostra funzione al gancio widgets_init
    1111 * Add our function to widgets_init hook
     
    178178
    179179    private function showFeaturedOrCategory($instance) {
    180         echo '<p>';
     180        echo '<p id="yiw_featured_post_show">';
    181181        echo '<label for="' . $this->get_field_id('show') . '">' . _e("Featured or category?", YIW_TEXT_DOMAIN) . '</label>';
    182182        echo '<select id="' . $this->get_field_id('show') . '" name="' . $this->get_field_name('show') . '">';
     
    186186        echo '</p>';
    187187
    188         echo '<p>';
     188        echo '<p id="yiw_featured_post_category">';
    189189        echo '<label for="' . $this->get_field_id('category') . '">' . _e('Category', YIW_TEXT_DOMAIN) . '</label>';
    190190        echo '<select id="' . $this->get_field_id('category') . '" name="' . $this->get_field_name('category') . '">';
    191         $categories = get_categories($args);
     191        $categories = get_categories();
    192192        foreach ($categories as $c) {
    193193            echo '<option value="'. $c->cat_ID .'" ' . selected($instance['category'], $c->cat_ID) . '>'. $c->name .'</option>';
  • featured-post-with-thumbnail/trunk/index.php

    r588810 r601475  
    6262   ob_start();
    6363   ob_end_clean();
    64    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    65    $first_img = $matches [1] [0];
    66 
    67    if(empty($first_img)) { //Defines a default image
     64   $num_images = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
     65
     66   if($num_images > 0) {
     67       $first_img = $matches[1][0];
     68   } else {
    6869      $first_img = $featured_post_plugin_path . "images/default.gif";
    6970   }
     71
    7072   return $first_img;
    7173}       
     
    144146   
    145147    <ul id="yiw-featured-post">
     148<?php foreach($featured_posts as $post) :
     149setup_postdata($post);
     150?>
    146151       <li>
    147152           <a href="<?php the_permalink() ?>" class="featured-thumb">
     
    159164           </h4>
    160165       </li>
     166<?php endforeach; ?>
    161167    </ul>
    162168   
     
    263269function yiw_add_widget_script(){
    264270    global $featured_post_plugin_path;
    265     wp_enqueue_script('yiw_widget_script', $featured_post_plugin_path . 'js/yiw_widget_script.js');
     271    wp_enqueue_script('yiw_widget_script', $featured_post_plugin_path . 'js/yiw_widget_script.js',
     272        array('jquery'),
     273        false,
     274        true);
    266275}
    267276add_action('admin_head', 'yiw_add_widget_script');
  • featured-post-with-thumbnail/trunk/readme.txt

    r588810 r601475  
    55Tags: Post, Posts, highlight, widget, thumbnail, Featured Post with Thumbnail, Featured Post, Post, highlighting best articles,
    66Requires at least: 2.8, PHP4 & PHP5
    7 Tested up to: 2.9
    8 Stable tag: 1.5.1
     7Tested up to: 3.4.2
     8Stable tag: 1.5.2
    99 
    1010A really simple way of putting featured posts on your website.
     
    5757== Changelog ==
    5858
     59= 1.5.2 =
     60* fixed: all featured posts are shown
     61* fixed: in a post without images the default one is shown
     62
    5963= 1.5.1 =
    6064
  • featured-post-with-thumbnail/trunk/scripts/yiw-featured-post-widget.php

    r582086 r601475  
    77
    88
    9   /*
     9/*
    1010 * Aggiungiamo la nostra funzione al gancio widgets_init
    1111 * Add our function to widgets_init hook
     
    178178
    179179    private function showFeaturedOrCategory($instance) {
    180         echo '<p>';
     180        echo '<p id="yiw_featured_post_show">';
    181181        echo '<label for="' . $this->get_field_id('show') . '">' . _e("Featured or category?", YIW_TEXT_DOMAIN) . '</label>';
    182182        echo '<select id="' . $this->get_field_id('show') . '" name="' . $this->get_field_name('show') . '">';
     
    186186        echo '</p>';
    187187
    188         echo '<p>';
     188        echo '<p id="yiw_featured_post_category">';
    189189        echo '<label for="' . $this->get_field_id('category') . '">' . _e('Category', YIW_TEXT_DOMAIN) . '</label>';
    190190        echo '<select id="' . $this->get_field_id('category') . '" name="' . $this->get_field_name('category') . '">';
    191         $categories = get_categories($args);
     191        $categories = get_categories();
    192192        foreach ($categories as $c) {
    193193            echo '<option value="'. $c->cat_ID .'" ' . selected($instance['category'], $c->cat_ID) . '>'. $c->name .'</option>';
Note: See TracChangeset for help on using the changeset viewer.