Can I add custom meta for each image uploaded via media-upload.php?

Yes, you can add fields, an example function rt_image_attachment_fields_to_save($post, $attachment) { // $attachment part of the form $_POST ($_POST[attachments][postID]) // $post[‘post_type’] == ‘attachment’ if( isset($attachment[‘rt-image-link’]) ){ // update_post_meta(postID, meta_key, meta_value); update_post_meta($post[‘ID’], ‘_rt-image-link’, $attachment[‘rt-image-link’]); } return $post; } // now attach our function to the hook. add_filter(“attachment_fields_to_save”, “rt_image_attachment_fields_to_save”, null , 2); see more on this post

Modify the post/entry wrapper markup in genesis childtheme [closed]

Today I had a similar issue and this worked for me: /** * Add and extra class to the entry-content div * */ function vdl_entry_content_extraclass( $attributes ) { $attributes[‘class’] = $attributes[‘class’]. ‘ my-custom-class’; return $attributes; } add_filter( ‘genesis_attr_entry-content’, ‘vdl_entry_content_extraclass’ ); In my case, I am adding this code to my single-portfolio.php template because I only … Read more

Hook into admin post list page

From your screenshot and explanation I guess I understand what you’re trying to accomplish. Concept Point is, that the question is more a X-Y Problem. What I’d recommend is changing the idea and use as much of what is available per default: The Quick Edit box. Quick Edit The default hook to extend quick edit … Read more

What to use instead of the content_save_pre filter?

What Adam Brown’s site says is that the hook no longer appears in 3.8. I greped a 3.9 and found: bash-4.2# grep -Rni ‘content_save_pre’ * wp-includes/kses.php:1327: * The wp_filter_post_kses() function is added to the ‘content_save_pre’, wp-includes/kses.php:1344: add_filter(‘content_save_pre’, ‘wp_filter_post_kses’); wp-includes/kses.php:1370: remove_filter(‘content_save_pre’, ‘wp_filter_post_kses’); wp-includes/default-filters.php:89:foreach ( array( ‘content_save_pre’, ‘excerpt_save_pre’, ‘comment_save_pre’, ‘pre_comment_content’ ) as $filter ) { Interestingly the … Read more

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