如何使用wp主题和作者uri

问题描述 投票:0回答:2

在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博客任何页面上的链接...

如果我想在WP页面上放置CSS文件的作者链接和CSS文件的主题链接...

wordpress themes uri
2个回答
1
投票

您可以使用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' );

0
投票
$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 );
© www.soinside.com 2019 - 2024. All rights reserved.