Last active
August 29, 2015 14:25
-
-
Save wprs/3ff22bd3e02312d6343a to your computer and use it in GitHub Desktop.
Override Summary value in WPRichSnippets Ranking Table add-on https://wprichsnippets.com/addons/ranking-table/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('wprs_ranking_table_summary', 'my_custom_ranking_table_summary'); | |
/** | |
* Override Summary field value in WPRichSnippets Ranking Table add-on | |
* Author: Hesham Zebida | |
* URL: https://wprichsnippets.com/addons/ranking-table/ | |
* | |
* Here is 3 ways to do it. | |
* By default, this function returns raw Pros field value | |
* Note that you will need to uncomment lines of code to make it work | |
*/ | |
function my_custom_ranking_table_summary($summary) { | |
global $post, $wprs_prefix; | |
if ( ! function_exists( 'wprs_template' ) ) return; | |
$new_summary = ''; | |
/** | |
* You can use the wprs_template() funtion to get full Pros with markup | |
* uncomment the two lines below | |
*/ | |
// $template = wprs_template(); | |
// $new_summary = $template['pros']; | |
/** | |
* You can use output of [wprs-pros] shortcode to get full Pros with markup | |
* uncomment the line below | |
*/ | |
// if ( shortcode_exists( 'wprs-pros' ) ) $new_summary = do_shortcode( '[wprs-pros]' ); | |
/** | |
* You can display the raw Pros field value | |
*/ | |
$new_summary = get_post_meta( $post->ID, $wprs_prefix.'pros', true ); | |
return $new_summary; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code snippets is for the WPRichSnippets Ranking Table add-on, explaining how to override summary in ranking table.
Best fit for this code is in your theme's functions.php file, or a functionality plugin.