Plugin Directory

Changeset 1013021


Ignore:
Timestamp:
10/23/2014 06:52:22 PM (11 years ago)
Author:
danielauener
Message:

new language files sr_RS

Location:
simply-related-posts/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • simply-related-posts/trunk/readme.txt

    r707086 r1013021  
    44Tags: related posts, taxonomy, widget
    55Requires at least: 3.0.1
    6 Tested up to: 3.5
    7 Stable tag: 1.2
     6Tested up to: 4.0
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 A widget that simply gives you related posts by taxonomy. Four settings to 
     11A widget that simply gives you related posts by taxonomy. Four settings to
    1212customize the widget: title, taxonomy, related posts count, excludet terms
    1313
    1414== Description ==
    1515
    16 A widget that simply gives you related posts by taxonomy. It provides four 
    17 settings to customize every widget and there are no global settings to worry 
    18 about. 
     16A widget that simply gives you related posts by taxonomy. It provides four
     17settings to customize every widget and there are no global settings to worry
     18about.
    1919
    2020**Widget settings**
     
    4545
    4646Q. How to add thumbnail images to the related posts list
    47 A. You can add the 'simply_related_posts_title' filter, like 
     47A. You can add the 'simply_related_posts_title' filter, like
    4848`add_filter( 'simply_related_posts_title', 'my_related_posts', 10, 2);`
    4949The first argument is a post-object for the related post, the second argument
    50 is the widget instance. 
     50is the widget instance.
    5151
    5252
  • simply-related-posts/trunk/simply-related-posts.php

    r707086 r1013021  
    33     Plugin Name: Simply Related Posts
    44     Plugin URI: http://www.danielauener.com/simply-related-posts/
    5      Description: A widget that simply gives you related posts by taxonomy. 
    6      Version: 1.2
     5     Description: A widget that simply gives you related posts by taxonomy.
     6     Version: 1.3
    77     Author: @danielauener
    88     Author URI: http://www.danielauener.com
    99     */
    10      class SimplyRelatedPosts extends WP_Widget {               
     10     class SimplyRelatedPosts extends WP_Widget {
    1111
    1212
     
    1515               $widget_ops = array(
    1616                    'classname' => 'SimplyRelatedPosts',
    17                     'description' => __( 'Shows up when is_single() is true and contains 
     17                    'description' => __( 'Shows up when is_single() is true and contains
    1818                                      posts with one or more matching terms.' , 'simply-related-posts')
    1919               );
    2020               $this->WP_Widget( 'SimplyRelatedPosts', __( 'Simply Related Posts' , 'simply-related-posts'), $widget_ops );
    2121
    22                add_action( 'plugins_loaded', array( &$this , 'load_text_domain' ) );         
     22               add_action( 'init', array( $this , 'load_text_domain' ) );
    2323          }
    2424
    25          
    26           function load_text_domain() {
    2725
    28                $plugin_dir = "simply-related-posts/languages/";
    29                load_plugin_textdomain( 'simply-related-posts', false, $plugin_dir );
    30          
    31           }
     26          function load_text_domain() {
     27             load_plugin_textdomain( 'simply-related-posts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
     28          }
    3229
    33      
    3430          function form( $instance ) {
    3531
    3632               $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Related Posts' , 'simply-related-posts'), 'exclude' => '', 'taxonomy' => 'post_tag', 'post_type' => 'post', 'related_count' => '5' ) );
    3733               $title = $instance['title'];
    38                $post_type = $instance['post_type']; 
    39                $taxonomy = $instance['taxonomy']; 
     34               $post_type = $instance['post_type'];
     35               $taxonomy = $instance['taxonomy'];
    4036               $exclude = $instance['exclude'];
    4137               $related_count = $instance['related_count']; ?>
     
    4844                    <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>">
    4945                         <?php _e( 'Related by taxonomy' , 'simply-related-posts'); ?>: <select class="widefat" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>"><?php
    50                               $taxonomies = get_taxonomies( array( 'show_ui' => true ), 'objects' ); 
     46                              $taxonomies = get_taxonomies( array( 'show_ui' => true ), 'objects' );
    5147                              foreach ( $taxonomies as $slug => $tax ): ?>
    5248                                   <option value="<?php echo $slug; ?>" <?php echo ( $slug == $taxonomy ) ? 'selected="selected"' : ''; ?>><?php echo $tax->labels->name; ?></option><?php
    5349                              endforeach; ?>
    5450                         </select>
    55                     </label>               
     51                    </label>
    5652               </p>
    5753               <p>
    5854                    <label for="<?php echo $this->get_field_id( 'post_type' ); ?>">
    5955                         <?php _e( 'Related post-type' , 'simply-related-posts'); ?>: <select class="widefat" id="<?php echo $this->get_field_id( 'post_type' ); ?>" name="<?php echo $this->get_field_name( 'post_type' ); ?>"><?php
    60                               $post_types = get_post_types( array( 'show_ui' => true, 'public' => true ), 'objects', 'and' ); 
     56                              $post_types = get_post_types( array( 'show_ui' => true, 'public' => true ), 'objects', 'and' );
    6157                              foreach ( $post_types as $slug => $pt ): ?>
    6258                                   <option value="<?php echo $slug; ?>" <?php echo ( $slug == $post_type ) ? 'selected="selected"' : ''; ?>><?php echo $pt->labels->name; ?></option><?php
    6359                              endforeach; ?>
    6460                         </select>
    65                     </label>               
    66                </p>               
     61                    </label>
     62               </p>
    6763               <p>
    6864                    <label for="<?php echo $this->get_field_id( 'related_count' ); ?>">
    6965                         <?php _e( 'How many posts to show' , 'simply-related-posts'); ?>: <input class="widefat" id="<?php echo $this->get_field_id( 'related_count' ); ?>" name="<?php echo $this->get_field_name( 'related_count' ); ?>" type="text" value="<?php echo attribute_escape( $related_count ); ?>" />
    70                     </label>               
     66                    </label>
    7167               </p>
    7268               <p>
    7369                    <label for="<?php echo $this->get_field_id( 'exclude' ); ?>">
    7470                         <?php _e( 'Term ids to exclude (e.g 5,4,2)' , 'simply-related-posts'); ?>: <input class="widefat" id="<?php echo $this->get_field_id( 'exclude' ); ?>" name="<?php echo $this->get_field_name( 'exclude' ); ?>" type="text" value="<?php echo attribute_escape( $exclude ); ?>" />
    75                     </label>               
     71                    </label>
    7672               </p><?php
    7773
    7874          }
    79            
     75
    8076
    8177          function update( $new_instance, $old_instance ) {
     
    9086
    9187          }
    92            
     88
    9389
    9490          function widget( $args, $instance ) {
     
    10399               $taxonomy = ( $instance['taxonomy'] == "" ) ? 'post_tag' : $instance['taxonomy'];
    104100               $terms = wp_get_post_terms( get_the_ID(), $taxonomy, array( 'fields' => 'ids' ));
    105                
     101
    106102               $exclude = ( empty( $instance['exclude'] ) ) ? array() : explode( ',', $instance['exclude'] );
    107103               if ( count( ( $terms = array_diff( $terms, $exclude ) ) ) == 0 )
    108104                    return;
    109  
     105
    110106               $related_posts = get_posts( array(
    111107                    'tax_query' => array(
     
    115111                              'terms' => $terms,
    116112                              'operator' => 'IN'
    117                          )                               
     113                         )
    118114                    ),
    119115                    'post_type' => $post_type,
     
    143139
    144140          }
    145      
     141
    146142     }
    147143
Note: See TracChangeset for help on using the changeset viewer.