我读了很多关于我的简单问题的书,但找不到简单的答案,所以,请原谅我的无礼。我在函数中注册了自定义的post类型。php,例如:
<?php
function my_custom_post_procedimentos() {
$labels = array(
\'name\' => _x( \'Procedimentos\', \'post type general name\' ),
\'singular_name\' => _x( \'Procedimento\', \'post type singular name\' ),
\'add_new\' => _x( \'Add New\', \'Procedimento\' ),
\'add_new_item\' => __( \'Add New Procedimento\' ),
\'edit_item\' => __( \'Edit Procedimentos\' ),
\'new_item\' => __( \'New Procedimento\' ),
\'all_items\' => __( \'All Procedimentos\' ),
\'view_item\' => __( \'View Procedimentos\' ),
\'search_items\' => __( \'Search Procedimentos\' ),
\'not_found\' => __( \'No Procedimento found\' ),
\'not_found_in_trash\' => __( \'No Procedimento found in the Trash\' ),
\'parent_item_colon\' => \'\',
\'menu_name\' => \'Procedimentos\'
);
$args = array(
\'labels\' => $labels,
\'description\' => \'Holds our Procedimentos specific data\',
\'public\' => true,
\'menu_position\' => 5,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\' ),
\'has_archive\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'can_export\' => true
);
register_post_type( \'procedimentos\', $args );
}
add_action( \'init\', \'my_custom_post_procedimentos\' );
?>
这是一个过程。php循环:
<?php get_header(); ?>
<div class="contcolsopen">
<div class="post">
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div><!--post-end-->
</div><!--contcolsopen-end-->
<?php get_footer(); ?>
我使用/%category%/%postname%/作为永久链接结构,但没有雪茄。
所以:当我有一个自定义的帖子类型在首页上显示它们的列表时,每个列表项(perma)都链接到各自的单页,那么单-[cpt]和页-[cpt]的循环结构是什么?
如果我说得不够清楚,请告诉我。
提前谢谢你
本部分引用了@Warwick对以下评论的善意请求:
object(WP_Query)#168 (47) { ["query_vars"]=> array(58) { ["page"]=> int(0) ["procedimento"]=> string(36) "prostatectomia-radical-laparoscopica" ["post_type"]=> string(12) "procedimento" ["name"]=> string(36) "prostatectomia-radical-laparoscopica" ["error"]=> string(0) "" ["m"]=> int(0) ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["comments_popup"]=> string(0) "" ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["s"]=> string(0) "" ["sentence"]=> string(0) "" ["fields"]=> string(0) "" ["menu_order"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(0) { } ["tag_slug__and"]=> array(0) { } ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["posts_per_page"]=> int(10) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["order"]=> string(4) "DESC" } ["tax_query"]=> NULL ["meta_query"]=> object(WP_Meta_Query)#224 (2) { ["queries"]=> array(0) { } ["relation"]=> NULL } ["post_count"]=> int(1) ["current_post"]=> int(-1) ["in_the_loop"]=> bool(false) ["comment_count"]=> int(0) ["current_comment"]=> int(-1) ["found_posts"]=> int(1) ["max_num_pages"]=> int(0) ["max_num_comment_pages"]=> int(0) ["is_single"]=> bool(true) ["is_preview"]=> bool(false) ["is_page"]=> bool(false) ["is_archive"]=> bool(false) ["is_date"]=> bool(false) ["is_year"]=> bool(false) ["is_month"]=> bool(false) ["is_day"]=> bool(false) ["is_time"]=> bool(false) ["is_author"]=> bool(false) ["is_category"]=> bool(false) ["is_tag"]=> bool(false) ["is_tax"]=> bool(false) ["is_search"]=> bool(false) ["is_feed"]=> bool(false) ["is_comment_feed"]=> bool(false) ["is_trackback"]=> bool(false) ["is_home"]=> bool(false) ["is_404"]=> bool(false) ["is_comments_popup"]=> bool(false) ["is_paged"]=> bool(false) ["is_admin"]=> bool(false) ["is_attachment"]=> bool(false) ["is_singular"]=> bool(true) ["is_robots"]=> bool(false) ["is_posts_page"]=> bool(false) ["is_post_type_archive"]=> bool(false) ["query_vars_hash"]=> string(32) "1d123a103cba5a796526d6ce635a1001" ["query_vars_changed"]=> bool(false) ["thumbnails_cached"]=> bool(false) ["query"]=> array(4) { ["page"]=> string(0) "" ["procedimento"]=> string(36) "prostatectomia-radical-laparoscopica" ["post_type"]=> string(12) "procedimento" ["name"]=> string(36) "prostatectomia-radical-laparoscopica" } ["request"]=> string(184) "SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_name = \'prostatectomia-radical-laparoscopica\' AND wp_posts.post_type = \'procedimento\' ORDER BY wp_posts.post_date DESC " ["posts"]=> &array(2) { [0]=> object(WP_Post)#234 (24) { ["ID"]=> int(20) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2013-03-12 13:55:55" ["post_date_gmt"]=> string(19) "2013-03-12 13:55:55" ["post_content"]=> string(2188) "Vivamus nec i\'m in the shizzle egizzle nisi mah nizzle pretizzle. Vivamizzle sit amizzle lacus. Nam for sure nisl lacus auctor boom shackalack. Shizzlin dizzle suscipit things ipsizzle. Mammasay mammasa mamma oo sa in mammasay mammasa mamma oo sa. Vestibulum enim enizzle, ass sizzle, ma nizzle pizzle, cool ma nizzle, check out this. Nullam vitae pede break it down erizzle mah nizzle pharetra. Quisque pede phat, ma nizzle pulvinizzle, doggy a, mollis black shit, yo mamma. Donizzle at dui. You son of a bizzle risus purus, elementum consectetuer, sollicitudizzle gangster, consequizzle imperdizzle, dizzle. Black away things eu mi rutrum cool. Curabitur da bomb sagittizzle ipsum. Pimpin\' funky fresh morbi yo mamma senectizzle fo shizzle netus ghetto malesuada yo mamma fo shizzle turpis i\'m in the shizzle. My shizz est. Fo shizzle elementum. Ut erizzle felizzle, crackalackin rizzle, suscipizzle ac, shut the shizzle up check it out, nisl. For sure sagittizzle gravida velizzle. The bizzle posuere auctizzle maurizzle. Sizzle a rizzle ut crunk its fo rizzle tincidunt. Maecenas mah nizzle fo. Boom shackalack izzle daahng dawg shut the shizzle up maurizzle elementizzle ass. Nunc izzle check it out sit amizzle fo shizzle my nizzle ultricizzle fo shizzle. In velizzle tortizzle, dang izzle, bizzle quizzle, adipiscing quizzle, i\'m in the shizzle. The bizzle crazy leo, aliquam consequizzle, shizzle my nizzle crocodizzle nizzle, dictum sed, turpizzle. Dope fo shizzle. Crizzle hizzle. Prizzle vitae sheezy fizzle libero pizzle adipiscing. Ghetto izzle phat eu nibh ullamcorper cool. Fizzle rizzle sapizzle nizzle erat. Suspendisse lorizzle shit, sollicitudin sed, mattizzle izzle, dope nec, justo. Doggy shizznit ligula. Own yo\' feugiat, bling bling a funky fresh tempizzle, bling bling metizzle tincidunt ante, dang dapibizzle pede boofron shizzlin dizzle we gonna chung. Phasellus quizzle pimpin\', imperdiet id, tempus crunk, sempizzle we gonna chung, sapizzle. Ut mollizzle sizzle vizzle shut the shizzle up. Sizzle ante nibh, you son of a bizzle go to hizzle, vestibulizzle daahng dawg, funky fresh eu, velit. Sizzle a away. Dope nizzle magna sizzle dang risus ghetto congue." ["post_title"]=> string(48) "Pieloplastia Laparoscópica e Obstrução de JUP" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(6) "closed" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(45) "pieloplastia-laparoscopica-e-obstrucao-de-jup" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2013-03-12 13:55:55" ["post_modified_gmt"]=> string(19) "2013-03-12 13:55:55" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(55) "http://localhost:8888/?post_type=procedimento&p=20" ["menu_order"]=> int(0) ["post_type"]=> string(12) "procedimento" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [1]=> object(WP_Post)#235 (24) { ["ID"]=> int(19) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2013-03-12 13:51:38" ["post_date_gmt"]=> string(19) "2013-03-12 13:51:38" ["post_content"]=> string(601) "Lorizzle ipsum dolizzle ma nizzle amizzle, izzle adipiscing dope. Nullam sapizzle velizzle, shizznit volutpizzle, suscipizzle quizzle, fo shizzle mah nizzle fo rizzle, mah home g-dizzle vizzle, arcu. Pellentesque gizzle tortor. Dope erizzle. Yippiyo fo dolor dapibus turpis tempizzle dizzle. Mauris check it out nibh izzle gangster. Pizzle break yo neck, yall sheezy. Brizzle fo shizzle rhoncizzle nisi. In you son of a bizzle habitasse platea dictumst. Sure dapibizzle. Curabitizzle tellus urna, pretium eu, mattizzle ac, eleifend vitae, nunc. Dang suscipizzle. Integer semper things fizzle purizzle." ["post_title"]=> string(37) "Prostatectomia Radical Laparoscópica" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(6) "closed" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(36) "prostatectomia-radical-laparoscopica" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2013-03-13 13:12:58" ["post_modified_gmt"]=> string(19) "2013-03-13 13:12:58" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(55) "http://localhost:8888/?post_type=procedimento&p=19" ["menu_order"]=> int(0) ["post_type"]=> string(12) "procedimento" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } } ["post"]=> object(WP_Post)#226 (24) { ["ID"]=> int(19) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2013-03-12 13:51:38" ["post_date_gmt"]=> string(19) "2013-03-12 13:51:38" ["post_content"]=> string(601) "Lorizzle ipsum dolizzle ma nizzle amizzle, izzle adipiscing dope. Nullam sapizzle velizzle, shizznit volutpizzle, suscipizzle quizzle, fo shizzle mah nizzle fo rizzle, mah home g-dizzle vizzle, arcu. Pellentesque gizzle tortor. Dope erizzle. Yippiyo fo dolor dapibus turpis tempizzle dizzle. Mauris check it out nibh izzle gangster. Pizzle break yo neck, yall sheezy. Brizzle fo shizzle rhoncizzle nisi. In you son of a bizzle habitasse platea dictumst. Sure dapibizzle. Curabitizzle tellus urna, pretium eu, mattizzle ac, eleifend vitae, nunc. Dang suscipizzle. Integer semper things fizzle purizzle." ["post_title"]=> string(37) "Prostatectomia Radical Laparoscópica" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(6) "closed" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(36) "prostatectomia-radical-laparoscopica" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2013-03-13 13:12:58" ["post_modified_gmt"]=> string(19) "2013-03-13 13:12:58" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(55) "http://localhost:8888/?post_type=procedimento&p=19" ["menu_order"]=> int(0) ["post_type"]=> string(12) "procedimento" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } ["queried_object"]=> object(WP_Post)#226 (24) { ["ID"]=> int(19) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2013-03-12 13:51:38" ["post_date_gmt"]=> string(19) "2013-03-12 13:51:38" ["post_content"]=> string(601) "Lorizzle ipsum dolizzle ma nizzle amizzle, izzle adipiscing dope. Nullam sapizzle velizzle, shizznit volutpizzle, suscipizzle quizzle, fo shizzle mah nizzle fo rizzle, mah home g-dizzle vizzle, arcu. Pellentesque gizzle tortor. Dope erizzle. Yippiyo fo dolor dapibus turpis tempizzle dizzle. Mauris check it out nibh izzle gangster. Pizzle break yo neck, yall sheezy. Brizzle fo shizzle rhoncizzle nisi. In you son of a bizzle habitasse platea dictumst. Sure dapibizzle. Curabitizzle tellus urna, pretium eu, mattizzle ac, eleifend vitae, nunc. Dang suscipizzle. Integer semper things fizzle purizzle." ["post_title"]=> string(37) "Prostatectomia Radical Laparoscópica" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(6) "closed" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(36) "prostatectomia-radical-laparoscopica" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2013-03-13 13:12:58" ["post_modified_gmt"]=> string(19) "2013-03-13 13:12:58" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(55) "http://localhost:8888/?post_type=procedimento&p=19" ["menu_order"]=> int(0) ["post_type"]=> string(12) "procedimento" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } ["queried_object_id"]=> int(19) }