Skip to main content
added 17 characters in body
Source Link

I have to add an attribute on WP images to add description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

Nothing happens. It seems that the filter does not work at all.

I have to add an attribute on WP images to add description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

It seems that the filter does not work at all.

I have to add an attribute on WP images to add description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

Nothing happens. It seems that the filter does not work at all.

deleted 3 characters in body
Source Link

I have to add an attribute on of WP WP images to add description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

It seems that the filter does not work at all.

I have to add an attribute on of WP images to add description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

It seems that the filter does not work at all.

I have to add an attribute on WP images to add description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

It seems that the filter does not work at all.

added 11 characters in body
Source Link

I have to add an attribute on of WP images to enabledadd description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

It seems that the filter does not work at all.

I have to add an attribute on of WP images to enabled Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

It seems that the filter does not work at all.

I have to add an attribute on of WP images to add description on Spotlight lightbox. I tried the wp_get_attachment_link filter but it doesn't work.

function add_data_description_link($content, $post_id) {

    $description = get_post_field('post_content', $post_id);

    $data_description = ' data-description="' . esc_attr($description) . '"';
    $content = str_replace('<a ', '<a' . $data_description . ' ', $content);

     return $content;
}
add_filter('wp_get_attachment_link', 'add_data_description_link', 10, 2);

It seems that the filter does not work at all.

Source Link
Loading