I am trying to get my posts to display in the timeline. Any ideas on how to do this?
http://wordpress.org/extend/plugins/timeline-verite-shortcode/
I am trying to get my posts to display in the timeline. Any ideas on how to do this?
http://wordpress.org/extend/plugins/timeline-verite-shortcode/
The Timeline also work with JSON. You can use the JSON API plugin for WordPress and create a new controller following the example, see JSON tab here.
OK, I have got JSON API Installed and kind of get how it is working. I don't know much about JSON.
So if I put this link in my shortcode will this work?
Managed to create a new controller called Timeline. Now I just need to work out the code. Any help would be appreciated.
Would be cool to bundle a controller with the plugin to help other users. Is this something planned for the next release?
Slowly working my way through this. What I need to do is display the blog posts in the timeline:
[334 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
Hey, I enjoyed the idea so I made this code to support the basic WordPress post data inside Timeline, using the JSON API plugin with a custom cotroller.
Here's the code:
http://pastebin.com/SwbT2J9A
You should paste this under /wp-content/plugins/json-api/controllers/ as timeline.php
Default values:
category_id = null
post_type = 'post'
amount = -1 (all posts)
main_post_id = first post from query, ordered by date in ascending order (the main post should be an introduction to the timeline being viewed)
Content values can (and would be nice) be changed to support custom post meta for enhanced usage.
If you have any ideas to improve this code, let me know.
Oh, and the timeline shortcode should look like this:
[timeline src="http://example.com/api/timeline/category_posts/?category_id=123"]
Soon we'll have this integrated with the plugin, with more features and better management.
Very cool, I think this will be useful and very popular (Timelines are all the rage right now). I am going to give this a proper test over the weekend and will provide some more feedback for you.
Tried to do this but it gives me the endless "loading timeline" error
I'm getting the same endless "loading timeline" error...
Miguel,
Do you have an ETA on the integration with the plugin?
If you get the loading timeline error, make sure:
1. you pasted the timeline.php code above in your plugins directory
2. The shortcode [timeline src="http://example.com/api/timeline/category_posts/"] appears on your page in the page editor. There are additional options but that seems to be the minimum
@Miguel... That was very helpful... Thank you very much.
Now I've got a timeline with JSON working on WordPress :)
Thanks for this however I can only get the first slide to show, no text etc.
EDIT, working now added text excerpt but getting the 1:00 timestamp on the footer
hi,
it took me 2h to figure out, how this works... I've never heard of jason before. A short tutorial would have been nice and saved me a lot of time (I would make one. But i've currently no time. Perhaps in a few weeks if i still remember).
Anyway GREAT plugin!
Is it possible to style the timeline via the shortcode? I've seen there is a "dark" theme in the css folder. Can i activate different themes in the shortcode?
Hi,
I'm getting the "loading timeline" error... I have installed json API plugin and created timeline controller. But no help from this.
My shortcode is [timeline src="http://example.com/api/timeline/category_posts/"]
Please help me.
Raj-can you post a link to your site?
Hi,
I'm having loading timeline... msg endlessly?
I've installed json API plugin, added the timeline.php above script in the controller folder,
added the shortcode in my blog template but it seems to be in conflict with something...
Could it work if beeing in a post I put this post at bottom with a pullout plugin?
Thanks,
Janay
I also had similar problems by installing the Timeline. But everything works finde now. I can not exactly remember how i solved the problems, but i can give you some basic hints to figure it out by yourself.
Hi,
Doesn't work in wp page neather... :/
http://conexion.cluster003.ovh.net/blog/timeline/
[timeline src="http://conexion.cluster003.ovh.net/blog/api/timeline/category_posts/"] is in my page, timeline.php in json controller folder. What am I missing?
I'm in multisite, does it matter for this plugin?
Thanks for help,
Janay
@ kn1g,
Thanks a lot for your answer!!! XD
2)I've looked as you say @ http://conexion.cluster003.ovh.net/blog/api/timeline/category_posts/
it says :
{"status":"error","error":"Unknown controller 'timeline'."}
so you're right the controller seems not to work. Honestly I didn't knew Json or API (not even sure how it works...), I've just pasted the code above in a php file and uplaoded it in json/controller folder. Json plugin is activated. I don't know what else to do... :/ Can you help me figure out what I'm missing?
3) I do have only posts no custom post types you can see all of them here : http://conexion.cluster003.ovh.net/blog/welcome/ and event posts here : http://conexion.cluster003.ovh.net/blog/news/
As you can see I'm a french dancer and graphic designer but no developper...
Thanks,
Janay
@ kn1g
XD I found the solution : I just forgot to activate the timeline controller in WP Json plugin!!!
It works know...!!!
Just another question :
I've got a custom field called '_datepicker' for my posts in News category.
How could I intégrate them in the query so The News posts will be sorted by datepicker date and other posts by normal date all in the same timeline?
Thanks a lot for your help!!!
Janay
Hi,
How can I add custom fields to the timeline controller as get_post_meta doesn't work here :
Hope someone could help!
Thanks,
Janay
Hey, custom fields are a bit tricky.
I give you an example how i did it:
$example = get_post_meta($main_post->ID, "example", true); (thats for the main post - modifiy for other posts!). Add it BEFORE the $json['timeline'] = array();$json['timeline']['startDate'] = $example;That should work! I also have some problems with the timeline. Im currently trying to figure out, how to stick the main post always to the current date. I want to have past posts and future posts...
Anyway, i hope i could help you Janay! If not i can upload my code to pastebin. Just let me know!
Hi kn1g,
Thanks a lot for your answer. I already have my custom fields and used them in template. I've tried get_post_meta with json but not BEEFORE the $json['timeline'] = array(); if I remember ok. It didn't work out but I'm gonna try your suggestion and let you know.
I'll be interested too to have a main post introducing actual season with past and future posts... let me know. If I found something that might help I'll tell you.
Thanks,
Janay
Hi kn1g,
I've made it work for my custom date field now : Thanks a lot to YOU!!!
But I don't know how to add my 2 custom text fields :
I've tried this :
$json['timeline']['date'][$i]['startDate'] = date_i18n('Y,m,d', strtotime(get_post_meta($post->ID, "_datepicker", true)));
$json['timeline']['date'][$i]['endDate'] = date_i18n('Y,m,d', strtotime(get_post_meta($post->ID, "_datepicker", true)));
$json['timeline']['date'][$i]['headline'] = $post->post_title;
$json['timeline']['date'][$i]['lieu'] = $eventlieu;
$json['timeline']['date'][$i]['text'] = $post->post_excerpt;
$json['timeline']['date'][$i]['type'] = $eventtype;
but 'lieu' and 'type' doesen't show. Maybe I should concatenate them with div's in 'text'. Do you know how I could concatenate them with div's separating?
Thanks,
Janay
Sorry I forgot,
I wanted the title in timeline to be a link to corresponding post, do you know how I could achieve this?
Janay
answered for title link:
$json['timeline']['date'][$i]['headline'] = '<a href="'.get_permalink($post->ID).'">'.$post->post_title.'</a>';
@Miguel Peixe
problems retrieving data from Advanced Custom Field checkbox (with multiple checks possible) whatever I try `if(is_array($eventtypes)) {
foreach ($eventtypes as $key => $eventtype) {
$typelist .= $eventtype . '| ';
}
$typelist = substr($typelist, 0, -2);` or implode() etc still output :
Array ???
Does somedody can help?
Janay
hi janay,
i think the problem with more custom fields is complicated. Because i think, that you cant solve this in the "timline.php" alone. The timeline.php just outputs the values. To check if the values are outputted correct, check the controller output as i posted above. (I think this will work correctly) - If your custom fields are outputted correct by the controller. The job of the "timeline.php" is done.
Now you need to get deeper into the code. Can't help you there at the moment.
Janay,
I'm still not totally sure what you're trying to do, but here's how I got ACF to work:
This topic has been closed to new replies.