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

Fix when visiting News Archive tag direct link #3

Merged
merged 1 commit into from Apr 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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