с объяснением понятий БД, запроса, html-страницы и т.п.это скорее косвенно касаеться разработки тем и плагинов для Wordpress.
// Вставляете его в файл function.php
// Add the Meta Box
function add_custom_meta_box() {
add_meta_box(
'custom_meta_box', // $id
'Custom Meta Box', // $title
'show_custom_meta_box', // $callback
'post', // $page
'normal', // $context
'high'); // $priority
}
add_action('add_meta_boxes', 'add_custom_meta_box');
function show_custom_meta_box( $post) {
// Use nonce for verification
echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';
// get value of this field if it exists for this post
$meta = get_post_meta($post->ID, 'thum_disable', true);
echo '<input type="checkbox" name="thum_disable" id="thum_disable" ' . checked($meta, "on"); . ' value="on" />
<label for="thum_disable">Отключить миниатюру</label>';
}
// Save the Data
function save_custom_meta($post_id) {
// verify nonce
if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))
return $post_id;
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return $post_id;
// check permissions
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id))
return $post_id;
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
$old = get_post_meta($post_id, 'thum_disable', true);
$new = $_POST['thum_disable'];
if ($new && $new != $old) {
update_post_meta($post_id, 'thum_disable', $new);
} elseif ('' == $new && $old) {
delete_post_meta($post_id, 'thum_disable', $old);
}
}
add_action('save_post', 'save_custom_meta');
$thumb_disable = get_post_meta($post->ID, 'thum_disable', true);
if(!empty( $thumb_disable )) { the_post_thumbnail( ); }
http://codex.wordpress.org/Function_Reference/wp_enqueue_script На странице есть пример
function theme_name_scripts() {
wp_enqueue_style( 'style-name', get_stylesheet_uri() );
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
В теле функции добавляете
global $post;
и дальше проверяете, на id, шаблоны и прочее, и подключаете то что нужно.
Что нибуть лучше врят ли найдеться. Разве что плагин, который скорее всего будет тем же принципом действовать