如何使用wp主题和作者uri

How to use wp theme and author uri

在 WordPress CSS 文件中作者和主题 URI 已经存在。

Theme Name: myTheme
Theme URL: https://themestore.com/themename
Description: myTheme
Author: Author
Author URI: https://author.com
Version: 1.0.0

如何将这些调用到 WP 博客的任何页面上的 link...

如果我想在 CSS 文件的作者和 CSS 文件的 link 的 WP 页面上放置 link...

您可以使用 Wordpress 功能从 style.css 条评论中获取主题名称和 URI。
参考:https://developer.wordpress.org/reference/functions/wp_get_theme/

代码片段:

$theme_data = wp_get_theme();
echo $theme_data->get( 'Name' );
echo $theme_data->get( 'ThemeURI' );
$theme_wp = wp_get_theme();
echo $theme_wp->get( 'Name' );
echo $theme_wp->get( 'AuthorURI' );

回显已安装主题的名称:

$theme_wp = wp_get_theme( 'twentynineteen' );
if ( $theme_wp->exists() )
    echo esc_html( $theme_wp );