WordPress 3.9.1. Задача с помощью PHP вывести на "конкретную страницу" все custom post определенного автора. то есть того автора, который является создателем "конкретной страницы". к примеру: есть custom post types "компания", "товары", "документы", "фотографии"... Пользователь создал одну запись о компании и много записей о товарах, документах и т.п. Все его товары, документы и фотографии надо вывести на страницу компании, которую создал он же. понятно, что надо со страницы о "компании" получить ID автора и в соответствии с ним вывести остальные записи. но как это реализовать? ни разу не программист.
Re: PHP+WordPress: Вывести содержимое Custom post types на н Есть вот такой код, он выводит на странице автора содержимое всех типов постов, которые создал автор. Код (Text): <!-- start content part--> <div id="content" role="main"> <?php do_action('directory_inside_container_breadcrumb'); /*do action for display the breadcrumb inside the container. */ ?> <?php if(function_exists('supreme_sidebar_before_content')) apply_filters('tmpl_before-content',supreme_sidebar_before_content() ); // Loads the sidebar-before-content.?> <?php while ( have_posts() ) : the_post(); ?> <?php do_action('directory_before_post_loop');?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <!--start post type title --> <?php do_action('directory_before_post_title'); /* do action for before the post title.*/ ?> <header class="entry-header"> <?php $listing_logo=get_post_meta(get_the_ID(),'listing_logo',true); ?> <!-- Start Image Upload --> <?php if(($listing_logo!="" && $htmlvar_name['basic_inf']['listing_logo']) && ($is_edit=="")):?> <div class="entry-header-logo"> <img src="<?php echo $listing_logo?>" alt="<?php echo $htmlvar_name['basic_inf']['listing_logo']['label']; ?>" /> </div> <?php elseif($is_edit==1): ?> <div class="entry-header-logo" > <div style="display:none;" class="frontend_listing_logo"><?php echo $listing_logo?></div> <!--input id="fronted_files_listing_logo" class="fronted_files" type="file" multiple="true" accept="image/*" /--> <div id="fronted_upload_listing_logo" class="frontend_uploader button" data-src="<?php echo $listing_logo?>"> <span><?php echo __( 'Upload ', ADMINDOMAIN ).$htmlvar_name['basic_inf']['listing_logo']['label']; ?></span> </div> </div> <?php endif;?> <!-- End Image Upload --> <div class="entry-header-title"> <h1 itemprop="name" class="entry-title <?php if($is_edit==1):?>frontend-entry-title <?php endif;?>" <?php if($is_edit==1):?> contenteditable="true"<?php endif;?> ><?php the_title(); ?></h1> <?php if($tmpdata['templatin_rating']=='yes'): $total=get_post_total_rating(get_the_ID()); $total=($total=='')? 0: $total; $review_text=($total==1 || $total==0)? '<a href="#comments">'.__('Review',DIR_DOMAIN).'</a>': '<a href="#comments">'.__('Reviews',DIR_DOMAIN).'</a>'; ?> <div class="listing_rating"> <div class="directory_rating_row"><span class="single_rating"> <?php echo draw_rating_star_plugin(get_post_average_rating(get_the_ID()));?> <span><?php echo $total.' '.$review_text?></span></span></div> </div> <?php endif; do_action('directory_display_rating',get_the_ID()); ?> <div class="entry-header-custom-wrap"> <div class="entry-header-custom-left"> <?php global $htmlvar_name; $address=get_post_meta(get_the_ID(),'address',true); $website=get_post_meta(get_the_ID(),'website',true); $phone=get_post_meta(get_the_ID(),'phone',true); $listing_timing=get_post_meta(get_the_ID(),'listing_timing',true); $email=get_post_meta(get_the_ID(),'email',true); if($address!="" && $htmlvar_name['basic_inf']['address']):?> <p class="entry_address<?php echo $htmlvar_name['basic_inf']['address']['style_class'];?>"><span id="frontend_address" class="listing_custom frontend_address" <?php if($is_edit==1):?>contenteditable="true"<?php endif;?>><?php echo get_post_meta(get_the_ID(),'address',true);?></span></p> <?php endif;?> <?php if($website!="" && $htmlvar_name['contact_info']['website'] || ($is_edit==1)): if(!strstr($website,'http')) $website = 'http://'.$website;?> <p class="<?php echo $htmlvar_name['contact_info']['website']['style_class']; ?>"><a id="website" class="frontend_website <?php if($is_edit==1):?>frontend_link<?php endif; ?>" href="<?php echo $website;?>" ><span><?php echo $htmlvar_name['contact_info']['website']['label']; ?></span></a></p> <?php endif;?> </div> <div class="entry-header-custom-right"> <?php if($phone!="" && $htmlvar_name['contact_info']['phone'] || ($is_edit==1)):?> <p class="phone <?php echo $htmlvar_name['contact_info']['phone']['style_class']; ?>"><label><?php echo $htmlvar_name['contact_info']['phone']['label']; ?>: </label><span class="entry-phone frontend_phone listing_custom" <?php if($is_edit==1):?>contenteditable="true" <?php endif;?>><?php echo $phone;?></span></p> <?php endif;?> <?php if($listing_timing!="" && $htmlvar_name['basic_inf']['listing_timing'] || ($is_edit==1)):?> <p class="time <?php echo $htmlvar_name['basic_inf']['listing_timing']['style_class']; ?>"><label><?php echo $htmlvar_name['basic_inf']['listing_timing']['label']; ?>: </label><span class="entry-listing_timing frontend_listing_timing listing_custom" <?php if($is_edit==1):?>contenteditable="true" <?php endif;?>><?php echo $listing_timing;?></span></p> <?php endif;?> <?php if( @$email!="" && @$htmlvar_name['contact_info']['email'] || ($is_edit==1)):?> <p class="email <?php echo $htmlvar_name['contact_info']['email']['style_class']; ?>"><label><?php echo $htmlvar_name['contact_info']['email']['label']; ?>: </label><span class="entry-email frontend_email listing_custom" <?php if($is_edit==1):?>contenteditable="true"<?php endif;?>><?php echo antispambot($email);?></span></p> <?php endif;?> </div> <?php do_action('directory_display_custom_fields_default'); ?> </div> </div> </header> <?php do_action('directory_after_post_title'); /* do action for after the post title.*/?> <!--end post type title --> <!-- listing content--> <div class="entry-content"> <?php do_action('directory_before_post_content');?> <?php get_template_part( 'directory-listing','single-content' ); ?> <?php do_action('directory_after_post_content');?> </div> <!--Finish the listing Content --> <!--Custom field collection do action --> <?php do_action('directory_custom_fields_collection'); ?> <?php do_action('directory_extra_single_content');?> </div> <?php do_action('directory_after_post_loop');?> <?php do_action('directory_edit_link');?> <?php endwhile; // end of the loop. ?> <?php wp_reset_query(); // reset the wp query?> <?php do_action('tmpl_single_post_pagination'); /* add action for display the next previous pagination */ ?> <?php do_action('tmpl_before_comments'); /* add action for display before the post comments. */ ?> <?php do_action( 'after_entry' ); ?> <?php do_action( 'for_comments' );?> <?php do_action('tmpl_after_comments'); /*Add action for display after the post comments. */?> <?php global $post; $tmpdata = get_option('templatic_settings'); do_action('tmpl_related_post'); /*add action for display the related post list. */ ?> <?php if(function_exists('supreme_sidebar_after_content')) apply_filters('tmpl_after-content',supreme_sidebar_after_content()); // after-content-sidebar use remove filter to don't display it ?> </div> <!-- #content -->