{"id":5539564,"date":"2014-12-03T03:06:00","date_gmt":"2014-12-03T03:06:00","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/tonesque-not-working-with-oembed\/"},"modified":"2016-08-22T13:09:47","modified_gmt":"2016-08-22T13:09:47","slug":"tonesque-not-working-with-oembed","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/tonesque-not-working-with-oembed\/","title":{"rendered":"[Theme: Ryu] Tonesque not working with oEmbed"},"content":{"rendered":"<p>Good day,<\/p>\n<p>I have noticed that Tonesque, the function that finds a matching background color for post format image, does not work when an image is included using oEmbed.<\/p>\n<p>For example, if you paste an Instagram URL, oEmbed automatically converts the URL into an image, but Tonesque does not pick up on that.<\/p>\n<p>The reason is actually pretty simple.<\/p>\n<p>In the file template-tags.php on line 243 you have:<\/p>\n<pre><code>$output = preg_match_all( &#039;\/&lt;img.+src=[\\&#039;&quot;]([^\\&#039;&quot;]+)[\\&#039;&quot;].*&gt;\/i&#039;, get_the_content(), $matches );<\/code><\/pre>\n<p>The problem is that get_the_content() does not apply the filers that the_content applies. Replacing that line with the following code fixes the problem:<\/p>\n<pre><code>$content = get_the_content();\n$content = apply_filters( &#039;the_content&#039;, $content );\n$output = preg_match_all( &#039;\/&lt;img.+src=[\\&#039;&quot;]([^\\&#039;&quot;]+)[\\&#039;&quot;].*&gt;\/i&#039;, $content, $matches );<\/code><\/pre>\n<p>I have noticed that your function is wrapped around an if function_exists, so I declared the function in my child theme and patched it, which worked, but I believe it should probably be patched in the theme \ud83d\ude09<\/p>\n<p>Thanks a lot though, your theme is pretty awesome.<\/p>\n<p>Cheers!<\/p>\n","protected":false},"template":"","class_list":["post-5539564","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5539564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5539564\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5539564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}