// Создаем массив данных новой записи
$post_data = array(
'post_title' => wp_strip_all_tags( 'title' ),
'post_content' =>'post_content',
'post_name' => 'slug',
'post_status' => 'publish',
'post_author' => 1,
);
// Вставляем запись в базу данных
$post_id = wp_insert_post( $post_data );
add_filter( 'the_content', 'filter_function_name_11' );
function filter_function_name_11( $content ) {
// Фильтр...
return $content;
}
Bootstrap, но он вроде как не особо дружит с WordPress
<div class="row">
<?php
$i = 0;
$items = [ 1, 2, 3, 4, 5, 6 ];
foreach ( $items as $item ) :
?>
<div class="item<?php echo( $i === 0 ? ' item--red' : null ); ?>">1</div>
<div class="item">2</div>
<div class="item">3</div>
<?php
$i = $i === 2 ? 0 : $i ++;
endforeach;
?>
</div>
.row {
display: grid;
grid-template-columns: repeat(3, 40% 30% 30%);
add_action( 'wp', 'generic_content' );
function generic_content() {
global $wp_query;
if ( $wp_query->is_404 ) {
status_header( 200 );
$post_title = 'change me';
$post_content = 'change me';
$post = new stdClass();
$post->ID = - 1;
$post->post_content = $post_content;
$post->post_status = 'publish';
$post->post_title = $post_title;
$post->post_type = 'generic';
$post->post_name = $post_title;
$post->comment_status = 'closed';
$post->ping_status = 'closed';
$post->post_password = '';
$wp_query->found_posts = 1;
$wp_query->is_404 = false;
$wp_query->is_posts_page = 1;
$wp_query->is_single = 1;
$wp_query->is_singular = true;
$wp_query->max_num_pages = 1;
$wp_query->page = false;
$wp_query->post = $post;
$wp_query->post_count = 1;
$wp_query->posts = array( $post );
$wp_query->queried_object = $post;
}
}