Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-------------Mixit up Dynamic---------->
- -----------------------------------------------WordPress Template Code:---------------------------------------
- <div class="col-md-12">
- <!-- Filters -->
- <?php if(!is_tax()) {
- $terms = get_terms("days");
- $count = count($terms);
- if ( $count > 0 ){ ?>
- <ul id="filterOptions" class="tonight-filter-list clearfix">
- <li class="filter" data-filter="all"><?php _e('All', 'listify'); ?></li>
- <?php foreach ( $terms as $term ) {
- echo '<li class="filter" data-filter="'.$term->slug.'">'. $term->name .'</li>';
- } ?>
- </ul><?php } } ?>
- </div>
- <div class="col-md-12">
- <ul id="tonight" class="tonight-images">
- <?php
- $tonight_post = new WP_Query(array(
- 'post_type' => 'tonight'
- ));?>
- <li <?php post_class('mix');?>><?php the_post_thumbnail('tonight', array('class' => 'tonightmix'));?></li>
- <?php endwhile;?>
- </ul>
- </div>
- ------------------------------------------------------------------functions.php Code------------------------------------
- /* ----------------------------------------------------- */
- /* Register Custom Post */
- /* ----------------------------------------------------- */
- add_action( 'init', 'register_listify_portfolio' );
- function register_listify_portfolio() {
- $labels = array(
- 'name' => __( 'Tonight','listify'),
- 'singular_name' => __( 'Tonight','listify'),
- 'add_new' => __( 'Add New','listify' ),
- 'add_new_item' => __( 'Add New Day','listify' ),
- 'edit_item' => __( 'Edit Day','listify'),
- 'new_item' => __( 'New Day','listify'),
- 'view_item' => __( 'View Day','listify'),
- 'search_items' => __( 'Search Tonight','listify'),
- 'not_found' => __( 'No tonight found','listify'),
- 'not_found_in_trash' => __( 'No day found in Trash','listify'),
- 'parent_item_colon' => __( 'Parent day:','listify'),
- 'menu_name' => __( 'Tonight','listify'),
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => false,
- 'description' => 'Display your day by filters',
- 'supports' => array( 'title', 'custom-fields', 'thumbnail' ),
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'show_in_nav_menus' => false,
- 'publicly_queryable' => true,
- 'exclude_from_search' => false,
- 'has_archive' => true,
- 'query_var' => true,
- 'can_export' => true,
- 'rewrite' => true,
- 'capability_type' => 'post'
- );
- register_post_type( 'tonight', $args );
- }
- /* ----------------------------------------------------- */
- /* Filter Taxonomy */
- /* ----------------------------------------------------- */
- add_action( 'init', 'register_taxonomy_filters_listify' );
- function register_taxonomy_filters_listify() {
- $labels = array(
- 'name' => __( 'Day', 'listify' ),
- 'singular_name' => __( 'Day', 'listify' ),
- 'search_items' => __( 'Search Day', 'listify' ),
- 'popular_items' => __( 'Popular Day', 'listify' ),
- 'all_items' => __( 'All Days', 'listify' ),
- 'parent_item' => __( 'Parent Day', 'listify' ),
- 'parent_item_colon' => __( 'Parent Day:', 'listify' ),
- 'edit_item' => __( 'Edit Day', 'listify' ),
- 'update_item' => __( 'Update Day', 'listify' ),
- 'add_new_item' => __( 'Add New Day', 'listify' ),
- 'new_item_name' => __( 'New Day', 'listify' ),
- 'separate_items_with_commas' => __( 'Separate Day with commas', 'listify' ),
- 'add_or_remove_items' => __( 'Add or remove Day', 'listify' ),
- 'choose_from_most_used' => __( 'Choose from the most used Day', 'listify' ),
- 'menu_name' => __( 'Days', 'listify' ),
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'show_in_nav_menus' => false,
- 'show_ui' => true,
- 'show_tagcloud' => false,
- 'hierarchical' => true,
- 'rewrite' => true,
- 'query_var' => true
- );
- register_taxonomy( 'days', array('tonight'), $args );
- }
- /*
- * Adds terms from a custom taxonomy to post_class
- */
- add_filter( 'post_class', 'theme_t_wp_taxonomy_post_class', 10, 3 );
- function theme_t_wp_taxonomy_post_class( $classes, $class, $ID ) {
- $taxonomy = 'days';
- $tt = get_the_terms( (int) $ID, $taxonomy );
- if( !empty( $tt ) ) {
- foreach( (array) $tt as $order => $term ) {
- if( !in_array( $term->slug, $classes ) ) {
- $classes[] = $term->slug;
- }
- }
- }
- return $classes;
- }
- --------------------------------------------------------jQuery code--------------------------------------
- //mixitup
- jQuery(function(){
- // Instantiate MixItUp:
- jQuery('#tonight').mixItUp();
- });
- ------------------------------------------------CSS CODE----------------
- #tonight .mix{
- display: none;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement