2010-07-29 4 views
1

저는 워드 프레스 플러그인을 개발 중이며 문제가 발생했습니다. WP 플러그인이 흰색 화면의 관리자 인 경우

문제

는이 코드에 의해 발생되고이에

<?php 

function gs_subscribe_button ($type) { 
    global $wpdb; 
    $id = get_option('google_merchant'); 
    $table_name = $wpdb->prefix . "subscription_types"; 
    $result = mysql_query ("SELECT * FROM $table_name WHERE id = $type"); 

    echo '<form method="POST" action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/'.$id.'" accept-charset="utf-8">'; 

     while ($row = mysql_fetch_array($result)) { 

    echo '<input type="hidden" name="shopping-cart.items.item-1.item-name" value="'.$row['name'].'"/> 
    <input type="hidden" name="shopping-cart.items.item-1.item-description" value="Your chossen Subscription"/> 
    <input type="hidden" name="shopping-cart.items.item-1.unit-price" value="'.$row['price'].'"/> 
    <input type="hidden" name="shopping-cart.items.item-1.unit-price.currency" value="GBP"/> 
    <input type="hidden" name="shopping-cart.items.item-1.quantity" value="1"/>'; 

     } 


    echo '<input type="hidden" name="_charset_" />'; 

    echo '<input type="image" 
    name="Google Checkout" 
    alt="Fast checkout through Google" 
    src="http://checkout.google.com/buttons/checkout.gif?merchant_id='; 
    echo $id; 
    echo '&w=180&h=46&style=white&variant=text&loc=en_US" 
    height="46" 
    width="180" />'; 

    echo '</form>'; 


} 

?> 

뭔가 모든 관리자 화면 잠금 업을하는 원인이된다. 프론트 엔드에서만 기능을 적용하도록 Wordpress에 알리는 방법이 있습니까?

답변

0

용액이었다 (! is_admin())

경우 { 는 ('template.php')을 포함한다; }

처음으로 is_admin을 찾지 못했습니다.

+0

해결책을 수락하는 것을 잊지 마십시오.) – antyrat

관련 문제