나와 내 친구는 여기에서 무슨 일이 벌어지고 있는지에 대해 완전히 속임수입니다. 퀘스트는 하나의 게시물에서 다음 게시물로 연결되는 표준 페이지 매김을하는 것입니다. 페이지는 페이지/2 /, 페이지/3/등으로 표시되지만 내용은 변경되지 않습니다.WordPress 맞춤 게시 유형 페이지 매김 문제
다음은 맞춤 템플릿에 포함 된 내용입니다.
<?php
/**
* The Template for displaying all single posts.
*
* Template Name: Portfolio
*
* @package WordPress
* @subpackage Boilerplate
* @since Boilerplate 1.0
*/
get_header();
// Enable Pagination
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => array(
'portfolio'
),
'orderby' => 'date',
'posts_per_page' => 1,
'paged'=>$paged
);
$the_query = new WP_Query($args);
while ($the_query->have_posts()) : $the_query->the_post();
?>
<article id="item<?php the_ID(); ?>" <?php post_class('post portfolio'); ?>>
<h2><?php the_title(); ?></h2>
<div>
<?php the_content(); ?>
</div>
</article>
<?php endwhile; ?>
<?php next_posts_link('« Older Entries') ?>
<?php previous_posts_link('Newer Entries »') ?>
<?php wp_reset_postdata(); ?>
<?php get_footer(); ?>
그리고 functions.php의 하단에
는 일부 사용자 지정 게시 유형 스크립트를 살고 ...// Custom Post Type
function foggin_Portfolio() {
$labels = array(
'name' => _x('Portfolio', 'post type general name'),
'singular_name' => _x('Portfolio', 'post type singular name'),
'add_new' => _x('Add New', 'book'),
'add_new_item' => __('Add New Item'),
'edit_item' => __('Edit item'),
'new_item' => __('New Item'),
'all_items' => __('All Items'),
'view_item' => __('View Item'),
'search_items' => __('Search items'),
'not_found' => __('No item'),
'not_found_in_trash' => __('No items found in the Trash'),
'parent_item_colon' => '',
'menu_name' => 'Portfolio'
);
$args = array(
'labels' => $labels,
'description' => 'Holds portfolio items and portfolio specific data',
'public' => true,
'menu_position' => 5,
'rewrite' => array('slug'=>'','with_front'=>false),
'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'taxonomies'),
'taxonomies' => array('post_tag'),
'has_archive' => true,
);
register_post_type('portfolio', $args);
}
add_action('init', 'foggin_Portfolio');
function portfolio_messages($messages) {
global $post, $post_ID;
$messages['portfolio'] = array(
0 => '',
1 => sprintf(__('Portfolio item updated. <a href="%s">View item</a>'), esc_url(get_permalink($post_ID))),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('Product updated.'),
5 => isset($_GET['revision']) ? sprintf(__('Portfolio item restored to revision from %s'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
6 => sprintf(__('Portfolio item published. <a href="%s">View item</a>'), esc_url(get_permalink($post_ID))),
7 => __('Portfolio item saved.'),
8 => sprintf(__('Portfolio item submitted. <a target="_blank" href="%s">Preview item</a>'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))),
9 => sprintf(__('Portfolio item scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview item</a>'), date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)), esc_url(get_permalink($post_ID))),
10 => sprintf(__('Portfolio item draft updated. <a target="_blank" href="%s">Preview item</a>'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))),
);
return $messages;
}
add_filter('post_updated_messages', 'portfolio_messages');
function portfolio_taxonomies() {
$labels = array(
'name' => _x('Categories', 'taxonomy general name'),
'singular_name' => _x('Category', 'taxonomy singular name'),
'search_items' => __('Search Categories'),
'all_items' => __('All Categories'),
'parent_item' => __('Parent Category'),
'parent_item_colon' => __('Parent Category:'),
'edit_item' => __('Edit Category'),
'update_item' => __('Update Category'),
'add_new_item' => __('Add New Category'),
'new_item_name' => __('New Category'),
'menu_name' => __('Categories'),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
);
register_taxonomy('portfolio_category', 'portfolio', $args);
}
add_action('init', 'portfolio_taxonomies', 0);
?>
생각, 아이디어, 조언 나는 우리가있어 말을 공정하다고 생각 정말 도움이 될 것입니다 둘 다 이것에 곤란을 겪었다.