Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading of posts/custom posts #135

Closed
Mte90 opened this issue Dec 22, 2015 · 28 comments
Closed

Loading of posts/custom posts #135

Mte90 opened this issue Dec 22, 2015 · 28 comments

Comments

@Mte90
Copy link

Mte90 commented Dec 22, 2015

With 2.0.0 alpha4 there are some problems with the loading of posts with the site mte90.net.
I've installed the last plugin version for the apiv2, with a clean project and changing only the baseurl only the pages are loaded, the posts and categories are ignored.
With another site when I try to use custom post type the list is not loaded, in the dev tools in the network section there are no request about that.
I've tried manually and the request working, they are not fast (1 second) but the response contain the json.

@shprink
Copy link
Collaborator

shprink commented Dec 22, 2015

WP-API api keeps changing as in beta. With beta 9 posts ans pages work,
taxonomies do not. You can checkout around beta4 or wait for WPHC to
update, will have a look tonight

On Tuesday, December 22, 2015, Daniele Scasciafratte <
[email protected]> wrote:

With 2.0.0 alpha4 there are some problems with the loading of posts with
the site mte90.net.
I've installed the last plugin version for the apiv2, with a clean project
and changing only the baseurl only the pages are loaded, the posts and
categories are ignored.
With another site when I try to use custom post type the list is not
loaded, in the dev tools in the network section there are no request about
that.
I've tried manually and the request working, they are not fast (1 second)
but the response contain the json.


Reply to this email directly or view it on GitHub
#135.

@shprink
Copy link
Collaborator

shprink commented Dec 22, 2015

as a reminder, v2 is in alpha version, api can and will change. Use v1.x to
have something stable.

On Tuesday, December 22, 2015, julien renaux [email protected]
wrote:

WP-API api keeps changing as in beta. With beta 9 posts ans pages work,
taxonomies do not. You can checkout around beta4 or wait for WPHC to
update, will have a look tonight

On Tuesday, December 22, 2015, Daniele Scasciafratte <
[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

With 2.0.0 alpha4 there are some problems with the loading of posts with
the site mte90.net.
I've installed the last plugin version for the apiv2, with a clean
project and changing only the baseurl only the pages are loaded, the posts
and categories are ignored.
With another site when I try to use custom post type the list is not
loaded, in the dev tools in the network section there are no request about
that.
I've tried manually and the request working, they are not fast (1 second)
but the response contain the json.


Reply to this email directly or view it on GitHub
#135.

@shprink
Copy link
Collaborator

shprink commented Dec 23, 2015

I have just released alpha5
https://github.com/shprink/wordpress-hybrid-client/blob/develop/CHANGELOG.md#200-alpha5-2015-12-22
you can use it with the latest version of WP-API (beta9)

@shprink shprink closed this as completed Dec 23, 2015
@shprink
Copy link
Collaborator

shprink commented Dec 23, 2015

You can try with mine. Everything is ok (though I have not tested custom posts and taxonomies)

http://dev.julienrenaux.fr/wp-json

@Mte90
Copy link
Author

Mte90 commented Dec 23, 2015

confirmed now works, i changed also the timeout to 100000 to work on my site (in future i change the hosting).

@Mte90
Copy link
Author

Mte90 commented Dec 23, 2015

Seems to not work with custom post types and custom taxonomies.
In console I don't get any info about the call for that requests.

@shprink
Copy link
Collaborator

shprink commented Dec 23, 2015

ok I'll have a look into those, they must have changed the API :(

@shprink shprink reopened this Dec 23, 2015
@Mte90
Copy link
Author

Mte90 commented Dec 23, 2015

but is possible get the errors for that in the console?
for v2 is easy now access to custom post types/custom taxonomies is like: wp-json/wp/v2/yourposttype

@shprink
Copy link
Collaborator

shprink commented Dec 23, 2015

If this has not changed it should work.

when I open http://localhost:8080/#/public/customPosts/customSlug

I get http://dev.julienrenaux.fr/wp-json/wp/v2/customSlug HTTP requests.

@Mte90
Copy link
Author

Mte90 commented Dec 23, 2015

In chrome I get in the console the requests, in Firefox remain the spinner animation and no requests in console.
I can see that the request in chrome have a value in the response tab but nothing is showed.

@shprink
Copy link
Collaborator

shprink commented Dec 23, 2015

do not use firefox. can you share the link to your custom post please? I
guess the reponse is not standard and a custom template will be needed

On Wednesday, December 23, 2015, Daniele Scasciafratte <
[email protected]> wrote:

In chrome I get in the console the requests, in Firefox remain the spinner
animation and no requests in console.
I can see that the request in chrome have a value in the response tab but
nothing is showed.


Reply to this email directly or view it on GitHub
#135 (comment)
.

@Mte90
Copy link
Author

Mte90 commented Dec 23, 2015

the site is omniasta.it and the custom post type is immobile and terreno, the custom taxonomy is provincia.

@shprink
Copy link
Collaborator

shprink commented Dec 24, 2015

thanks, working on it

On Wed, Dec 23, 2015 at 11:55 AM, Daniele Scasciafratte <
[email protected]> wrote:

the site is omniasta.it and the custom post type is immobile and terreno,
the custom taxonomy is provincia.


Reply to this email directly or view it on GitHub
#135 (comment)
.

@shprink
Copy link
Collaborator

shprink commented Dec 24, 2015

I am almost finished. I need some more time to introduce templating, will
work on it tomorrow as well. Stay tuned

On Wed, Dec 23, 2015 at 8:14 PM, julien renaux [email protected]
wrote:

thanks, working on it

On Wed, Dec 23, 2015 at 11:55 AM, Daniele Scasciafratte <
[email protected]> wrote:

the site is omniasta.it and the custom post type is immobile and terreno,
the custom taxonomy is provincia.


Reply to this email directly or view it on GitHub
#135 (comment)
.

@Prabhat36
Copy link

do you have zip file of plugin version 2 beta 7? if yes please give me the download link, because app works fine on beta 7..

@shprink
Copy link
Collaborator

shprink commented Dec 26, 2015

@shprink
Copy link
Collaborator

shprink commented Dec 27, 2015

Ok I have just pushed a WIP about templating.

if you pull develop and run npm run installWPHC you will have template folder with example of a custom posts type example. To add your custom post types templates copy/past these html examples and register them into the overwriteTemplates module (index.js of this new folder):

    $templateCache.put('customPost/example.html', require('!html!./customPost-example.html'));

Within your templates you can do whatever you want with the data you get from your server. Some examples are already present in lib/templates.

You can also overwrite any templates (post, posts, page, pages so far) also in the overwriteTemplates module.

I need to create some documentation about that and release a new version but you can start playing with it and ask questions about it here.

Cheers

@Prabhat36
Copy link

i dont understand.. what i exactly need to do? for making app work fine with beta9?

@Prabhat36
Copy link

hi, i have installed the beta7 but the app is not getting linked.. http://livenews.esamanjas.com/wp-json/ when i open this link it only refresh the home page.. that code dose not appears? help

@Mte90
Copy link
Author

Mte90 commented Dec 27, 2015

I don't understand the folders how I insert the file.
In folder config/templates I've created customPost and customPosts folder and copied the files customPost-example.html and customPosts-example.html with names of post types.
In console I get Error: Template customPosts/immobile.html does not exist

@shprink
Copy link
Collaborator

shprink commented Dec 27, 2015

@Mte90 You are really close!

add that:

$templateCache.put('customPost/immobile.html', require('!html!./customPost-immobile.html'));
$templateCache.put('customPosts/immobile.html', require('!html!./customPosts-immobile.html'));

customPost-immobile.html and customPosts-immobile.html must exist (the name can be anything, it is up to you) in the config/templates folder.

@shprink
Copy link
Collaborator

shprink commented Dec 27, 2015

There is a naming convention for customPosts:

customPosts/nameOfYourCustomPost.html for the list and customPost/nameOfYourCustomPost.html for a specific item.

@shprink
Copy link
Collaborator

shprink commented Dec 27, 2015

@Prabhat36 if http://livenews.esamanjas.com/wp-json does not display a json file it means you have an hosting problem (wrong configuration of your .htaccess or nginx config file). Check on the WP-API project documentation or contact your hosting for more details.

@Mte90
Copy link
Author

Mte90 commented Dec 28, 2015

Now I get a list of the custom posts type! wow!
The problem that is the single page of the custom post type is empty.

@shprink
Copy link
Collaborator

shprink commented Dec 28, 2015

Custom posts are by definition custom, you need to create your own template. You need some AngularJS skills but it should not be complicated.

@Mte90
Copy link
Author

Mte90 commented Dec 28, 2015

You are right, my fault was to use {{item.title.rendered}} instead {{customPostCtrl.item.title.rendered}}
Maybe the template examples need to be improved.

@shprink
Copy link
Collaborator

shprink commented Dec 29, 2015

yes, I'll be working on it thanks :)

@shprink shprink added this to the v2.0.0 milestone Jan 6, 2016
@shprink
Copy link
Collaborator

shprink commented Jan 8, 2016

v2.0.0-beta01 is released, templating and custom posts are taken care of.

https://github.com/shprink/wordpress-hybrid-client/blob/develop/CONFIGURATION.md#configtemplates

@shprink shprink closed this as completed Jan 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants