Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // html, css and jquery part
- /* html img size 300 x 200*/
- call js - <!--call jquery.mixitup.js-->
- <script src="js/jquery.mixitup.js"></script>
- <div class="mixi_tup_all">
- <div class="mixi_tup_filter">
- <ul class="mixi_tup_menu">
- <li class="filter" data-filter="all">All</li>
- <li class="filter" data-filter=".website">Web design</li>
- <li class="filter" data-filter=".web">Web</li>
- <li class="filter" data-filter=".video">video</li>
- <li class="filter" data-filter=".illustration">illustration</li>
- <li class="filter" data-filter=".audio">audio</li>
- </ul>
- </div>
- <div id="mix_container">
- <div class="mix website web single_project">
- <div class="color_overlay"></div>
- <div class="project_hover">
- <h2>this is title</h2>
- <a href=""><i class="fa fa-link"></i></a>
- <a href=""><i class="fa fa-search"></i></a>
- </div>
- <img src="images/single_project.jpg" alt="" />
- </div>
- <div class="mix web website illustration audio single_project">
- <div class="color_overlay"></div>
- <div class="project_hover">
- <h2>this is title</h2>
- <a href=""><i class="fa fa-link"></i></a>
- <a href=""><i class="fa fa-search"></i></a>
- </div>
- <img src="images/single_projet_two.jpg" alt="" />
- </div>
- <div class="mix video web website illustration audio single_project">
- <div class="color_overlay"></div>
- <div class="project_hover">
- <h2>this is title</h2>
- <a href=""><i class="fa fa-link"></i></a>
- <a href=""><i class="fa fa-search"></i></a>
- </div>
- <img src="images/single_project.jpg" alt="" />
- </div>
- <div class="mix illustration web website single_project">
- <div class="color_overlay"></div>
- <div class="project_hover">
- <h2>this is title</h2>
- <a href=""><i class="fa fa-link"></i></a>
- <a href=""><i class="fa fa-search"></i></a>
- </div>
- <img src="images/single_projet_two.jpg" alt="" />
- </div>
- <div class="mix audio website illustration single_project">
- <div class="color_overlay"></div>
- <div class="project_hover">
- <h2>this is title</h2>
- <a href=""><i class="fa fa-link"></i></a>
- <a href=""><i class="fa fa-search"></i></a>
- </div>
- <img src="images/single_project.jpg" alt="" />
- </div>
- </div>
- </div>
- /*css*/
- /*mixitup*/
- ul.mixi_tup_menu {text-align: center;}
- ul.mixi_tup_menu li{cursor: pointer;display: inline-block;padding: 10px;}
- .mixi_tup_all{clear: both;
- overflow: hidden;
- }
- #mix_container{margin-left: -10px;
- overflow: hidden;}
- .single_project{margin-left: 10px;float: left;width: 313px;position:relative;}
- .color_overlay{background:red;display: block;height: 100%;left: 0;
- position: absolute;top: 0;width: 100%;z-index: 9999;opacity:.4;display:none;}
- .project_hover{position:absolute;top:0;left:0;width:100%;height:100%;background:#6666cc;text-align: center;display:none;z-index:999;}
- .single_project:hover .project_hover, .single_project:hover .color_overlay{display:block;}
- .project_hover a {background: none repeat scroll 0 0 #ffffff;padding: 8px;display:inline-block;}
- .project_hover a:hover{background:#9933cc;}
- .project_hover h2 {margin: 22px auto;font-size: 24px;}
- .mix{display:none;}
- .slider_area{position:relative;}
- .slider_area_preloader{}
- .slider_area_preloader_active{background: none repeat scroll 0 0 #808080;
- display: block;
- height: 100%;
- left: 50%;
- margin-left: -480px;
- position: absolute;
- top: 13%;
- width: 960px;
- z-index: 9;}
- /*jquery*/
- $(document).ready(function(){
- // Target your .container, .wrapper, .post, etc.
- $('#mix_container').mixItUp({
- animation: {
- effects: 'rotateX'
- }
- });
- });
- /*mixitup My code in wp twentytwelve theme */
- /*in functions.php*/
- /* Add Theme Support for Post Thumbnails*/
- add_theme_support( 'post-thumbnails' );
- add_image_size( 'mixitup_mage', 320, 250, true );
- // Register Custom Post
- function mixitup_post_type_f() {
- /* this is for create custom post */
- register_post_type( 'mixitup_post',
- array(
- 'labels' => array(
- 'name' => __( 'Mixitups' ),
- 'singular_name' => __( 'Mixitup' ),
- 'add_new' => __( 'Add New ' ),
- 'add_new_item' => __( 'Add New Mixitup 320 x 250' ),
- 'edit_item' => __( 'Edit Mixitup' ),
- 'new_item' => __( 'New Mixitup' ),
- 'view_item' => __( 'View Mixitup' ),
- 'not_found' => __( 'Sorry, we couldn\'t find the Mixitup you are looking for.' )
- ),
- 'public' => true,
- 'menu_icon' => ('dashicons-sos'),
- 'publicly_queryable' => true,
- 'exclude_from_search' => true,
- 'menu_position' => 3,
- 'has_archive' => true,
- 'hierarchical' => true,
- 'capability_type' => 'post',
- 'rewrite' => array( 'slug' => 'mixitup' ),
- 'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail' )
- )
- );
- }
- add_action( 'init', 'mixitup_post_type_f' );
- // Register Custom Taxonomy
- function mixitup_taxonomy_f() {
- register_taxonomy(
- 'mixitup_taxonomy_cat', /*The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
- eta unic hobe post quary r somoy eta lagbe like
- 'slider_cat' => 'slider photo'*/
- 'mixitup_post', /*post type je name reg kora ache (poster itemer nam)*/
- array(
- 'hierarchical' => true,
- 'label' => 'Mixitup Category', /*Display name(eta) displete dakhabe */
- 'query_var' => true,
- 'rewrite' => array(
- 'slug' => 'mixitup-category', // This controls the base slug that will display before each term
- 'with_front' => false // Don't display the category base before
- )
- )
- );
- }
- add_action( 'init', 'mixitup_taxonomy_f');
- /*
- * Adds terms from a custom taxonomy to post_class
- */
- add_filter( 'post_class', 'mixitup_taxonomy_post_class', 10, 3 );
- function mixitup_taxonomy_post_class( $classes, $class, $ID ) {
- $taxonomy = 'mixitup_taxonomy_cat';
- $terms = get_the_terms( (int) $ID, $taxonomy );
- if( !empty( $terms ) ) {
- foreach( (array) $terms as $order => $term ) {
- if( !in_array( $term->slug, $classes ) ) {
- $classes[] = $term->slug;
- }
- }
- }
- return $classes;
- }
- // in index.php or custom template etc
- <div class="mixi_tup_all">
- <div class="mixi_tup_filter">
- <!-- menu filter -->
- <?php if(!is_tax()) {
- $terms = get_terms("mixitup_taxonomy_cat");
- $count = count($terms);
- if ( $count > 0 ){ ?>
- <ul class="mixi_tup_menu">
- <li class="filter" data-filter="all"><?php _e('All'); ?></li>
- <?php
- foreach ( $terms as $term ) {
- echo '<li class="filter" data-filter=".'.$term->slug.'">'. $term->name .'</li>';
- } ?>
- </ul>
- <?php } } ?>
- </div>
- <div id="mix_container">
- <?php
- global $post;
- $args = array( 'posts_per_page' => -1, 'post_type'=> 'mixitup_post',);
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- <!-- call taxonomi as post class -->
- <div <?php post_class('mix single_project'); ?>>
- <div class="color_overlay"></div>
- <div class="project_hover">
- <h2><?php the_title(); ?></h2>
- <a href=""><i class="fa fa-link"></i></a>
- <a href=""><i class="fa fa-search"></i></a>
- </div>
- <?php the_post_thumbnail('mixitup_mage'); ?>
- </div>
- <?php endforeach; ?>
- </div>
- <!-- shortcode -->
- /*[mixitup_shortcode]
- need to change - 'mixitup_post'
- 'mixitup_taxonomy_cat'
- html markap
- */
- function mixitup_shortcode_f($atts){
- extract( shortcode_atts( array(
- 'category' => ''
- ), $atts, 'mixitup_shortcode' ) );
- $q = new WP_Query(
- array('posts_per_page' => '-1', 'post_type' => 'mixitup_post')
- );
- //Portfolio taxanomy query
- $args = array(
- 'post_type' => 'mixitup_post',
- 'paged' => $paged,
- 'posts_per_page' => $data['portfolio_items'],
- );
- $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, 'mixitup_taxonomy_cat', 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;
- }
- }
- }
- } //Here must be used category name (mixitup_taxonomy_cat).
- if(is_array($portfolio_taxs) && !empty($portfolio_taxs) && get_post_meta($post->ID, 'pyre_portfolio_filters', true) != 'no'):
- ?>
- <!-- Here is HTML nav menu and Query -->
- <div class="mixi_tup_all">
- <div class="mixi_tup_filter">
- <ul class="mixi_tup_menu">
- <li class="filter" data-filter="all">All</li>
- <?php foreach($portfolio_taxs as $portfolio_tax_slug => $portfolio_tax_name): ?>
- <li class="filter" data-filter=".<?php echo $portfolio_tax_slug; ?>"><?php echo $portfolio_tax_name; ?></li>
- <?php endforeach; ?>
- </ul>
- </div>
- <?php endif; ?>
- <?php
- $list = '
- <div id="mix_container">';
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID();
- $small_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'mixitup_img' );
- //Get Texanmy class
- $item_classes = '';
- $item_cats = get_the_terms($post->ID, 'mixitup_taxonomy_cat');
- if($item_cats):
- foreach($item_cats as $item_cat) {
- $item_classes .= $item_cat->slug . ' ';
- }
- endif;
- $list .= '<div class="mix single_project '.$item_classes.'">
- <div class="color_overlay"></div>
- <div class="project_hover">
- <h2><?php the_title(); ?></h2>
- <a href=""><i class="fa fa-link"></i></a>
- <a href=""><i class="fa fa-search"></i></a>
- </div>
- <img src="'.$small_image_url[0].'" alt="">
- </div>
- ';
- endwhile;
- $list.= '</div></div>';
- wp_reset_query();
- return $list;
- }
- add_shortcode('mixitup_shortcode', 'mixitup_shortcode_f');
- // use - [mixitup_shortcode]
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement