Update content on the fly

Well if you are trying to replace width=”” where “” means empty, you do not need to use “*” when using str_replace, as str_replace do not support regular expression. In that case you function will be as : function replace_content_on_the_fly($text){ $replace = array( // ‘words to find’ => ‘replace with this’ ‘width=””‘ => ‘width=”730px”‘, ‘height=””‘ … Read more

Add video tag to youtube link fron content

You can try doing this: $string = “Some text before the link http://www.youtube.com/?123 some text after the link”; preg_match_all(‘@(https?://www\.?youtube.com/.[^\s.,”\’]+)@i’, $string, $matches); var_dump($matches); In your case would be something similar to this: preg_match_all(‘@(https?://www\.?youtube.com/.[^\s.,”\’]+)@i’, $post->post_content, $matches); foreach($matches as $match){ echo “<video>$match</video>”; }

Put teaser content, more-link and full content in different divs if existing… Possible?

Found a solution which is working. Splitting the array like above just gives you the plain text so shortcodes wont work. this works: global $post; $content = get_extended( $post->post_content ); //get the_content $excerpt = $content[‘main’]; //get the teaser part before more tag $main_content = apply_filters(‘the_content’, $content[‘extended’]); //get part after more tag echo $excerpt; //post teaser … Read more

I am not seeing any content within WordPress after migration?

Last time something like this happened to me it was because there were funky characters in the post content (which came, I think, from a database encoding difference between the source and destination databases). Anyway, that’s where I’d look first. Use phpMyAdmin (or your favorite db tool) to check the post_content column of your wp_posts … Read more