简体   繁体   English

wordpress-如何获取特定主题的模板数组

[英]wordpress - how to get an array of templates of an specific theme

I am trying to update a wordpress plugin. 我正在尝试更新wordpress插件。 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. 这里的问题是, get_theme()get_themes() ,并且我尝试将其更改为wp_get_theme()wp_get_themes() ,但是它不起作用。

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. 希望它对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取get_theme_mod值到wordpress中的数组? - how to get get_theme_mod value into array in wordpress? 如何在WordPress中获取子主题网址? - How to get child theme url in WordPress? 如何以编程方式在WordPress中获取主题主色? - How to programmatically get the theme main color in WordPress? 如何在WOffice主题wordpress主题中获取活动用户数据库表 - How to get active user database table in WOffice theme wordpress theme 如何让子主题模块模板覆盖主模块模板 - How to get child theme module templates to override main module template 如何获得第一或第二...最近专门在wordpress主题中的帖子,并将它们放入数组以在javascript中使用 - How to get first or second,.. recent post specifically in wordpress theme and put them in an array for use in javascript WordPress子主题的特定角色 - WordPress Child Theme for specific roles 如何在我的wordpress主题的页面上显示特定帖子 - How to show a specific post on a page on my wordpress theme PHP / WordPress:如何将类别特定的侧边栏拉入主题 - PHP/WordPress: How to pull category specific sidebars into theme 如何将自定义wordpress页面模板保留在主题文件夹以外的其他文件夹中 - How to keep custom wordpress page templates in different folder other than the theme folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM