• Good day,

    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.

    For example, if you paste an Instagram URL, oEmbed automatically converts the URL into an image, but Tonesque does not pick up on that.

    The reason is actually pretty simple.

    In the file template-tags.php on line 243 you have:

    $output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_the_content(), $matches );

    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:

    $content = get_the_content();
    $content = apply_filters( 'the_content', $content );
    $output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches );

    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 😉

    Thanks a lot though, your theme is pretty awesome.

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Theme: Ryu] Tonesque not working with oEmbed’ is closed to new replies.