2015-12-01 1 views
0

ourteam.phpСистематика код не работает

<?php 
    /* 
    Template Name: OUR TEAM 
    */ 
    get_header(); 
?> 

<div class="container ourteamah"> 
    <h3>Our Team</h3> 

    <div class="row"> 
     <div class="col-md-12 col-sm-6"> 

      <div class="tab-wrap1"> 
       <div class="media1"> 
        <div class="parrent1 pull-left"> 
          <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('our-team-sidebar')) : endif; ?> 
        </div> 

        <div class="parrent1 media1-body"> 
         <div class="tab-content"> 

          <?php $arr = array('posts_per_page' => '11', 'taxonomy'=>'Doctor-Categories', 'order' => 'ASC', 'category_id' =>33); 
           $posts = get_posts($arr); 

           foreach($posts as $data){ 

            $thumb = wp_get_attachment_url(get_post_thumbnail_id($data ->ID)); 

            $custom_subheading = get_post_custom($data->ID); 
            $custom_subheading_key = $custom_subheading['team-sub-heading']; 
            $custom_subheading_array = $custom_subheading_key[0]; 

            $custom_class_key = $custom_subheading['class']; 
            $custom_class_array = $custom_class_key[0]; 

            $custom_id_key = $custom_subheading['id']; 
            $custom_id_array = $custom_id_key[0]; 
          ?> 

          <div class="<?php echo $custom_class_array;?>" id="<?php echo $custom_id_array;?>"> 
           <div class="media1"> 
            <div class="pull-left"> 
             <img class="img-responsive" src="<?php echo $thumb;?>"> 
            </div> 
            <div class="media1-body"> 
             <h4><?php echo $data->post_title;?></h4> 
             <h2><?php echo $custom_subheading_array;?></h2> 
             <div class="col-md-6"> 
               <?php echo $data->post_content;?> 
             </div> 
            </div> 
           </div> 
          </div> 

          <?php } ?> 

         </div> <!--/.tab-content--> 
        </div> <!--/.media1-body--> 
       </div> <!--/.media1-->  
      </div><!--/.tab-wrap1-->    
     </div><!--/.col-sm-6--> 

    </div> 
</div> 

<?php get_footer(); ?> 

functions.php

<?php 

//Defining paths for css,js,file,plugins 
define('AHL_URL',WP_CONTENT_URL."/"); 
define('AHL_IMG_URL',WP_CONTENT_URL."/themes/ahalia/images/"); 
define('AHL_STYLE_URL',WP_CONTENT_URL."/css/"); 
define('AHL_SCRIPT_URL',WP_CONTENT_URL."/js/"); 


/*fastsolution Theme and Functions goes in this file*/ 

//adding menus in dashboard 
add_theme_support('menus'); 
//adding featured image 
add_theme_support('post-thumbnails'); 

//adding widgets 
function ahalia_widgets_init() { 

//adding php support to widget 

function php_execute($html){ 
if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); 
$html=ob_get_contents(); 
ob_end_clean(); 
} 
return $html; 
} 
add_filter('widget_text','php_execute',100); 


//adding post-formats 
add_theme_support('post-formats', array(
'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status',  'video')); 

//addig search form 
add_theme_support('html5', array('search-form')); 


add_theme_support('html5', array(
    'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' 
)); 

//callig search for and resuls dont delete this will run on 404 error page 

function SearchFilter($query) { 
// If 's' request variable is set but empty 
if (isset($_GET['s']) && empty($_GET['s']) && $query->is_main_query()){ 
$query->is_search = true; 
$query->is_home = false; 
} 
return $query; 
} 
add_filter('pre_get_posts','SearchFilter'); 

//nav menus 
register_nav_menus(array(
    'header_menu' => 'HEADER', 
    'navigation' => 'FOOTER_NAVIG', 
    'quick_links' => 'FOOTER_QUICK' 
)); 

//custom post type strats for slider 
function testimonial_postTypes(){ 
$labels = array(
'name'    => _x('Testimonial', 'testimonial'), 
'singular_name'  => _x('Testimonial', 'testimonial'), 
'add_new'   => _x('Add Testimonial', 'testimonial'), 
'add_new_item'  => __('Add New testimonial'), 
'edit_item'   => __('Edit Testimonial'), 
'new_item'   => __('New Testimonial'), 
'all_items'   => __('All Testimonial'), 
'view_item'   => __('View Testimonial' ,'Testimonial'), 
'search_items'  => __('Search Testimonial'), 
'not_found'   => __('No Testimonial found'), 
'not_found_in_trash' => __('No Testimonial found in the Trash'), 
'parent_item_colon' => '', 
'menu_name'   => 'Testimonial' 
); 
$args = array(
'labels'    => $labels, 
'description'  => 'Allows the user to create Testimonial', 
    'public'   => true, 
    'menu_icon'  =>  '"'.WP_CONTENT_URL.'"/themes/ahalia/images/testimonial.png', 
    'menu_position' => 5, 
    'supports'  => array('title', 'editor', 'thumbnail', 'excerpt',  'comments'), 
    'taxonomies'   => array('category','post_tag'), 
    'has_archive'  => true, 
    'publicly_queryable' => true, 
     'show_ui'   => true, 
     'query_var'  => true, 
    'rewrite'   => array('slug' => 'categories'), 
    'supports'    => array('title', 'editor', 'comments', 'excerpt', 'custom-fields', 'thumbnail'), 
     'capability_type' => 'post'); 
     register_post_type('testimonial', $args); 
     add_theme_support('post-thumbnails'); 
     } 
     add_action('init', 'testimonial_postTypes'); 

//sample 


    function Doctor_post_types() { 
     $labels = array(
     'name'    => _x('Doctor', 'doctor'), 
     'singular_name'  => _x('Doctor', 'doctor'), 
     'add_new'   => _x('Add Doctors', 'doctor'), 
     'add_new_item'  => __('Add Doctors'), 
     'edit_item'   => __('Edit Doctors'), 
      'new_item'   => __('New Doctors'), 
      'all_items'   => __('All Doctors'), 
       'view_item'   => __('View Doctors'), 
      'search_items'  => __('Search Doctors'), 
      'not_found'   => __('No Doctors found'), 
       'not_found_in_trash' => __('No Doctors found in the Trash'), 
       'parent_item_colon' => '', 
       'menu_name'   => 'Doctors', 
      ); 
     $args = array(
      'labels'  => $labels, 
       'description' => 'Allows the user to create Doctor', 
       'public'  => true, 
       'menu_position' => 5, 
       'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'comments'), 
       'has_archive' => true, 
       'show_ui'   => true, 
        'show_admin_column' => true, 
        'query_var'   => true, 
        'hierarchical' => false, 
        '_builtin'  => false, 
        'capability_type' => 'post', 
        'rewrite'  => array('slug' => 'Doctor','with_front' => FALSE) 

        //'taxonomies' => array('category', 'post_tag') 
        ); 
        register_post_type('doctor', $args); 
        } 
        add_action('init', 'Doctor_post_types'); 

        function Doctors_taxonomies_product() { 
        $labels = array(
        'name'    => _x('Doctor Categories', 'Doctor Categories'), 
        'singular_name'  => _x('Doctor Categories', 'Doctor Categories'), 
        'search_items'  => __('Search Doctor Categories'), 
        'all_items'   => __('All Doctor Categories'), 
        'parent_item'  => __('Parent Doctor Categories'), 
         'parent_item_colon' => __('Parent Doctor Categories'), 
        'edit_item'   => __('Edit Doctor Categories'), 
        'update_item'  => __('Update Doctor Categories'), 
        'add_new_item'  => __('Add New Doctor Categories'), 
         'new_item_name'  => __('New Doctor Categories'), 
        'menu_name'   => __('Doctor Categories'), 
        'rewrite'   => array('Doctor-Categories' => 'doc-type'), 
         ); 

       register_taxonomy('Doctor-Categories', array('doctor'), array(
      'hierarchical' => true, 
      'labels' => $labels, 
       'show_ui' => true, 
      'show_admin_column' => true, 
      'query_var' => true, 
       'rewrite' => array('slug' => 'Doctor-Categories'), 
      )); 

      } 
     add_action('init', 'Doctors_taxonomies_product', 0); 


      ?> 

Я создал таксономию "доктор". В этом я создал несколько должностей таксономии «врач».

Я хотел отобразить все сообщения этой таксономии на сайте, а также вставить в базу данных в таблицу как post_type = 'doctor'Как я могу это сделать? Я написал код. Но это не работает.

Может ли кто-нибудь помочь мне с этим кодом?

ответ

0
<?php query_posts("cat=33&post_type=doctor&showposts=-1"); 
    while(have_posts()): the_post(); 

the_title(); 


endwhile; wp_reset_query(); 
?> 

У меня также есть обновленные посты из категории 33, где должности типа врача.

Смежные вопросы