Eliminating the quotations around song titles

Hi There,
I would like to eliminate the quotation marks around the song titles in the audio player of my site. Below

I went into the WP Includes, downloaded the media.php file and would like to make a slight change in the php and add it to the Pro Child theme .php file. Every time I go to save the file, I get an error.

Here’s what I am using:

I have adjusted this: ‘“%s”’ to this: ‘%s’ to remove the quotes.

I am getting an error -
Your PHP code changes were rolled back due to an error on line 28 of file wp-content/themes/pro-child/functions.php. Please fix and try saving again.
syntax error, unexpected ‘<’

What am I doing wrong?

Thanks so much for your help

Best,
Nancy

Hello Nancy,

Thanks for writing in!

You are inserting the wrong code. Please remove your code because it will just give your a fatal error.
You can make use of this code instead:

// Translate texts
// =============================================================================
function change_quotes($translated) { 
  $translated = str_ireplace('&#8220;%s&#8221;', '%s', $translated);
  
  return $translated; 
}
add_filter('gettext', 'change_quotes' );
// =============================================================================

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

We would loved to know if this has work for you. Thank you.

Hi RueNel,
Thanks so much for the code. Unfortunately, I am still getting the quotes.

I sincerely appreciate your help with this and completely understand that it’s outside the scope of your support. I looked for solutions on line, and evidently others have complained about this issue too. I wish it could be fixed with CSS.

Thanks again for your time; it is much appreciated!

Best,
Nancy

Hi Nancy,

This is more of customization request. Could you please try using the hook gettext_with_context instead of gettext.

Example:

function no_quotes($translated) { 
  $translated = str_ireplace('&#8220;%s&#8221;', '%s', $translated);
  
  return $translated; 
}
add_filter('gettext_with_context', 'no_quotes' );

OR

function no_quotes($translated) {

  $translated = str_ireplace('&#8220;', '', $translated);
  $translated = str_ireplace('&#8221;', '', $translated);

  $translated = str_ireplace('"', '', $translated);
  $translated = str_ireplace('"', '', $translated);

  return $translated;
}
add_filter('gettext_with_context', 'no_quotes' );

Thanks!

Hi Best php coder in the world!!!

It worked!!! Woo Hoo!!!

I can’t tell you how much I appreciate this fix. Is it okay with you if I post it on the WordPress.org dev section? A lot of people have asked about how to remove these annoying quotes. But I don’t want to post your solution until I have your permission.

A million thanks to you sir. You have made my day!!!

Hugs,
Nancy

Thanks for sharing! And you’re most welcome! And sure, you can share the code :wink:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.