想要看一下wp用了多少主機空間,可以裝一下MySimpleSpace
這裡有一篇討論區也是教你寫一個dashboard的wigget來顯示空間,不過貼了會爆炸。
沒仔細看哪裡錯了,先筆記起來
http://wordpress.stackexchange.com/questions/67876/how-to-check-disk-space-used-by-media-library
https://tinypng.com/developers
$sql = "INSERT INTO `table` (`id`, `name`) VALUES (?,?),(?,?) ON DUPLICATE KEY UPDATE `name` = VALUES(`name`) ";//將要批次插入的值放到 (?,?),看你要插入幾組 $values = array(1, "test", 2, "so so");//要插入的值 $stmt = $this->db->prepare($sql);//建立pdo statment $stmt->execute($values);//執行時把要插入的值丟入pdo
require_once(dirname(dirname(__FILE__)).'/wp-load.php');
// Adds a dropdown to filter users based on a meta field
function add_recommand_filter_into_user_table() {
global $pagenow;
if (is_admin() && $pagenow == 'users.php') {
$optNone = '';
$optYes = '';
$optNo = '';
if(isset($_GET['recommand'])){
if(strcmp($_GET['recommand'],'1') == 0){
$optYes = 'selected="selected"';
}else{
$optNo = 'selected="selected"';
}
}else{
$optNone = 'selected="selected"';
}
echo '';
}
}
add_action('restrict_manage_users', 'add_recommand_filter_into_user_table');
// Updates user query based on filtering criteria
function query_recommand_query_from_user_table($query) {
global $pagenow;
if (is_admin() && $pagenow == 'users.php' && isset($_GET['recommand'])) {
$recommandValue = wp_strip_all_tags($_GET['recommand']);
if(strcmp($recommandValue,'') != 0){
$meta_query = array(
array(
'key' => RECOMMAND_KEY,
'value' => $recommandValue
)
);
$query->set('meta_key', RECOMMAND_KEY);
$query->set('meta_query', $meta_query);
}
}
}
add_filter('pre_get_users','query_recommand_query_from_user_table');
add_action( 'wp_ajax_my_action', 'my_action_callback' );
function my_action_callback() {
global $wpdb; // this is how you get access to the database
$whatever = intval( $_POST['whatever'] );
$whatever += 10;
echo $whatever;
wp_die(); // this is required to terminate immediately and return a proper response
}
jQuery(document).ready(function($) {
var data = {
'action': 'my_action',
'whatever': 1234
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
alert('Got this from the server: ' + response);
});
});
function reg_scripts() {
wp_enqueue_style( 'bootstrapstyle', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'bootstrapthemestyle', get_template_directory_uri() . '/css/bootstrap-theme.min.css' );
wp_enqueue_script( 'bootstrap-script', get_template_directory_uri() . '/js/bootstrap.min.js', array(), true );
}
add_action('wp_enqueue_scripts', 'reg_scripts');
| 目錄名稱 | 說明 | 例 |
| bin | 系統的一些重要執行檔 | Kill、cp、df |
| boot | 系統開機的一些載入檔 | |
| cdrom | 光碟機裡的資料被掛上來的地方 | |
| dosc | 開機時把dos檔案系統掛上來的地方 | |
| etc | 系統設定檔 | |
| home | 使用者的自家目錄所在、ftp server | |
| lib | 基本函數庫 | |
| Lost+found | 系統檢查結果 | |
| mnt | 可以掛上其它檔案系統 | |
| proc | 整個系統運作資訊 | |
| root | 系統管理者的自家目錄所在 | |
| sbin | 一些設定的可執行程式、設定網路 | |
| tmp | 雜七雜八的東西 | |
| usr | 應用程式 | X-window |
| var | 記載著各種系統上的變數的地方 | |
| vmlinuz | 系統核心檔案 |