Skip to main content
deleted 103 characters in body
Source Link
och
  • 39
  • 1
  • 8

I find a solution for this:

// Customise the WordPress gallery html layout
add_filter('post_gallery','customFormatGallery',10,2);
function customFormatGallery($string,$attr){
    $output = "<div class=\"mihan-gallery\">";
    $posts = get_posts(array('include' => $attr['ids'],'post_type' => 'attachment'));
    $image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', TRUE);
    foreach($posts as $imagePost){
        $output .= "<a class=\"mihangitem\" href='".wp_get_attachment_image_src($imagePost->ID, 'mihan-large')[0]."'><img src='".wp_get_attachment_image_src($imagePost->ID, 'mihan-medium')[0]."' alt='".$image_alt."'></a>";
    }
    $output .= "<div class=\"clear\"></div></div>";
    return $output;
}

I find a solution for this:

// Customise the WordPress gallery html layout
add_filter('post_gallery','customFormatGallery',10,2);
function customFormatGallery($string,$attr){
    $output = "<div class=\"mihan-gallery\">";
    $posts = get_posts(array('include' => $attr['ids'],'post_type' => 'attachment'));
    $image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', TRUE);
    foreach($posts as $imagePost){
        $output .= "<a class=\"mihangitem\" href='".wp_get_attachment_image_src($imagePost->ID, 'mihan-large')[0]."'><img src='".wp_get_attachment_image_src($imagePost->ID, 'mihan-medium')[0]."' alt='".$image_alt."'></a>";
    }
    $output .= "<div class=\"clear\"></div></div>";
    return $output;
}

I find a solution for this:

// Customise the WordPress gallery html layout
add_filter('post_gallery','customFormatGallery',10,2);
function customFormatGallery($string,$attr){
    $output = "<div class=\"mihan-gallery\">";
    $posts = get_posts(array('include' => $attr['ids'],'post_type' => 'attachment'));
    foreach($posts as $imagePost){
        $output .= "<a class=\"mihangitem\" href='".wp_get_attachment_image_src($imagePost->ID, 'mihan-large')[0]."'><img src='".wp_get_attachment_image_src($imagePost->ID, 'mihan-medium')[0]."'></a>";
    }
    $output .= "<div class=\"clear\"></div></div>";
    return $output;
}
Source Link
och
  • 39
  • 1
  • 8

I find a solution for this:

// Customise the WordPress gallery html layout
add_filter('post_gallery','customFormatGallery',10,2);
function customFormatGallery($string,$attr){
    $output = "<div class=\"mihan-gallery\">";
    $posts = get_posts(array('include' => $attr['ids'],'post_type' => 'attachment'));
    $image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', TRUE);
    foreach($posts as $imagePost){
        $output .= "<a class=\"mihangitem\" href='".wp_get_attachment_image_src($imagePost->ID, 'mihan-large')[0]."'><img src='".wp_get_attachment_image_src($imagePost->ID, 'mihan-medium')[0]."' alt='".$image_alt."'></a>";
    }
    $output .= "<div class=\"clear\"></div></div>";
    return $output;
}