So, I wrote a plugin that adds a paypal button after the content of a custom post type. Is there a way to filter the_content so that the plugin is only added on custom post types?
This is what I have now:
The problem is, when there is no paypal link, none of the content shows up... Driving me crazy.PHP Code:function add_some_stuff($content) {
global $shortname;
if (get_post_type() == 'the_store' ) {
$display = get_post_custom_values('thestore_display');
if($display[0]){
$item_name = the_title('', '', false);
$shopping_url = get_permalink();
$item_number = get_the_ID();
$amount = get_post_custom_values('thestore_price');
$amount = $amount[0];
$shipping = get_post_custom_values('thestore_shipping');
$shipping = $shipping[0];
$shipping2 = get_post_custom_values('thestore_shipping2');
$shipping2 = $shipping2[0];
$business = get_option($shortname.'_paypal');
$handling = get_post_custom_values($shortname.'_handling');
$handling = $handling[0];
$currency = get_post_custom_values('thestore_currency');
$currency = $currency[0];
$paypal = <<<PAYPAL
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="$business">
<input type="hidden" name="item_name" value="$item_name">
<input type="hidden" name="shopping_url" value="$shopping_url">
<input type="hidden" name="item_number" value="$item_number">
<input type="hidden" name="amount" value="$amount">
<input type="hidden" name="currency_code" value="$currency">
<input type="hidden" name="shipping" value="$shipping">
<input type="hidden" name="shipping2" value="$shipping2">
<input type="hidden" name="handling_cart" value="$handling">
<input type="hidden" name="bn" value="ButtonFactory.PayPal.001">
<input type="image" name="add" src="http://www.powersellersunite.com/buttonfactory/sc-but-01.gif">
</form>
PAYPAL;
return $content.$paypal;
}
}
}
add_action('the_content', 'add_some_stuff');
Thanks


LinkBack URL
About LinkBacks
Reply With Quote