Support » Plugin: Good Reads Books » Book titles with apostrophes break images

  • David,

    Thank you for a lovely, useful plug-in! I found one small issue that I thought I’d share here…

    Using the plug-in, I’ve found that books with apostrophes in their titles don’t show up. For instance, this one:

    It looks like somehow the apostrophe is causing the link tag attributes to break. I fixed it in my copy by adding:

    str_replace('\'', '’', $reading->book->title)

    … in the appropriate places. Here’s the full replacement code section:

    foreach ($reading->reviews->review as $reading) {
      $title = str_replace('\'', '’', $reading->book->title);
      if (!$img = $this->goodrds_image_exceptions($reading->book->id))
        $img = $reading->book->image_url;
      $return .= "<a target='_Blank' href='{$reading->book->id}' title='{$title} - #{$reading->book->id}' class='book reading' style='background-image:url({$img});'></a>";
    foreach ($read->reviews->review as $read) {
      if ($showbooks > 0) {
        $title = str_replace('\'', '&rsquo;', $read->book->title);
        if (!$img = $this->goodrds_image_exceptions($read->book->id))
          $img = $read->book->image_url;
        $return .= "<a target='_Blank' href='{$read->book->id}' title='{$title} - #{$read->book->id}' class='book read' style='background-image:url({$img});'></a>";

    Please consider adding something like this fix in a future version.

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author David Sword


    Thanks for reporting.

    I REALLY need to update this plugin, in the one snippet alone I see several other potential problems.

    I’ll attempt to push out a fix similar to what you’ve supplied in the near future.


    Thread Starter iangilman


    Sounds good. Thank you for the prompt response! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Book titles with apostrophes break images’ is closed to new replies.