Skip to content

Instantly share code, notes, and snippets.

@nickstewart95

nickstewart95/Blog.php Secret

Last active Dec 15, 2020
Embed
What would you like to do?
Blog.php
//Image Fix
$content = str_replace('src="/wp-content/"', 'src="https://viastudio.com/wp-content/"', $content);
//Gist
$content = preg_replace('/(?:https?:\/\/)?(?:www\.)?gist.github\.com([^\n]+)$/sm', '<gist src="$0"></gist>', $content);
//Youtube
$content = preg_replace('/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([^\n]+)$/sm', '<videoblock src="$0"></gist>', $content);
//Apply the content filters
$content = apply_filters('the_content', $content);
//Remove empty paragraphs
$content = str_replace('<p></p>', '', $content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment