NextGen Gallery singlepic images
-
I like this plugin a way more then WordPress-SEO for its’ simplicity and robustness. Unfortunately, XML-Sitemap is unable to list pictures posted through the NextGen Gallery plugin, on which my site is heavily relying. So I wrote a simple patch to enable it to handle the [singlepic] shortcode (at least). Maybe it will be usefull to someone:
xml-sitemap-feed/includes/core.php: 466 if('attached' == $which) { 467 $args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'post_status' =>'inherit', 'post_parent' => $post->ID ); 468 $attachments = get_posts($args); 469 if ($attachments) { 470 foreach ( $attachments as $attachment ) { 471 $url = wp_get_attachment_image_src( $attachment->ID, 'full' ); 472 $this->images[$post->ID][] = array( 473 'loc' => esc_url( $url[0] ), 474 'title' => apply_filters( 'the_title_xmlsitemap', $attachment->post_title ), 475 'caption' => apply_filters( 'the_title_xmlsitemap', $attachment->post_excerpt ) 476 ); 477 } 478 } #check for NextGen singlepics if (class_exists('nggdb')) { if (preg_match_all( '<code>\[singlepic id=[0123456789]+</code>', $post->post_content, $matches)) { foreach ($matches[0] as $img) { if (preg_match( '<code>=([0123456789]+)</code>', $img, $match)) { $img = nggdb::find_image($match[1]); $image = array('loc' => esc_url($img->imageURL), 'title' => $img->alttext, 'caption' => $img->alttext); $this->images[$post->ID][] = $image; } } } } } elseif ('featured' == $which) { if (has_post_thumbnail( $post->ID ) ) {*Note:
<code>tags appearing in the snippet are actually backquotes transformed by the forum. They are part of regexps.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘NextGen Gallery singlepic images’ is closed to new replies.