Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Script for getting posts
- function ajax_filter_get_posts( $taxonomy ) {
- // Verify nonce
- if( !isset( $_POST['afp_nonce'] ) || !wp_verify_nonce( $_POST['afp_nonce'], 'afp_nonce' ) )
- die('Permission denied');
- $taxonomy = $_POST['taxonomy'];
- // WP Query
- $args = array(
- //'tag' => $taxonomy,
- 'post_type' => 'work',
- 'posts_per_page' => 1
- /*'tax_query' => array(
- array(
- 'taxonomy' => 'filters',
- 'terms' => array('100','99','154'),
- 'field' => 'id',
- 'operator' => 'NOT IN'
- )
- )*/
- );
- // If taxonomy is not set, remove key from array and get all posts
- /*if( !$taxonomy ) {
- unset( $args['tag'] );
- }*/
- $query = new WP_Query( $args );
- if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
- <!--<a href=""></a>-->
- <a href="http://www.youtube.com/watch?v=" class="prettyPhoto" title="">
- <img src="http://img.youtube.com/vi//2.jpg" class="prettyPhoto" title="">
- </a>
- <a href="http://vimeo.com/" class="prettyPhoto" title="">
- </a>
- <a href="#embedd-video" class="prettyPhoto" title="">
- </a>
- <a href="" class="prettyPhoto" title="">
- </a>
- <a href="" title="" class="pic">
- </a>
- <a href="" title="" class="video">
- <img src="http://img.youtube.com/vi//0.jpg" class="prettyPhoto" title="" width="215px">
- </a>
- <a href="" title="" class="pic">
- <img src="http://img.youtube.com/vi//0.jpg" class="prettyPhoto" title="" width="215px">
- </a>
- <a href=""></a>
- No posts found
- <?php
- endif;
- die();
- }
- add_action('wp_ajax_filter_posts', 'ajax_filter_get_posts');
- add_action('wp_ajax_nopriv_filter_posts', 'ajax_filter_get_posts');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement