Skip to content

Instantly share code, notes, and snippets.

View code-flow's full-sized avatar
😆
happy

Florian code-flow

😆
happy
View GitHub Profile
@code-flow
code-flow / my-shortcode-ranking-filter-comment-template.php
Last active August 29, 2015 13:56
Example WordPress plugin that shows the best comments based on the ratings for the WP-Comment Rating Plugin by WP-Buddy
<?php
/*
Plugin Name: My Shortcode Ranking Filter with comment template for WP-Comment Rating Plugin
Description: Displays the best comments with the template
*/
/*
* IMPORTANT: Only works for PHP >= 5.3 AND WP-Comment Rating >= 1.3
*/
@code-flow
code-flow / my-shortcode-ranking-filter.php
Last active August 29, 2015 13:56
Example WordPress plugin to hook into the 'wpbcr_shortcode_best_comments_sql' filter of the WP-Comment Rating Plugin by WP-Buddy
<?php
/*
Plugin Name: My Shortcode Ranking Filter for WP-Comment Rating Plugin
Description: Hooks into the sql filter of the WP-Comment-Rating and allows the usage of the shortcode like this: [wpbcr_comment_ranking do="filter_by_xy_meta"]
*/
add_filter( 'wpbcr_shortcode_best_comments_sql', 'my_wpbcr_shortcode_best_comments_sql', 10, 6 );
/**
@code-flow
code-flow / my-add-stars-to-comments.php
Last active August 29, 2015 13:56
Adds a star to WordPress comments (using the WP-Comment-Rating Plugin) that have more than 5 upvotes.
<?php
/*
Plugin Name: Add stars to comments
Description: Adds stars to comments when comment gets 10 up-votes
*/
add_filter( 'wpbcr_output_elements', 'my_wpbcr_output_elements', 10, 2 );
function my_wpbcr_output_elements( $elements, $comment ) {