Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- functions.php
- --------------
- function create_post_type() {
- register_post_type( 'all_course',
- array(
- 'labels' => array(
- 'name' => __( 'Our Course' ),
- 'singular_name' => __( 'course' ),
- 'add_new' => __( 'Add New Course' ),
- 'add_new_item' => __( 'Add New Course' ),
- 'edit_item' => __( 'Edit Course' ),
- 'new_item' => __( 'New Course' ),
- 'view_item' => __( 'View Course' ),
- 'not_found' => __( 'Sorry, we could not find the Course you are looking for.' )
- ),
- 'public' => true,
- 'publicly_queryable' => false,
- 'exclude_from_search' => true,
- 'menu_position' => 14,
- 'has_archive' => false,
- 'hierarchical' => false,
- 'capability_type' => 'page',
- 'rewrite' => array( 'slug' => 'course' ),
- 'supports' => array( 'title','thumbnail','editor','excerpt')
- )
- );
- }
- add_action( 'init', 'create_post_type' );
- index.php
- =========
- <?php if(!is_paged()) { ?>
- <?php
- $args = array( 'post_type' => 'all_course', 'posts_per_page' => 8 );
- $loop = new WP_Query( $args );
- ?>
- <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
- <div class="col-md-3 col-sm-4 col-xs-12">
- <div id="course_animate_1" class="single-featured">
- <ul class="list-unstyled featured-list">
- <li>
- <?php the_post_thumbnail('image_of_course', array('class' => 'postthumbnails')); ?>
- </li>
- <li>
- <h2><?php the_title(); ?></h2>
- </li>
- </ul>
- <?php the_excerpt(); ?>
- <div class="feature-title">
- <a href="<?php the_permalink(); ?>">Learn More</a>
- <ul class="list-unstyled list-inline pull-right">
- <li><a href="<?php the_permalink(); ?>"><i class="fa fa-chevron-right"></i></a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- <?php endwhile; ?>
- <?php wp_reset_query(); ?>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement