WordPress.org

Plugin Directory

Changeset 492388


Ignore:
Timestamp:
01/19/12 22:15:11 (2 years ago)
Author:
goldenapples
Message:

Version 0.3.5; adds term archive capability, various bugfixes

Location:
recommended-links
Files:
1 deleted
3 edited
14 copied

Legend:

Unmodified
Added
Removed
  • recommended-links/tags/0.3.5/display-filters.php

    r492236 r492388  
    3434    } 
    3535 
     36    // if any taxonomies are enabled for recommended links post type (in plugin settings), they can be used to  
     37    // filter archive pages. If a taxonomy term is passed in query string, use that to modify the query 
     38 
     39    if ( $taxonomies = $plugin_settings['tax'] ) { 
     40        $tax_query = array(); 
     41        foreach ( $taxonomies as $tax => $on ) { 
     42            if ( isset( $_GET[ $tax ] ) ) 
     43                $tax_query[] = array( 
     44                    'taxonomy'  => $tax, 
     45                    'terms'     => (array)$_GET[ $tax ], 
     46                    'field'     => 'slug' 
     47                ); 
     48        } 
     49        $query->set( 'tax_query', $tax_query ); 
     50    } 
     51 
     52    // Sort order is determined by plugin defaults, and can be  
     53    // overriden by query parameter "reclinks_sort" or query string argument "sort" 
     54     
    3655    $sort_order = ( isset( $plugin_settings['sort_order'] ) ) ? $plugin_settings['sort_order'] : 'current'; 
    3756 
     
    91110} 
    92111 
    93 function gad_reclinks_votes_join_hot() { 
    94     return gad_reclinks_votes_join( '1 DAY' ); 
    95 } 
    96  
    97 function gad_reclinks_votes_join_current() { 
    98     return gad_reclinks_votes_join( '1 WEEK' ); 
     112function gad_reclinks_votes_join_hot( $join ) { 
     113    return $join . gad_reclinks_votes_join( '1 DAY' ); 
     114} 
     115 
     116function gad_reclinks_votes_join_current( $join ) { 
     117    return $join . gad_reclinks_votes_join( '1 WEEK' ); 
    99118} 
    100119 
     
    216235        return $content;     
    217236 
    218     global $wp_query; 
     237    global $wp_the_query, $wp_query; 
     238 
     239    if ( $wp_query !== $wp_the_query ) 
     240        return $content; 
    219241 
    220242    $links_paged = ( isset( $wp_query->query_vars['paged'] ) ) ? $wp_query->query_vars['paged'] : 1; 
     
    252274 
    253275    $wp_query = $old_query; 
     276    wp_reset_query(); 
     277 
    254278    return $content . $links_archive . $links_navigation; 
    255279 
  • recommended-links/tags/0.3.5/readme.txt

    r489905 r492388  
    55Requires at least: 3.2.1 
    66Tested up to: 3.3.1 
    7 Stable tag: 0.3.4 
     7Stable tag: 0.3.5 
    88 
    99A sort of "Reddit clone" that allows users to post links, up- or down-vote them, and comment on them. 
     
    24241. If you have permalinks enabled, the archive will be displayed at `http://yoursite.tld/reclinks`; otherwise it will be at `http://yoursite.tld?post_type=reclink`.  
    25251. The plugin tries to intelligently filter markup so that it can work with most themes out of the box. If the archive or single link display doesn't work in your theme, you may have to create an `archive-reclink.php` or `single-reclink.php` template file. _(See the FAQ for examples of markup for these template files)_. 
    26 1. See the "Frequently Asked Questions for questions on customizing the output or styling the plugin. 
     261. See the [plugin wiki](https://github.com/goldenapples/recommended-links/wiki) for troubleshooting and customization instructions. 
    2727 
    2828== Frequently Asked Questions == 
     
    6868 
    6969== Changelog == 
     70 
     71= 0.3.5 = 
     72 
     73I fixed term archives so that your recommended links archive page can be sorted by term; if you have categories enabled for links, try adding `?category=yourcategoryname` to the URL for your archive page. Also fixed issue with adding non-hierarchical taxonomies to reclinks, and fixed the loop on archive pages (reset the query after the recommended loops link) so that it doesn't mess up any secondary loops on the page. 
    7074 
    7175= 0.3.4 = 
     
    113117== Upgrade Notice == 
    114118 
     119= 0.3.5 = 
     120 
     121Fixed term archive pages; also fixed the loop on archive pages so it doesn't mess up any secondary loops on the page. 
     122 
    115123= 0.3.4 = 
    116124 
  • recommended-links/tags/0.3.5/recommended-links.php

    r492236 r492388  
    55Description: A "reddit clone" that runs in Wordpress. 
    66Author: Nathaniel Taintor 
    7 Version: 0.3.4 
     7Version: 0.3.5 
    88Author URI: http://goldenapplesdesign.com 
    99*/ 
     
    148148        return false; 
    149149 
    150     // See if any taxonomy terms were selected 
    151     $taxes = (isset( $reclinks['reclink_taxes'] ) ) ? 
    152         array_filter( $reclink['reclink_taxes'], 'empty_taxonomy' ) : null; 
    153150 
    154151    function empty_taxonomy( $t ) { 
     
    165162        'post_title'    => $reclink['reclink_title'], 
    166163        'post_content'  => $reclink['reclink_description'], 
    167         'post_status'   => 'publish', 
    168         'tax_input'     => $reclink['reclink_taxes'] 
     164        'post_status'   => 'publish' 
    169165    ) ); 
     166 
     167    // Set any taxonomy terms that were selected 
     168    if ( isset( $reclink['reclink_taxes'] ) ) 
     169        foreach ( $reclink['reclink_taxes'] as $tax => $terms ) { 
     170            $terms_array = array_map( 'intval', (array)$terms ); 
     171            $test = wp_set_object_terms( $link_ID, $terms_array, $tax ); 
     172            error_log( 'Setting terms on '.$link_ID.': '.print_r( $test ) ); 
     173        } 
    170174 
    171175    update_post_meta( $link_ID, '_href', $reclink['reclink_url'] ); 
  • recommended-links/trunk/display-filters.php

    r492236 r492388  
    3434    } 
    3535 
     36    // if any taxonomies are enabled for recommended links post type (in plugin settings), they can be used to  
     37    // filter archive pages. If a taxonomy term is passed in query string, use that to modify the query 
     38 
     39    if ( $taxonomies = $plugin_settings['tax'] ) { 
     40        $tax_query = array(); 
     41        foreach ( $taxonomies as $tax => $on ) { 
     42            if ( isset( $_GET[ $tax ] ) ) 
     43                $tax_query[] = array( 
     44                    'taxonomy'  => $tax, 
     45                    'terms'     => (array)$_GET[ $tax ], 
     46                    'field'     => 'slug' 
     47                ); 
     48        } 
     49        $query->set( 'tax_query', $tax_query ); 
     50    } 
     51 
     52    // Sort order is determined by plugin defaults, and can be  
     53    // overriden by query parameter "reclinks_sort" or query string argument "sort" 
     54     
    3655    $sort_order = ( isset( $plugin_settings['sort_order'] ) ) ? $plugin_settings['sort_order'] : 'current'; 
    3756 
     
    91110} 
    92111 
    93 function gad_reclinks_votes_join_hot() { 
    94     return gad_reclinks_votes_join( '1 DAY' ); 
    95 } 
    96  
    97 function gad_reclinks_votes_join_current() { 
    98     return gad_reclinks_votes_join( '1 WEEK' ); 
     112function gad_reclinks_votes_join_hot( $join ) { 
     113    return $join . gad_reclinks_votes_join( '1 DAY' ); 
     114} 
     115 
     116function gad_reclinks_votes_join_current( $join ) { 
     117    return $join . gad_reclinks_votes_join( '1 WEEK' ); 
    99118} 
    100119 
     
    216235        return $content;     
    217236 
    218     global $wp_query; 
     237    global $wp_the_query, $wp_query; 
     238 
     239    if ( $wp_query !== $wp_the_query ) 
     240        return $content; 
    219241 
    220242    $links_paged = ( isset( $wp_query->query_vars['paged'] ) ) ? $wp_query->query_vars['paged'] : 1; 
     
    252274 
    253275    $wp_query = $old_query; 
     276    wp_reset_query(); 
     277 
    254278    return $content . $links_archive . $links_navigation; 
    255279 
  • recommended-links/trunk/readme.txt

    r489905 r492388  
    55Requires at least: 3.2.1 
    66Tested up to: 3.3.1 
    7 Stable tag: 0.3.4 
     7Stable tag: 0.3.5 
    88 
    99A sort of "Reddit clone" that allows users to post links, up- or down-vote them, and comment on them. 
     
    24241. If you have permalinks enabled, the archive will be displayed at `http://yoursite.tld/reclinks`; otherwise it will be at `http://yoursite.tld?post_type=reclink`.  
    25251. The plugin tries to intelligently filter markup so that it can work with most themes out of the box. If the archive or single link display doesn't work in your theme, you may have to create an `archive-reclink.php` or `single-reclink.php` template file. _(See the FAQ for examples of markup for these template files)_. 
    26 1. See the "Frequently Asked Questions for questions on customizing the output or styling the plugin. 
     261. See the [plugin wiki](https://github.com/goldenapples/recommended-links/wiki) for troubleshooting and customization instructions. 
    2727 
    2828== Frequently Asked Questions == 
     
    6868 
    6969== Changelog == 
     70 
     71= 0.3.5 = 
     72 
     73I fixed term archives so that your recommended links archive page can be sorted by term; if you have categories enabled for links, try adding `?category=yourcategoryname` to the URL for your archive page. Also fixed issue with adding non-hierarchical taxonomies to reclinks, and fixed the loop on archive pages (reset the query after the recommended loops link) so that it doesn't mess up any secondary loops on the page. 
    7074 
    7175= 0.3.4 = 
     
    113117== Upgrade Notice == 
    114118 
     119= 0.3.5 = 
     120 
     121Fixed term archive pages; also fixed the loop on archive pages so it doesn't mess up any secondary loops on the page. 
     122 
    115123= 0.3.4 = 
    116124 
  • recommended-links/trunk/recommended-links.php

    r492236 r492388  
    55Description: A "reddit clone" that runs in Wordpress. 
    66Author: Nathaniel Taintor 
    7 Version: 0.3.4 
     7Version: 0.3.5 
    88Author URI: http://goldenapplesdesign.com 
    99*/ 
     
    148148        return false; 
    149149 
    150     // See if any taxonomy terms were selected 
    151     $taxes = (isset( $reclinks['reclink_taxes'] ) ) ? 
    152         array_filter( $reclink['reclink_taxes'], 'empty_taxonomy' ) : null; 
    153150 
    154151    function empty_taxonomy( $t ) { 
     
    165162        'post_title'    => $reclink['reclink_title'], 
    166163        'post_content'  => $reclink['reclink_description'], 
    167         'post_status'   => 'publish', 
    168         'tax_input'     => $reclink['reclink_taxes'] 
     164        'post_status'   => 'publish' 
    169165    ) ); 
     166 
     167    // Set any taxonomy terms that were selected 
     168    if ( isset( $reclink['reclink_taxes'] ) ) 
     169        foreach ( $reclink['reclink_taxes'] as $tax => $terms ) { 
     170            $terms_array = array_map( 'intval', (array)$terms ); 
     171            $test = wp_set_object_terms( $link_ID, $terms_array, $tax ); 
     172            error_log( 'Setting terms on '.$link_ID.': '.print_r( $test ) ); 
     173        } 
    170174 
    171175    update_post_meta( $link_ID, '_href', $reclink['reclink_url'] ); 
Note: See TracChangeset for help on using the changeset viewer.