Значение аргумента $screen — это, по сути, тип постов, страница редактирования которых имеется в виду. Из стандартных, которыми WordPress владеет изначально, это 'post' (запись), 'page' (страница) и 'attachment' (медиафайлы и прочие вложения). Если значение не задано (или равно null'ю), метабокс будет присутствовать на всех экранах вне зависимости от типа редактируемого поста.
add_filter('category_link', function($a){
return str_replace( 'category/', '', $a );
}, 99 );
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://test.ru', 'https://test.ru') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://test.ru', 'https://test.ru');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://test.ru','https://test.ru');
UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'http://test.ru', 'https://test.ru');
UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'http://test.ru', 'https://test.ru');
wp_enqueue_script( 'scripts-query', get_template_directory_uri() . '/assets/js/jquery-ui.min.js',array( 'jquery' ), null, true);
$no = array(
'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone',
);
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'orderby' => 'modified',
);
$custom_query = new WP_Query( $args );
while ( $custom_query->have_posts() ) {
$custom_query->the_post();
echo '<a href="'. get_permalink() .'">' . get_the_title() .'</a>';
}
wp_reset_postdata();
?>
# Изображение вставляем по кнопке Добавить медиафайл и оформляем как шорткод
add_filter( 'image_send_to_editor', 'replace_image_editor', 10, 8 );
function replace_image_editor( $html, $id, $caption, $title, $align, $url, $size, $alt ){
$html='[image id="' . $id . '"]';
return $html;
}
$url = wp_get_attachment_url($id);
add_filter( 'attachment_fields_to_edit', 'media_hacks_attachment_field_to_edit', 10, 2 );
function media_hacks_attachment_field_to_edit( $form_fields, $post ){
$form_fields[] = array(
'value' => $post->ID,
'label' => 'ID',
'input' => 'html',
'html' => "<input type='text' class='text' readonly='readonly' name='attachments[$post->ID]' value='" . $post->ID . "' /><br />"
);
return $form_fields;
}
<?php
if ( get_query_var('paged') ) $paged = get_query_var('paged');
elseif ( get_query_var('page') ) $paged = get_query_var('page');
else $paged = 1;
$args = array(
'paged' => $paged,
'post_type' => 'post',
'posts_per_page' => 12,
'orderby' => 'modified', # сортировка по дате изменения поста
);
$custom_query = new WP_Query( $args );
if ( $custom_query->have_posts() ) {
while( $custom_query->have_posts() ) { $custom_query->the_post();
the_title();
}
if ($custom_query->max_num_pages > 1) { // хак для правильной работы пагинации
$orig_query = $wp_query;
$wp_query = $custom_query;
// Пагинация
the_posts_pagination(array(
'prev_text' => (''),
'next_text' => (''),
'end_size' => 1,
'mid_size' => 2
));
$wp_query = $orig_query; // возвращаем дефолтное значение
}
wp_reset_postdata(); // сброс запроса
} ?>