Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Override Summary value in WPRichSnippets Ranking Table add-on https://wprichsnippets.com/addons/ranking-table/
<?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;
}
@wprs

This comment has been minimized.

Copy link
Owner Author

wprs commented Jul 26, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.