Categories
Last updated
Last updated
The WP Mobile Pack content API implements a series of endpoints that are responsible for exporting categories. These are as follows:
All URL’s are relative to the WP Mobile Pack installation folder, typically located at /wp-content/plugins/wordpress-mobile-pack.
Relative FREE URL:/wp-content/plugins/wordpress-mobile-pack/export/content.php?content=exportcategories&callback=CallbackMethod
Relative PRO URL: /wp-content/plugins/wordpress-mobile-pack-pro/frontend/export/content.php?content=exportcategories&callback=CallbackMethod
Sample code: on Gist
Parameters:
Response type: JSONP
Response format (for a category):
Relative FREE URL:/wp-content/plugins/wordpress-mobile-pack/export/content.php?content=exportcategory&categoryId=0&callback=CallbackMethod
Relative PRO URL: /wp-content/plugins/wordpress-mobile-pack-pro/frontend/export/content.php?content=exportcategory&categoryId=0&callback=CallbackMethod
Parameters:
Response type: JSONP
Response format:
Category format
Endpoint
Description
exportcategories
A list of all the categories with the latests posts for each of them.
exportcategory
A category's details.
GET Params
Type
Required
Description
content
String
Yes
Equal to "exportcategories".
callback
String
Yes
The callback method.
limit
Integer
No
The number of articles that are exported for each category. Default value 7.
withArticles
Integer
No
Pass a value different than 1 to export the categories without articles.
page
Integer
No
Used for paginating categories. Default value 1.
rows
Integer
No
Used for paginating categories, indicates the number of categories per page. Default value 5.
descriptionLength
Integer
No
(Deprecated) The length (number of characters) of an article's description. Default value 200.
Field
Type
Required
Description
id
Alphanumeric string or integer
Yes
The ID of the category. It is set to "0" (zero) for the "Latest" category which combines the newest articles from all categories. The "Latest" category is optional.
order
Integer
Yes
The order in the categories menu.
name
String
Yes
The category title.
name_slug
String
Yes
The category slug (used for url rewriting).
parent_id
Alphanumeric string
No
The parent's category ID. It is set to 0 (zero) for root categories.
link
String, URL
No
The category's original link (used for setting a rel=canonical tag and prevent SEO duplicate content issues). Default value is " "(empty string) that indicates not to use a rel=canonical tag.
image
Object or empty string
No
The icon, displayed in the categories menu. Click here to see the specs for the image field. In case a category doesn't have an icon, this field is set to " " (empty string).
articles
List
Yes
A list with the articles from the category. Click here to see the specs for an article.
GET Params
Type
Required
Description
content
String
Yes
Equal to "exportcategory".
callback
String
Yes
The callback method.
categoryId
Alphanumeric string or integer
Yes
The ID of the category.
Field
Type
Required
Description
category
Object
Yes
The category's details. See below the category's format.
Field
Type
Required
Description
id
Alphanumeric string or integer
Yes
The ID of the category. It is set to "0" (zero) for the "Latest" category.
name
String
Yes
The category title.
name_slug
String
Yes
The category slug (used for url rewriting).
parent_id
Alphanumeric string
No
The parent category's ID. It is set to 0 (zero) for root categories.
link
String, URL
No
The category's original link (used for setting a rel=canonical tag and prevent SEO duplicate content issues). Default value is " " (empty string) that indicates not to use a rel=canconical tag.
image
Object or empty string
No
The icon, displayed in the categories menu. Click here to see the specs for the image field. In case a category doesnt' have an icon, this field is set to " " (empty string) or [] (empty array).