How To Ignore a Filter On Applying Filter the Content In a Function

You can temporarily detach the function from the hook. // THIS IS MY PROBLEM LINE, i USE Apply Filters for post content…. $priority = has_filter(‘the_content’, [‘TableOfContents’, ‘writeTOC’] ); if ( $priority !== false ) remove_filter(‘the_content’, [‘TableOfContents’, ‘writeTOC’], $priority ); $meta = apply_filters(‘the_content’, $post->post_content); if ( $priority !== false ) add_filter(‘the_content’, [‘TableOfContents’, ‘writeTOC’], $priority ); $meta … Read more

Can shortcodes contain conditional statements? Even without them my shortcode renders blank page

your conditional breaks the concatenation of the strings (which is not in your code, anyway) try to re-write this section: function info($atts, $content = null) { extract(shortcode_atts(array( “name” => ”, “image” => ”, “address” => ”, “phone” => ”, “email” => ”, “website” => ”, “description” => ”, “amenities” => ” ), $atts)); $output=”<span class=”sort”>”; … Read more

How to use get_media_embedded_in_content function

The get_media_embedded_in_content() function is a handy helper function, though it doesn’t seem to be used in the core (ver. 4.2.2). Regular expression: To understand the get_media_embedded_in_content() function, we must understand the following regular expression: #<(?P<tag>video|audio|object|embed|iframe)[^<]*?(?:>[\s\S]*?<\/(?P=tag)>|\s*\/>)# There are many online regular-expression tools to help us with that. Like this one: Debuggex demo We note that it’s … Read more

WordPress Shortcode and Dynamic CSS

The closest to a reference technique in core would be shortcode. If you look at the source of implementing gallery_shortcode() function you’ll see that it: Generates instance number (so multiple shortcodes can be distinguished). Outputs dynamic CSS inline into a page source, for each instance. I wouldn’t consider it particularly neat solution, but it is … Read more

Search content for shortcodes and get parameters

This is working for me $shortcode=”book”; $pattern = get_shortcode_regex(); // if shortcode ‘book’ exists if ( preg_match_all( “https://wordpress.stackexchange.com/”. $pattern .’/s’, $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( $shortcode, $matches[2] ) ) { $shortcode_atts = array_keys($matches[2], $shortcode); // if shortcode has attributes if (!empty($shortcode_atts)) { foreach($shortcode_atts as $att) { preg_match(‘/id=”(\d+)”https://wordpress.stackexchange.com/”, $matches[3][$att], $book_id); // … Read more

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