how to get wordpress post based on user id .how can i do that in ionic.plese help me anyone.
In Ionic you can’t do that. You can only use Ionic to call an API that does that. Wordpress does have an API, maybe it supports this.
I am facing same problem, users are showing but their posts not showing. here is an example http://wphc.julienrenaux.fr in this app authors posts are showing.
I have fixed the problem, now specific authors posts are showing wp-json/wp/v2/posts?author=1 or 2
@Sujan12 its is possible to do.
here is my source code
selectedItem: any;
private url: string="mydomianname/myquotes/wp-json/wp/v2/posts?author";
authorID: string;
public items =[]; //For categroy posts will show in detail page
constructor(public navCtrl: NavController, public navParams: NavParams, private http: Http) {
//If we navigated to this page, we will have an item available as a nav param
this.selectedItem = navParams.get('item');
}
ionViewDidLoad() {
this.authorID=this.selectedItem.id
this.http.get(this.url+"="+this.authorID)
.map(res => res.json())
.subscribe(data => {
//we've got back the raw data, now generate the core schedule data
//and save the data for later reference
this.items = data;
});
}
1 Like