Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3 from szk11001/master
Fix when visiting News Archive tag direct link
  • Loading branch information
bcd04001 committed Apr 16, 2015
2 parents b9e9ad0 + f77e8c2 commit d9c0b15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
18 changes: 7 additions & 11 deletions functions.php
Expand Up @@ -328,8 +328,7 @@ function prefix_ajax_clas_post_content() { //Retrieves post info and content for
$object->link = $link;
$object->slug = $slug;
$object->id = $id;
header('Content-type: application/json');
echo json_encode($object);
echo wp_json_encode($object);
die();
}
add_action( 'wp_ajax_clas_tag_posts', 'prefix_ajax_clas_tag_posts' );
Expand All @@ -349,8 +348,7 @@ function prefix_ajax_clas_tag_posts() { //Retieves posts of a specific tag, usin
$object->$k->title = $title;
$object->$k->postID = $id;
}
header('Content-type: application/json');
echo json_encode($object);
echo wp_json_encode($object);
die();
}

Expand All @@ -365,8 +363,9 @@ function prefix_ajax_clas_cat_posts() { //Retieves posts of a specific category
$taxName = get_cat_name($val);
} else if( $tax == 'tag' ) {
$args = "tag_id=".$val."&orderby=post-date&field=ids&numberposts=-1";
$taxName = get_term( $val, 'tag' )->slug;
$taxName = get_term_by( 'id', $val, 'post_tag' )->slug;
}

$ids = get_posts( $args );
if( $val == "0" ){
$ids = get_posts( 'category=19&orderby=post-date&field=ids&numberposts=-1' );
Expand All @@ -381,8 +380,7 @@ function prefix_ajax_clas_cat_posts() { //Retieves posts of a specific category
$object->$k->taxName = $taxName;

}
header('Content-type: application/json');
echo json_encode($object);
echo wp_json_encode($object);
die();
}

Expand All @@ -404,8 +402,7 @@ function prefix_ajax_clas_search_archive() { //Retieves posts of a specific cate
}
}

header('Content-type: application/json');
echo json_encode($object);
echo wp_json_encode($object);
die();
}

Expand All @@ -426,8 +423,7 @@ function prefix_ajax_clas_orderby_posts() { //Retrieves and sorts posts by date
$object->$k->title = $title;
$object->$k->postID = $id;
}
header('Content-type: application/json');
echo json_encode($object);
echo wp_json_encode($object);
die();
}

Expand Down
4 changes: 2 additions & 2 deletions js/custom.js
Expand Up @@ -264,7 +264,7 @@ jQuery(document).ready(function($) {
var taxCap = response[0].taxName.charAt(0).toUpperCase() + response[0].taxName.slice(1);
var tax = taxonomy.charAt(0).toUpperCase() + taxonomy.slice(1);
currentTaxonomy.set(tax, taxCap);
History.pushState(response, response[0].taxName, url);
History.pushState(response, taxCap, url);
var postID = $('ul.news-archive-list li a').first().attr('title');
var data = {
action: 'clas_post_content',
Expand Down Expand Up @@ -417,7 +417,7 @@ jQuery(document).ready(function($) {
postdate: '',
image: ''
});
}
}//endif
}, "json"
);
return false;
Expand Down

0 comments on commit d9c0b15

Please sign in to comment.