Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function($) {
- $('.tax-filter').click( function(event) {
- // Prevent default action - opening tag page
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- event.returnValue = false;
- }
- // Get tag slug from title attirbute
- var selecetd_taxonomy = $(this).attr('title');
- // After user click on tag, fade out list of posts
- $('.tagged-posts').fadeOut();
- data = {
- action: 'filter_posts', // function to execute
- afp_nonce: afp_vars.afp_nonce, // wp_nonce
- taxonomy: selecetd_taxonomy, // selected tag
- };
- $.post( afp_vars.afp_ajax_url, data, function(response) {
- if( response ) {
- // Display posts on page
- $('.tagged-posts').html( response );
- // Restore div visibility
- $('.tagged-posts').fadeIn();
- };
- });
- });
- });
- jQuery(document).ready(function($) {
- $('.term-filter').click( function(event) {
- // Prevent default action - opening tag page
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- event.returnValue = false;
- }
- // Get tag slug from title attirbute
- var selecetd_taxonomy = $(this).attr('title');
- // After user click on tag, fade out list of posts
- $('.tagged-posts').fadeOut();
- data = {
- action: 'filter_terms', // function to execute
- afp_nonce: afp_vars.afp_nonce, // wp_nonce
- taxonomy: selecetd_taxonomy, // selected tag
- };
- $.post( afp_vars.afp_ajax_url, data, function(response) {
- if( response ) {
- // Display posts on page
- $('.tagged-posts').html( response );
- // Restore div visibility
- $('.tagged-posts').fadeIn();
- };
- });
- });
- });
- jQuery(document).ready(function($) {
- $('.ajax-click').click( function(event) {
- // Prevent default action - opening tag page
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- event.returnValue = false;
- }
- // Get post ID from id attirbute
- var post_id = $(this).parent("li").attr("id");
- // After user click on tag, fade out list of posts
- $('#post-content').fadeOut();
- data = {
- action: 'load-content', // function to execute
- afp_nonce: afp_vars.afp_nonce, // wp_nonce
- post_id: post_id, // selected tag
- };
- $.post( afp_vars.afp_ajax_url, data, function(response) {
- if( response ) {
- // Display posts on page
- $('#post-content').html( response );
- // Restore div visibility
- $('#post-content').fadeIn();
- };
- });
- });
- });
Add Comment
Please, Sign In to add comment