• Есть блог скажем.
    Когда скажем заходишь на blogname.com , То у тебя открывается страница и в ней записи , скажем штук 10 на странице.
    Если я добавляю страницу просто из меню, а потом захожу на нее, то у меня там обычная страница, без записей. Home / Contact / Feedback
    Скажем мне надо на странице Contact сделать так, чтоб тож мог записи создать. Как это можно сделать и можно ли?

Просмотр 3 ответов — с 1 по 3 (всего 3)
  • Можно вывести записи на странице Contact, для этого надо в шаблоне этой страницы прописать код вывода записей. Создать такой спец. тип шаблона страницы.

    Где именно мне найти это код можно?

    В кодексе http://codex.wordpress.org/Class_Reference/WP_Query

    Ну и про шаблоны страниц http://codex.wordpress.org/Page_Templates

    Тут даже пример есть страницы с категориями, как вы хотите (Page of Posts)

    <?php
    /*
    Template Name: Page Of Posts
    */
    
    /* This example is for a child theme of Twenty Thirteen:
    *  You'll need to adapt it the HTML structure of your own theme.
    */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
            <?php
            /* The loop: the_post retrieves the content
             * of the new Page you created to list the posts,
             * e.g., an intro describing the posts shown listed on this Page..
             */
            if ( have_posts() ) :
                while ( have_posts() ) : the_post();
    
                  // Display content of page
                  get_template_part( 'content', get_post_format() );
                  wp_reset_postdata();
    
                endwhile;
            endif;
    
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
            $args = array(
                // Change these category SLUGS to suit your use.
                'category_name' => 'music, videos',
                'paged' => $paged
            );
    
            $list_of_posts = new WP_Query( $args );
            ?>
            <?php if ( $list_of_posts->have_posts() ) : ?>
    			<?php /* The loop */ ?>
    			<?php while ( $list_of_posts->have_posts() ) : $list_of_posts->the_post(); ?>
    				<?php // Display content of posts ?>
    				<?php get_template_part( 'content', get_post_format() ); ?>
    			<?php endwhile; ?>
    
    			<?php twentythirteen_paging_nav(); ?>
    
    		<?php else : ?>
    			<?php get_template_part( 'content', 'none' ); ?>
    		<?php endif; ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_footer(); ?>
Просмотр 3 ответов — с 1 по 3 (всего 3)
  • Тема «Как сделать страницу с записями» закрыта для новых ответов.