Forums

[resolved] Does $themename still work on the frontend? (6 posts)

  1. Iva
    Member
    Posted 1 year ago #

    I have created a new theme and wanted the theme name to be shown in the footer of every page.

    I used <?php echo $themename; ?>, but it doesn't output anything. This worked in older versions of WordPress. Am I doing something wrong?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    <?php printf( __('Powered by the %1$s Theme %2$s'), '<a href="' . $my_theme_data['URI'] . '">' . get_current_theme(), '</a>');?>

  3. Iva
    Member
    Posted 1 year ago #

    Thank you so much. The name shows now.

    However, it outputs the current URL instead of the theme URL I specified in style.css ...is that normal or am I supposed to specify the theme name somewhere else as well?

    I apologise if I'm being dumb.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    My bad. I missed out the first line in the paste:

    <?php $my_theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');?>
  5. Iva
    Member
    Posted 1 year ago #

    I almost thought I was slightly challenged, since I managed to build an entire theme without any problems and now this happened.

    Thanks for the snippet and have a wonderful week. :)

  6. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Glad I could help :-)

Topic Closed

This topic has been closed to new replies.

About this Topic