PluginProbe ʕ •ᴥ•ʔ
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel / trunk
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel vtrunk
trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / includes / public / class-aioseo-sitemaps.php
foogallery / includes / public Last commit date
class-admin-bar.php 8 months ago class-aioseo-sitemaps.php 8 months ago class-css-load-optimizer.php 8 months ago class-foogallery-template-loader.php 8 months ago class-public.php 8 months ago class-rank-math-seo-sitemaps.php 8 months ago class-shortcodes.php 8 months ago class-yoast-seo-sitemaps.php 8 months ago index.php 12 years ago
class-aioseo-sitemaps.php
62 lines
1 <?php
2 /**
3 * Adds support for All In One SEO Sitemaps
4 *
5 * Date: 02/08/2020
6 */
7 if ( ! class_exists( 'FooGallery_All_In_One_Seo_Sitemap_Support' ) ) {
8
9 class FooGallery_All_In_One_Seo_Sitemap_Support {
10
11 function __construct() {
12 //version 4+
13 add_filter( 'aioseo_sitemap_posts', array( $this, 'add_images_to_sitemap' ), 10, 2 );
14 }
15
16 /**
17 * Add sitemap entries for AIOSEO v4+
18 *
19 * @param $entries
20 * @param $post_type
21 *
22 * @return mixed
23 */
24 function add_images_to_sitemap( $entries, $post_type ) {
25 if ( is_array( $entries ) ) {
26 foreach ( $entries as &$entry ) {
27 $post_permalink = $entry['loc'];
28 $post_id = url_to_postid( $post_permalink );
29 $images = isset( $entry['images'] ) ? $entry['images'] : array();
30 if ( $post_id > 0 ) {
31 $galleries = get_post_meta( $post_id, FOOGALLERY_META_POST_USAGE );
32 if ( is_array( $galleries ) ) {
33 foreach ( $galleries as $gallery_id ) {
34
35 //load each gallery
36 $gallery = FooGallery::get_by_id( $gallery_id );
37
38 if ( false === $gallery ) {
39 continue;
40 }
41
42 //add each image to the sitemap image array
43 foreach ( $gallery->attachments() as $attachment ) {
44 $images[] = (object) array(
45 'image:loc' => $attachment->url,
46 'image:caption' => $attachment->alt,
47 'image:title' => $attachment->caption,
48 );
49 }
50 }
51
52 $entry['images'] = $images;
53 }
54 }
55 }
56 }
57
58 return $entries;
59 }
60 }
61 }
62