Created
April 23, 2018 10:35
-
-
Save dartiss/d4240720c69ce8f32860eb7096378dd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function embed_code( $content ) { | |
global $post; | |
$i = 1; | |
while ( $i < 6 ) { | |
$code = 'CODE' . $i; | |
$html = get_post_meta( $post->ID, $code, false ); | |
$content = str_replace( '{{' . $code . '}}', $html[0], $content ); | |
$i++; | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'embed_code' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Full detail here... https://artiss.blog/2018/04/embedding-code-in-your-wordpress-posts/