How to change Woocommerce breadcrumbs content?

That is due to the fact, that your filter woocommerce_breadcrumb doesn’t even exist. This filter here works and pulls out all the elements, that are currently in the breadcrumb (as an array): add_filter( ‘woocommerce_get_breadcrumb’, ‘change_breadcrumb’ ); function change_breadcrumb( $crumbs ) { var_dump( $crumbs ); return $crumbs; } And this filter pulls out the main term … Read more

How to add attribute to output with wp_video_shortcode add_filter

I get Undefined variable: for $video, $post_id and $library and the video’s in the page are blank. Replace: add_filter( ‘wp_video_shortcode’, ‘my_video_shortcode’, 10, 2 ); with: add_filter( ‘wp_video_shortcode’, ‘my_video_shortcode’, 10, 5 ); to access all five input arguments in your filter’s callback. ps: my_ is such a common prefix, that I would consider something more unique. … Read more

Add wrapper to only youtube videos via embed_oembed_html filter function

$url will contain the full URL to the embed source. E.g.: https://www.youtube.com/watch?v=_UmOY6ek_Y4, so you have to search within $url to see if the provider’s name appears: add_filter( ’embed_oembed_html’, ‘wpse_embed_oembed_html’, 99, 4 ); function wpse_embed_oembed_html( $cache, $url, $attr, $post_ID ) { $classes = array(); // Add these classes to all embeds. $classes_all = array( ‘responsive-container’, ); … Read more

How to use the_excerpt in a filter hook?

use the filter get_the_excerpt. Look at line no. 250 here, they are using the_excerpt internally on the function get_the_excerpt(), and in this function on line no. 272, they’re applying the filter get_the_excerpt on the actual excerpt. Hence, add_filter(‘get_the_excerpt’, ‘exc’); function exc($param) { return “Whew !”.$param; } is the way to go if you want to … Read more

How to make post and comment count unclickable with dashboard_glance_items hook

The dashboard_glance_items filter is only useful for modifying the extra elements. The posts/comments data elements have already been displayed. Here are three ideas: Method #1 – Use the dashboard_glance_items filter: You can use the following filter setup, to remove the posts/pages/comments elements from the output of wp_dashboard_right_now(). The trick is simple, foul WordPress to think … Read more

Overriding wp_get_archives() apply_filters()

A WordPress filter is a function that takes in a string, array, or object, does something to it, and returns that filtered string, array, or object. So what you want to do is turn “WHERE post_type=”post” AND post_status=”publish”” into “WHERE post_type=”post” OR post_type=”events” AND post_status=”publish””. That is fairly straightforward. From the looks of things, the … Read more

apply_filters(‘the_content’, $content) alternative

The Core filters on the_content are: 131 add_filter( ‘the_content’, ‘wptexturize’ ); 132 add_filter( ‘the_content’, ‘convert_smilies’ ); 133 add_filter( ‘the_content’, ‘convert_chars’ ); 134 add_filter( ‘the_content’, ‘wpautop’ ); 135 add_filter( ‘the_content’, ‘shortcode_unautop’ ); 136 add_filter( ‘the_content’, ‘prepend_attachment’ ); You can apply whichever of those you’d like to any string you’d like. The second parameter is the name … Read more

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