Advertisement
Guest User

Untitled

a guest
Nov 8th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. functions.php
  2. --------------
  3.  
  4. function create_post_type() {
  5.  
  6. register_post_type( 'all_course',
  7. array(
  8. 'labels' => array(
  9. 'name' => __( 'Our Course' ),
  10. 'singular_name' => __( 'course' ),
  11. 'add_new' => __( 'Add New Course' ),
  12. 'add_new_item' => __( 'Add New Course' ),
  13. 'edit_item' => __( 'Edit Course' ),
  14. 'new_item' => __( 'New Course' ),
  15. 'view_item' => __( 'View Course' ),
  16. 'not_found' => __( 'Sorry, we could not find the Course you are looking for.' )
  17. ),
  18. 'public' => true,
  19. 'publicly_queryable' => false,
  20. 'exclude_from_search' => true,
  21. 'menu_position' => 14,
  22. 'has_archive' => false,
  23. 'hierarchical' => false,
  24. 'capability_type' => 'page',
  25. 'rewrite' => array( 'slug' => 'course' ),
  26. 'supports' => array( 'title','thumbnail','editor','excerpt')
  27. )
  28. );
  29. }
  30.  
  31.  
  32. add_action( 'init', 'create_post_type' );
  33.  
  34.  
  35.  
  36.  
  37.  
  38. index.php
  39. =========
  40.  
  41.  
  42. <?php if(!is_paged()) { ?>
  43. <?php
  44. $args = array( 'post_type' => 'all_course', 'posts_per_page' => 8 );
  45. $loop = new WP_Query( $args );
  46. ?>
  47. <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  48. <div class="col-md-3 col-sm-4 col-xs-12">
  49. <div id="course_animate_1" class="single-featured">
  50. <ul class="list-unstyled featured-list">
  51. <li>
  52. <?php the_post_thumbnail('image_of_course', array('class' => 'postthumbnails')); ?>
  53. </li>
  54. <li>
  55. <h2><?php the_title(); ?></h2>
  56. </li>
  57. </ul>
  58. <?php the_excerpt(); ?>
  59.  
  60. <div class="feature-title">
  61. <a href="<?php the_permalink(); ?>">Learn More</a>
  62. <ul class="list-unstyled list-inline pull-right">
  63. <li><a href="<?php the_permalink(); ?>"><i class="fa fa-chevron-right"></i></a>
  64. </li>
  65. </ul>
  66. </div>
  67. </div>
  68. </div>
  69.  
  70. <?php endwhile; ?>
  71. <?php wp_reset_query(); ?>
  72. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement