简体   繁体   中英

wordpress - how to get an array of templates of an specific theme

I am trying to update a wordpress plugin. At current time the plugin code displays:

$themes = get_themes();
$theme = get_current_theme();
$templates = $themes[$theme]['Template Files'];

Here the problem is that get_theme() and get_themes() are deprecated, and I have tried to change it to wp_get_theme() , and wp_get_themes() , but it doesnt work.

Does anyone have any idea how to update this? Thanks.

Owww... I found out how it is!!!...

  $theme = wp_get_theme();
  $templates = $theme->{'Template Files'};

hope it helps somebody else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM