Alekie
Forum Replies Created
-
Forum: Plugins
In reply to: [JWT Authentication for WP REST API] JWT Authentication + Woocommerce + WPMLCheck this thread it may give you some pointers on why you may be having some issues……
https://wpml.org/forums/topic/retrieve-all-languages-entries-of-a-post_type-by-wp-rest-api/
Go to the list of routes available and check if your route is listed:
this would be https://localhost/wp-json
or https://localhost/index.php/wp-jsonYou’ll see all routes, their http verb and the required parameters if any.
Here is some typescript code you can wrangle whatever you need out of it….
For this to work you need to install WP REST USER plugin to add a route to create users, WordPress API does not allow you to add users out of the box even if JWT plugin is installed
This is code from my register page
onSubmit(values) { let user_data = { username: values.username, name: values.fullname, email: values.username, password: values.password, phone: values.phone, }; this.authService.doRegister(user_data) .subscribe( result => { console.log(result); }, error => { console.log(error); } );
In the authservice class
doRegister(user_data){ return this.http.post('your wordpress url here' + '/wp-json/wp/v2/users/register', user_data); }
- This reply was modified 6 years ago by Alekie. Reason: formatting
Forum: Fixing WordPress
In reply to: PHP if to remove divI used this once in my template and it worked out well for me. I would retrieve the page name or post name and decide based on this what to show…
$pageslug = $post->post_name; // name of the page (slug) or post $catslug = get_category_by_slug($pageslug); // get category of the same slug $catid = $catslug->term_id; // get id of this category $query= 'cat=' . $catid. ''; //Get the cat query_posts($query); // run a query if you so wish //For example here am testing for the contact us page - can't recall if it worked with default or pretty permalinks may be try both //this can also test for $catslug i.e category if (!($pageslug == "contact-us")){ //Do my stuff here based on the slug test }?>
Turns out the file permission in the server were not allowing wordpress to execute the htaccess file.