I have a popup that loads on entry and want custom content specified within each post, specified by the shortcode [test rating=3]
, to be loaded in the popup (in this case 3
). Here is my php:
<?php
add_shortcode('test', 'test_function');
function test_function($atts){
global $post;
extract(shortcode_atts(array(
'rating' => '5'
), $atts));
return $rating;
}
?>
In the code for the entry popup if I use [test]
it doesn't pull the value of rating
specified per [test rating=3]
in the post (instead it just returns the default value 5
). How should this be done?