Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--=== Content Part ===-->
- <div class="container">
- <div class="row-fluid">
- <div id="id">
- <?php
- $q = new WP_Query(
- array('posts_per_page' => '-1', 'post_type' => 'portfolio')
- );
- //Portfolio taxanomy query
- $args = array(
- 'post_type' => 'portfolio',
- 'paged' => $paged,
- 'posts_per_page' => '10',
- );
- $portfolio = new WP_Query($args);
- if(is_array($portfolio->posts) && !empty($portfolio->posts)) {
- foreach($portfolio->posts as $gallery_post) {
- $post_taxs = wp_get_post_terms($gallery_post->ID, 'portfolio_category', array("fields" => "all"));
- if(is_array($post_taxs) && !empty($post_taxs)) {
- foreach($post_taxs as $post_tax) {
- $portfolio_taxs[$post_tax->slug] = $post_tax->name;
- }
- }
- }
- }
- ?>
- <?php if(is_array($portfolio_taxs) && !empty($portfolio_taxs) && get_post_meta($post->ID, 'pyre_portfolio_filters', true) != 'no') ?>
- <div class="sort" id="sort">
- <ul class="unstyled inline">
- <li><a href="#" class="all selected">Alle</a></li>
- <?php foreach($portfolio_taxs as $portfolio_tax_slug => $portfolio_tax_name): ?>
- <li><a href="#" class="<?php echo $portfolio_tax_slug; ?>"><?php echo $portfolio_tax_name; ?></a></li>
- <?php endforeach; ?>
- </ul>
- </div>
- <ul class="portfolio recent-work clearfix">
- <?php
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID();
- $portfolio_subtitle = get_post_meta($idd, 'portfolio_subtitle', true);
- $filterr = get_post_meta($idd, 'filterr', true);
- $small_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'project_small_image' );
- $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'project_large_image' );
- //$small_image_url = the_post_thumbnail('project_smal_image', array('class' => 'post-thumb'));
- //Get Texanmy class
- $item_classes = '';
- $item_cats = get_the_terms($post->ID, 'portfolio_category');
- if($item_cats):
- foreach($item_cats as $item_cat) {
- $item_classes .= $item_cat->slug . '';
- }
- endif;
- ?>
- <li data-id="id-100" class="<?php echo $item_classes; ?>">
- <a href="#">
- <em class="overflow-hidden"><img src="img/b.jpg" alt="" /></em>
- <span>
- <strong><?php the_title(); ?></strong>
- <i>Anim pariatur cliche reprehenderit</i>
- </span>
- </a>
- </li>
- <?php endwhile; ?>
- <?php wp_reset_query(); ?>
- </ul>
- </div>
- </div><!--/row-fluid-->
- </div><!--/container-->
- function.php
- ===============================
- function create_post_type() {
- register_post_type( 'portfolio',
- array(
- 'labels' => array(
- 'name' => __( 'Portfolio' ),
- 'singular_name' => __( 'Portfolio' ),
- 'add_new' => __( 'Add New' ),
- 'add_new_item' => __( 'Add New Portfolio' ),
- 'edit_item' => __( 'Edit Portfolio' ),
- 'new_item' => __( 'New Portfolio' ),
- 'view_item' => __('portfolio'),
- 'not_found' => __( 'Sorry, we couldnt find the Portfolio you are looking for.' )
- ),
- 'public' => true,
- 'publicly_queryable' => true,
- 'exclude_from_search' => true,
- 'menu_position' => 14,
- 'has_archive' => false,
- 'hierarchical' => false,
- 'capability_type' => 'page',
- 'rewrite' => array( 'slug' => 'portfolio' ),
- 'supports' => array( 'title', 'editor', 'custom-fields','thumbnail')
- )
- );
- }
- add_action( 'init', 'create_post_type' );
- function custom_post_taxonomy() {
- register_taxonomy(
- 'portfolio_category', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
- 'portfolio', //post type name
- array(
- 'hierarchical' => true,
- 'label' => 'Portfolio Category', //Display name
- 'query_var' => true,
- 'show_admin_column' => true,
- 'rewrite' => array(
- 'slug' => 'portfolio-category', // This controls the base slug that will display before each term
- 'with_front' => true // Don't display the category base before
- )
- )
- );
- }
- add_action( 'init', 'custom_post_taxonomy');
Advertisement
Add Comment
Please, Sign In to add comment