Theme path/url not available – broken images.

I’m doing some work with this plugin and found that none of the images are showing up. After tracing through the code, I find that $theme_url and $theme_path are declared in the HTML_Emailer object, but the values are never more than an empty string. This prevents the header images from displaying. I thought I’d just append the theme name onto those variables, but the theme name is nowhere to be found. So, question: where to get the theme name, so I can set it within the object? Example code would be appreciated!

To clarify:

Template Path/URL

$this->template_directory = /site/wp-content/…/htmlemail/lib/templates/

$this->template_url =…/htmlemail/lib/templates/

Theme Path/URL (Missing!)

$this->theme_path = /site/wp-content/…/htmlemail/lib/templates/Mytemplate/

$this->theme_url =…/htmlemail/lib/templates/Mytemplate/

  • Luís
    • Support

    Hi John A. ,

    Hope you’re doing well today!

    I flagged the SLS team (our code experts :slight_smile: ) to investigate further and get their valuable feedback.

    Since this team deals with more advanced threads it may take them longer to reply.

    Also, can you give us access to your admin panel, so we can check your template?

    If you don’t already know, please, follow the link below, to see how enable the staff login:

    When you enable this option, please post again!

    Cheers, Luís

  • John A.
    • The Incredible Code Injector

    Support access granted. To make it a little easier, I created a brand new installation of WordPress with HTML Email Templates on board. No other plugins. Default theme. Even in this pristine environment, the images are a no-show due to the issue I noted in my original post. Thanks.

  • Lindeni Mahlalela
    • Recruit

    Hello John A.

    I hope you are having a great day so far and I am very sorry for the delayed response with regards to resolving this issue.

    I went through the code and double checked the paths and url for the themes and indeed the default images were not showing up as they should. I have modified the plugin so that it saves the current theme in the database so at any point you can simply call the custom function I created to retrieve the theme name and even the full theme path or theme url.

    I have attached the modified plugin, this is a modified copy of version 2.0.6. Please note that this is not the final update/release and the fix may not be included in the next update so keep that in my when a new update is released, just double check before updating as you would have to apply the changes again.

    Please download the attached '' and install it as you would normally install any plugin by going to your WordPress admin an click on "Plugins > Add New" or unzip it and upload it using an FTP client.

    The screenshot below shows the template preview after applying the fix and defining the image.

    After uploading the plugin you have to go to "Settings > HTML Email Templates" and load any of the themes and then "Save" it, then you can get the theme name, theme path and theme url by calling the following functions:

    To get the HTML Template Name

    $html_theme = $this->get_html_theme(); //return the name of the theme like "Disco"

    To get the Theme Path: Will return something like '/var/www/html/wp-content/plugins/htmlemail/lib/templates/Disco'

    $theme_path = $this->get_html_theme_path($html_theme);

    To get the Theme URL: Will return something like ''

    $theme_url = $this->get_html_theme_url($html_theme);

    Please note that the Theme name is saved when you save the HTML template in "Settings > HTML Email Templates" page. If you switch the template, you should consider saving again to make sure the name is updated in the database.

    I hope you find this in order. Please let us know if you need any further assistance with regards to this issue.



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.