Remove a div with ID from the_content WordPress

with the_content filter hook you can modify the content using PHP preg_replace search and replace function remove_specific_wrapper($content) { $content = preg_replace(‘#<div[^>]*id=”some_id”[^>]*>.*?</div>#is’, ”, $content); return $content; } add_filter(‘the_content’, ‘remove_specific_wrapper’);

Call the content help

According to their site: This is not an error. in our template we have coded if content exist then the_content function call otherwise skip the_content function. So it’s necessary to add some text in the page content area then you can use your page builder plugin and the error should be gone. Not the best … Read more

Remove P tag from images if aligncenter class is set

it should work like this. function filter_ptags_on_images($content) { $content = preg_replace(‘/<p>\s*?((<a.*?>)?<img[^>]+class=”[^\”]*aligncenter[^\”]*”.*?>(<\/a>)?)?\s*<\/p>/’, ‘$1’, $content); return $content; } it filters if the img tag has the class aligncenter and any class.

Balance Tags to the_content Words Length

You better call it before returning, inside technig_content() so that it’s return value is always balanced. So, the last two lines of your function would become: $content = str_replace(‘]]>’, ‘]]&gt;’, $content); $content = balanceTags( $content ); return $content; Having said that, I don’t think it’s a good way of handling your output, since you don’t … Read more

Split Content and Gallery

Open to anybody who can simplify this but here’s what I came up with that worked for me. First thing’s first – get the gallery, using get_post_gallery(), as soon as the loop starts: <?php if( have_posts() ) : ?> <?php while( have_posts() ) : the_post(); $gallery = get_post_gallery(); $content = strip_shortcode_gallery( get_the_content() ); ?> <div … Read more

Looking to limit the number of characters on my post page

The normal way to do this would be to use the_excerpt() instead of the_content() in your archive templates, then use this filter the change the number of words that appear in the excerpt: function wpse_280633_excerpt_length() { return 20; } add_filter( ‘excerpt_length’, ‘wpse_280633_excerpt_length’ ); If you want to stick with what you’ve got and not apply … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)