array( 'src' => URL of image file, 'alt' => ALT Text ) ) * @param integer $post_id ID of the current post */ public static function wpseo_sitemap_urlimages( $url, $post_id ) { global $post; //error_log( __LINE__ . " wpseo_sitemap_urlimages( {$post_id} ) initial url = " . var_export( $url, true ), 0 ); $post = get_post( $post_id ); // Set the parent post/page; used in [mla_gallery] if ( $count = preg_match_all( "/\\[mla_gallery([^\\]]*)\\]/", $post->post_content, $matches ) ) { foreach( $matches[0] as $index => $match ) { $tail = $matches[1][ $index ]; /* * Only process shortcodes that are an exact match */ if ( empty( $tail ) || ( ' ' == substr( $tail, 0, 1 ) ) ) { $the_gallery = do_shortcode( $match ); /* * If MLA is not active the shortcode is not processed; * substitute empty results. */ if ( $the_gallery == $match ) { $the_gallery = ''; } $ref_count = preg_match_all( '/\ $reference ) { $url[] = array( 'src' => $reference, 'alt' => $references[2][ $ref_index ] ); } } unset( $ref_count, $references ); } // exact match } //error_log( __LINE__ . " wpseo_sitemap_urlimages( {$post_id} ) final url = " . var_export( $url, true ), 0 ); unset( $count, $matches ); } // found matche(s) return $url; } /** * Add [mla_gallery] output to post/page content for SEO anapysis * * @since 1.00 * * @param string $post_content The Post content string * @param object $the_post The post object. * * @return string Expanded Post content string */ public static function wpseo_sitemap_entry( $url, $post_type, $the_post ) { //error_log( __LINE__ . " wpseo_sitemap_entry( {$post_type}, {$the_post->ID} ) initial url = " . var_export( $url, true ), 0 ); //error_log( __LINE__ . " wpseo_sitemap_entry( {$post_type}, {$the_post->ID} ) the_post = " . var_export( $the_post, true ), 0 ); return $url; } } // Class MLAYoastSEOExample /* * Install the filter at an early opportunity */ add_action('init', 'MLAYoastSEOExample::initialize'); ?>