Add class to all parent elements inside the_content
Add class to all parent elements inside the_content
You use preg_replace function incorrectly. This function returns replaced content: add_filter( ‘the_content’, ‘wpdu_image_replace’ ); function wpdu_image_replace( $content ) { return preg_replace( ‘/<img.*?src=”https://wordpress.stackexchange.com/questions/55241/(.*?)”.*?>/’, ‘<a href=”$1″>Image file</a>’, $content ); } Also pay attention that you don’t have to use global variable $post, because content of the post is passed to your function as first argument.
Thank you Milo, “word-break” alone wasn’t enough as it’s css3 only and not cross-browser. But I found this: .bloc_content{ overflow:hidden; -ms-word-break: break-all; word-break: break-all; word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; } It seems to to work in all cases I tested. Hopefully it would be cross-browser enough to solve the problem. Not sure … Read more
You don’t need a custom rewrite rule to handle this, just set your taxonomy rewrite slug like: ‘rewrite’ => array( ‘slug’ => ‘projects/category/%project_cat%’ )
I was able to answer my own question. Simply adding a 0-9 into the code above remedied the situation. Here is the final code: if (!name || !/^[a-z0-9][a-z0-9\-\_:\.]*$/i.test(name)) { tinyMCEPopup.alert(‘advanced_dlg.anchor_invalid’); return; }
You need this filter: function add_myself($content){ return $content.” myself”; } add_filter(‘content_save_pre’,’add_myself’); Found the answer here: https://stackoverflow.com/a/4147860/982517
Add class to all parent elements inside the_content
Here is the script I came up with. It loops through all the posts in a WordPress instance and splits it up into three sections: The HTML/content before the row of shortcodes The row of shortcodes The HTML/content after the row of shortcodes I decided to use substr() to split up the content. I then … Read more
Why is my script’s regex having its backslash removed?
Try slapping a negative lookahead before the comment match, eg function remove_html_comments($content=””) { return preg_replace(‘/(?!<!–\s*\/?mfunc\s*’ . W3TC_DYNAMIC_SECURITY . ‘)<!–(.|\s)*?–>/’, ”, $content); }
RESOLVED: This issue came about from many warnings in Bing Webmaster Tools. I discovered that I had added these sites to “My Sites” before I moved them over to HTTPS. I had to delete the sites from BWT and add them back again. It now shows that they’re being crawled correctly. Another coder over at … Read more