|
|
| Major features in BE REST Endpoints include: Wordpress Tutorial |
|
Noted That:
|
|
Start the Tips:
Step-1 : Download " be-rest-endpoints.zip " to Your Local Computer. Step-2 : Then, Login to your " yourdomain.com/wp-admin " Dashboard.
Step-3 : Then, Click on " Plugins " + " Add New " from left Side Menu of Dashboard.
Step-4 : Now, Click on " Upload Plugin " button.
Step-5 : Now, Browse " be-rest-endpoints.zip " Downloaded plugin from your computer, Where you downloaded " be-rest-endpoints.zip " According to Step – 1 Above then, click on " Install Now "
Step-6 : Now, Click on " Active Plugin "
Step-7 : Then, See left Side Menu. " Be Rest Endpoints " folder is added on left Side Menu. Now, Click on " Be Rest Endpoints " folder. Noted that: If you do not see " Be Rest Endpoints " folder on left Side Menu then, see at left Side Menu " Settings " or " Tools ". Step-8 : Now you configure yourself oR Watch video tutorial below about Be Rest Endpoints Configurations and Settings or How to work " Be Rest Endpoints " in your WordPress site. oRAfter Activated Plugin According to Step-6 then,
|
| Guide |
|---|
|
Install WP REST API v2 and activate it. (https://wordpress.org/plugins/rest-api/) Upload the BE REST Endpoints plugin to your site, Activate it. 1, 2, 3: You’re done! Endpoints can be accessed at /wp-json/be/v1/widgets/ and /wp-json/be/v1/sidebars
Lets talk about more interesting stuff now! Note: text-2 would already have to exist.
For a widget instance:
For a sidebar:
Cool!!! Now you can make that JavaScript based theme you’ve been wanting to do. Lets create a widget via the WP REST API! First, there are a couple of query parameters to go over. widget_base -> is the type of widget you want to create. REQUIRED PARAMETER. sidebar_id -> is the id of the sidebar you want to place the widget into. REQUIRED PARAMETER.
sidebar_position
->
is the numeric position of where you want to place the widget in the sidebar. Now lets do some REST requests. Create a text widget in sidebar-1: POST /wp-json/be/v1/widgets/?widget_base=text&sidebar_id=sidebar-1 Create a tag cloud widget in sidebar-1 after our text widget we just made: POST /wp-json/be/v1/widgets/?widget_base=tag_cloud&sidebar_id=sidebar-1&sidebar_position=2
Now we are cooking. But wait our new awesome widgets are just empty shells ????
You can do these tests in twenty sixteen because it has multiple sidebars.
The instance of the widget is what holds it’s dynamic data. You must look at the code to know the values that need to be updated. Lets create a calendar widget. Create calendar widget: POST /wp-json/be/v1/widgets/?widget_base=calendar&sidebar_id=sidebar-1 We are returned the widget instance. A JSON object that would look like this. {
}
So at the numeric index 2 matching calendar-2 we see that this is a simple widget. POST /wp-json/be/v1/widgets/calendar-2?title=Made by REST API Voila! Are calendar widget has a fancy new title. What if we need to move its position though since we want it at the bottom of our sidebar. POST /wp-json/be/v1/widgets/calendar-2?sidebar_position=3 There it is at the end of the sidebar. But wait what I really wanted was for it to be in the other sidebar. No problem. POST /wp-json/be/v1/widgets/calendar-2?sidebar_id=sidebar-2 Done. So you also combine these as well lets take our text widget we created and move it to the after the calendar in sidebar-2. POST /wp-json/be/v1/widgets/text-2?title=Moved&text=Yes+it+moved&sidebar_id=sidebar-2&sidebar_position=2 I forgot that I didn’t want to do any of this. Luckily, we have delete as well. Lets clean up. Delete our widgets:
DELETE wp-json/be/v1/widgets/calendar-2
The unique IDs for widgets will incrementally increase. If you create three text widgets you would have text-2, text-3, text-4. If you have any questions feel free to contact us at (http://be-webdesign.com/contact/) |
| Name |
|---|