admin管理员组

文章数量:1402985

i am trying to get the html code of the description of a few themes from WordPress, i know this is possible to achieve in codecanyon, but can't get the hang of it in wordpress, i've read the api.wordpress documentation of theme and plugin section at _API and was able to achieve this with plugins .0/{slug}.json, but themes aren't as clear. Can someone please help me out?

i am trying to get the html code of the description of a few themes from WordPress, i know this is possible to achieve in codecanyon, but can't get the hang of it in wordpress, i've read the api.wordpress documentation of theme and plugin section at https://codex.wordpress/WordPress_API and was able to achieve this with plugins https://api.wordpress/plugins/info/1.0/{slug}.json, but themes aren't as clear. Can someone please help me out?

Share Improve this question asked Mar 21, 2020 at 11:21 Marius SlovikasMarius Slovikas 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 2

If you're in the admin site you can use themes_api()

$info = themes_api( 'theme_information', [ 'slug' => 'twentyten' ] );
echo esc_textarea( $info->sections['description'] );

but that's plain text, not HTML. The API request it generates is

https://api.wordpress/themes/info/1.2/?action=theme_information&request%5Bslug%5D=twentyten&request%5Blocale%5D=en_US&request%5Bwp_version%5D=5.3.2

You can see the parameters in there as multiple URL-encoded request[key] parameters.

本文标签: pluginsHow to get theme39s info from wordpressorgthemes using apiwordpressorg