Шаблон для контента
-
Я сделал собственный тип записей.
Чтобы на странице стали отображаться посты (собственный тип записей), нужно вставить на страницу shortcodeВот цикл который выводит посты
add_shortcode( 'wp_concerts', 'wp_concerts_scf' ); function wp_concerts_scf($atts) { ... $query = new WP_Query( $this->args ); if ( $query->have_posts() ) // Start the loop { while ( $query->have_posts() ) { $query->the_post(); /*Begin while*/ ?> <div id="post_box"> <a href="<?=get_permalink(get_the_ID())?>"> <div id="link_post"> <div id="post_box_full_date"> <div id="post_box_number"> <div> <?=get_post_meta(get_the_ID(), 'concert_number', true)?> </div> </div> <div id="post_box_date"> <div> <?=get_post_meta(get_the_ID(), 'concert_month', true)?> </div> <div> <?=get_post_meta(get_the_ID(), 'concert_begins', true)?> - <?=get_post_meta(get_the_ID(), 'concert_ends', true)?> </div> <div> <?=get_post_meta(get_the_ID(), 'concert_day', true)?> </div> </div> </div> <div id="post_box_context"> <div> <?=the_title()?> </div> <div> <?=get_post_meta(get_the_ID(),'concert_short_description', true)?> </div> <div> <?=get_post_meta(get_the_ID(),'concert_dirigent', true)?> </div> </div> </div> </a> <div id="link_ticket"> <?php $concert_ticket_url = get_post_meta(get_the_ID(),'concert_ticket_url', true); if($concert_ticket_url!="") : ?> <a target="_blank" href="<?=get_post_meta(get_the_ID(),'concert_ticket_url', true)?>"> <button class="concertsButton" type="button">Buy Ticket</button> </a> <?php endif; ?> </div> </div> ...
но когда перейти по ссылке(нажать на любой пост), то появляется надпись «NOTHING FOUND».
Что мне нужно сделать чтобы начали отображаться посты ? (а не NOTHING FOUND)
вот что я уже делал, но результата никакого.
function get_custom_post_type_template1( $archive_template ) { global $post; if ( is_post_type_archive ( 'concerts' ) ) { return WD_CONCERTS_DIR . '/template/post-type-template.php'; } return $archive_template; } add_filter( 'archive_template', 'get_custom_post_type_template1' ) ; function get_custom_post_type_template2($single_template) { global $post; if ($post->post_type == 'concerts') { return WD_CONCERTS_DIR . '/template/post-type-template.php'; } return $single_template; } add_filter( 'single_template', 'get_custom_post_type_template2' ); function concerts_template( $template ) { if ( get_post_type() == 'concerts' ) { return WD_CONCERTS_DIR . '/template/post-type-template.php'; } return $template; } add_filter( 'template_include', 'concerts_template', 1 );
так и дальше появляется «NOTHING FOUND».
Просмотр 3 ответов — с 1 по 3 (всего 3)
Просмотр 3 ответов — с 1 по 3 (всего 3)
- Тема «Шаблон для контента» закрыта для новых ответов.