Skip to content

Instantly share code, notes, and snippets.

@wprs
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wprs/3ff22bd3e02312d6343a to your computer and use it in GitHub Desktop.
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/
<?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
Copy link
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