How could I put UTF-8 encoding to the JSON feed? I’m Spanish and all the accents and accents don’t appear to me… I have to convert everything later. If I output it directly in UTF-8 it would save me time. Does anyone know how to do it?
]]>I have activated the plugin but the pages are continuing to be served out as normal. For instance…
mysite.com/feed/json/
– or –
mysite.com?cat=7/feed/json
They just return the page itself as normal instead of a json object.
Any suggestions or common issues? Thanks!
Hello,
Currently we are running into an issue where attempting to view the JSON feed for a category results in a 404 page. We have our settings enabled to remove the category base from our URL’s.
So for example, ../blog/category/travel/ is simply ../blog/travel/.
However this seems to cause a problem when going to /blog/travel/feed/json/ and results in a 404 page. If we disable the removal of the category base from URL’s than the feed can be pulled normally and everything is fine. The XML feed of /blog/travel/feed/ works fine as well too.
Best and thank you.
]]>Hello,
Is its also possible to creat an feed for Woocommerce products and not posts? If its possible can you explain us how it could work?
Thank you very much for the information.
]]>Hi, Is anyone using this with 5.9? I see json with a few fields including url, title, but I was expecting to see page content, which I do not. Not sure if my expectations are inline. The concept is quite cool. I am hoping to use it to create client side site search with lunr.js
{
"version": "https://jsonfeed.org/version/1.1",
"user_comment": "This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL -- https://10.0.0.73/json-2/feed/json/ -- and add it your reader.",
"home_page_url": "https://10.0.0.73/json-2/",
"feed_url": "https://10.0.0.73/json-2/feed/json/",
"language": "en-US",
"title": "Comments on: json"
}
]]>
Hi, I have already use this plugin and my jsonfeed file so large (around 700KB), After I try to minify this can reduce size around 50% to 350KB.
So It’s can increase our web performance and search engine scores
]]>Hey guys,
I’m interested in adding some extra data in the json feed, but the snippet example does not work:
function wp_custom_json_feed_fields( $feed_item, $post ){
$feed_item[‘author’][‘archive_link’] = get_author_posts_url( $post->post_author );
return $feed_item;
}
add_filter( ‘json_feed_item’, ‘wp_custom_json_feed_fields’, 10, 2);
I’ve added the above at the end of my theme’s functions.php file, and there are no changes.
EDIT: changing the quotes from ‘ to ‘ or ” seems to have fixed it!
I am trying to fetch json feed using Ajax request but it’s not working. it always results in error, I tried using jsonp or json as dataType, also “application/json”, “text/plain”, as contentType but still resulting in error.
Json feed: https://blog.piscessportfishing.com/feed/json/
Ajax code:
$.ajax({
type: 'GET',
url: "https://blog.piscessportfishing.com/feed/json/",
dataType: 'json',
data: {},
success: function(data) {
console.log(data);
},
error: function (Request, textStatus, errorThrown) {
alert("Request=" + Request.responseText + "\ntextStatus=" + textStatus + "\nerrorThrown=" + errorThrown);
}
});
]]>
Hello,
I’m trying to add json feed to a multingual site. It works fine for the main language (fr) but it fails to retrieve the items of the blog page for the english language (which is what i need). Any idea?
Many Thanks,
Nicolas
hello,
I have a few questions
1/ /feed/json the page works well, but is there any way to edit the metas (title and description) of the page ?
2/ is there any way to make it better looking with some css ?
3/ Should we add a noindex to the page ? (if we can’t edit the metas )
thanks.
]]>Buonasera. Io non ho capito il funzionamento del plugin. Una volta installato che cosa devo fare?
]]>Hello, Thank you for developing the plugin!
We just installed it but we are receiving the following error;
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Can you help?
Thank you in advance for your time!
Adam
Hi there,
I hope this is a useful question that could be of help to others. My objective is to add a medium sized image to the JSON feed, as otherwise we are loading the full size featured images which are provided in the feed.
My first observation is that the code provided that should “add a link to a post author’s archive page” does not seem to work – on our site I add the code to the functions.php of our child theme, but there is not change. I add:
function wp_custom_json_feed_fields( $feed_item, $post ){
$feed_item['author']['archive_link'] = get_author_posts_url( $post->post_author );
return $feed_item;
}
add_filter( 'json_feed_item', 'wp_custom_json_feed_fields', 10, 2);
I observe no change to the feed we have at https://impact.task.io/category/discover/feed/json
Am i doing something wrong? I assume adding this code to test at the bottom of functions.php is the correct thing to do?
The second question is to ask for some help on adding a pre-sized smaller image to the feed – so that in the JSON you would have image_medium or image_thumbnail – very useful if you want to list the images.
As I cannot get the above code to work i have not been able to test this but i guess I need something like the below code?
function wp_custom_json_feed_fields( $feed_item, $post ){
$feed_item['thumnail'] = get_the_post_thumbnail( $post->ID, 'medium' );
return $feed_item;
}
add_filter( 'json_feed_item', 'wp_custom_json_feed_fields', 10, 2);
Any help gratefully received.
Kind regards, Steve.
]]>I would like to use this with Modern Events Calendar, I have the feed working apart from one thing. The Original feed is ordered by the event date with the earliest event first, when I use the json feed it is always latest event first? Are there any parameters for ordering the json output?
Many Thanks
Tom
Hello!
I installed the JSON Feed plugin. Everything works in Google Chrome, and in Mozilla Firefox I get the error “SyntaxError: JSON.parse: expected ‘,’ or ‘}’ after property value in object at line 13 column 3776 of the JSON data”. How can I fix this? Thank you in advance!
Hi.
As the title says, ever since I’ve installed this plugin, I have only been able to see the last 10 blog posts in the feed. If I create another post, one drops off the end.
Hoping you can shed some light on this issue.
Kind regards
Ben
I can’t find where the plug in is activated to be able to insert the url.
]]>Hi,
I have a question regarding your plugin functionality. Does it work bi-directional? I mean, it allows our website to both receive and send data to the originator?
We look forward to hearing from you soon.
Best regards
Anthony
]]>Hi,
I have a JSON API and I want to import and map its data as separate custom post types. E.g. There is a picture filed in API that should be the Featured image, THere are also titles, body, excerpt, …
How is it possible to do that?
Hi
I managed to get this partially working only via another unanswered forum request on ‘Posts’ summaries and featured images not showing in JSON file'(+1 there), but overall there doesn’t seem to be any examples of how to implement a JSON feed with this plugin?
This plugin has so many potential uses, but can you please input with some basic code examples – say showing latest posts (with featured images) from Blog.
Thanks in advance
Glennyboy
Perhaps CORS headers could be added? Since without them, you can’t actually fetch the data via JS.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET');
Also, the ‘tested up to’ can probably be bumped to 4.9.6.
So I noticed that our JSON file was not collecting the posts’ summary or featured image with items.summary or items.image. I didn’t bother trying to code for them, seeing that they weren’t even in the JSON file itself. (attached below is my code)
Is there a way to have the JSON pull this data in so that I can include it in my feed?
<article class="band darkGreyBG feeder" style="background-image: url('/images/flag-capitol-bw-sm.jpg');">
<div class="overlay darkGreyGradient"></div>
<div class="wrap">
<h2 class="greenT">Recent Posts About Green Cards</h2>
<ul class="feedList"></ul>
<a class="feedButton button gold radius dropShadow noMin caps normWeight" target="_blank">View All Posts</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
$.get('https://learn.simplecitizen.com/category/live-in-usa/green-card/feed/json', function(data) {
var items = data.items;
$('a.feedButton').attr('href', data.feed_url);
$('a.feedButton').attr('href', function(u, url) {
var str = url.substring(url.lastIndexOf('/feed/') + 1);
return url.replace( new RegExp(str), '' );
});
for (var i = 0; i<=items.length; i++) {
var item = items[i];
date = new Date(item.date_published);
titleDiv = document.createElement('div');
titleDiv.innerHTML = item.title;;
title = titleDiv.textContent || titleDiv.innerText;
bodyDiv = document.createElement('div');
bodyDiv.innerHTML = item.content_html;;
summary = bodyDiv.textContent || bodyDiv.innerText;
if(summary.length > 100) summary = summary.substring(0,100);
// console.log(item);
$('ul.feedList').append('<li class=""><a href="' + item.url + '" target="_blank"><span class="postTitle greenT w400">' + title + '</span><span class="postSummary marTop20 w300">' + summary + '…</span><span class="postExtras marTop20"><span class="w700"><i class="fa fa-calendar-o greenT" aria-hidden="true"></i> ' + date.toDateString() + '</span><span class="w700"><i class="fa fa-user greenT" aria-hidden="true"></i> ' + item.author.name + '</span></a></li>');
}
});
});
</script>
</article>
]]>
We have installed the plugin and have everything set up, yet we are getting a 404 redirect, instead of the JSON.
Here’s an example https://learn.simplecitizen.com/category/live-in-usa/green-card/feed/json
]]>Can I use this to show an automatically/continually updating “recent posts” feed on a portion of our static html homepage?
]]>