webfuelcode
webfuelcode

Reputation: 97

How to use wp theme and author uri

In WordPress CSS file Author and Theme URI is already present.

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

How to call these into a link on any page of the WP blog...

If I would like to put link on WP pages for author from CSS file and the theme link from CSS file...

Upvotes: 1

Views: 2132

Answers (2)

farhan ayub
farhan ayub

Reputation: 60

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

Echo the name of an installed theme:

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

Upvotes: 0

Sourabh Matolia
Sourabh Matolia

Reputation: 169

You can use Wordpress function to get theme NAME and URI from style.css comments.
Ref: https://developer.wordpress.org/reference/functions/wp_get_theme/

Code Snippet:

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

Upvotes: 2

Related Questions