在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函数从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 );