A very common support issue on the EDD forums is “Why do my download titles look like this?”. Customers are referring to the strange HTML markup that appears in the product’s titles. Here’s an example of what it can look like:

My Download”>My Download

The reason why this is happening is pretty simple. EDD uses Microdata in the product titles, which wraps the title in some special markup. This exposes an issue within the customer’s WordPress theme where the the_title() function has been incorrectly used in the anchor link’s title attribute. If you want to read more about, check out this in-depth article by Pippin Williamson on the_title() vs the_title_attribute().

To fix the issue you’ll need to first find the template file that is responsible for outputting your download’s title. This is usually single.php but sometimes can include another file such as content-single.php, or content.php. You’ll have to do some digging around as each theme can be entirely different.

Next, find the anchor tag which may look something like this:

<a title="<?php the_title(); ?>" href="..."> ... </a>

And simply change it to:

<a title="<?php the_title_attribute(); ?>" href="..."> ... </a>

 

5 comments

  1. Pippin pointed me here to address an issue I raised on Github… but I’m not finding where this is occuring in my theme. I’m using a custom Genesis Child Theme (based on Altitude Pro) and what I’m seeing in the titles is:

    TITLE

    However, I’m using a custom single-download.php that I modified from Pippin’s own EDD Starter Theme. The title output looks like this:

    Still giving the same weird span output. Any ideas?

    1. Open your theme’s folder in your code editor and then run a search for “the_title()”. Once you can see the search results, find the instances where the_title() is included inside an anchor link’s title attribute. Then fix accordingly.

  2. Hello.
    I couldn’t find content-single.php, or content.php and I could find single.php I replaced this code:
    <a title="” href=”…”> …
    The problem still persist .
    Is there any other solution ? 🙁

    Regards

Comments are closed.