0

プラグインを作成するのは初めてです..基本的に、プラグインオプションページに、プラグインページからいくつかの機能を呼び出す更新ボタンを1つ付けたい..

私のオプションページはこんな感じ

<div class="wrap">

    <?php screen_icon(); ?>
    <form action="options.php" method="post" id="<?php echo $plugin_id; ?>_options_form" name="<?php echo $plugin_id; ?>_options_form">

    <?php settings_fields($plugin_id.'_options'); ?>

    <h2>Plugin Options &raquo; Settings</h2>
    <table class="widefat">
        <thead>
           <tr>
             <th><input type="submit" name="submit" value="Save Settings" class="button-primary" style="padding:8px;" /></th>
           </tr>
        </thead>
        <tfoot>
           <tr>
    </table>

    </form>

</div>

私のプラグインページには、次のような機能がほとんど含まれていません

function get_images(){

    global $post; 
    global $wpdb;
    $query_images_args = array(
     'post_type' => 'attachment' , 'post_mime_type' =>'image','post_status' => 'published', 'posts_per_page' => -1,'numberposts' => 1
 );


 $query_images = new WP_Query( $query_images_args );
 $images = array();

         $abc=($images);
                 $count = count($images);
                 for ($i = 0; $i < $count; $i++)
 {

      $final[]= $images[$i];

 }

                 if(count($abc)>1){
                 $_SESSION['arrayImg']=$abc;  
                 }
                  $noofpics=  count($image);
    }
    register_activation_hook(__FILE__, 'get_images');

私のプラグインページの別の2つの機能。したがって、更新ボタンをクリックすると、このいくつかの関数を呼び出したい..Plzが助けてくれます。

4

1 に答える 1

0

私は実際にこの問題を解決しました

<INPUT TYPE="button" onClick="history.go(0), myFunction();" VALUE="Update">

実行時のphpコードはコード行を実行するため、ユーザーがこのページにいるときは、ボタンのボタンクリックで関数を実行できupdateます..

私の問題はこれで解決されます...

于 2013-08-09T07:35:17.670 に答える