-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #807 from siteorigin/release/2.11.3
Release/2.11.3
- Loading branch information
Showing
18 changed files
with
327 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* Returns a list of all images added using Page Builder. | ||
* | ||
* @param $images an array of all detected images used in the current post. | ||
* @param $post_id the current post id. | ||
* | ||
* @return array | ||
*/ | ||
function siteorigin_yoast_sitemap_images_compat( $images, $post_id ) { | ||
if ( | ||
get_post_meta( $post_id, 'panels_data', true ) && | ||
extension_loaded( 'xml' ) && | ||
class_exists( 'DOMDocument' ) | ||
) { | ||
$content = SiteOrigin_Panels::renderer()->render( | ||
$post_id, | ||
false | ||
); | ||
|
||
libxml_use_internal_errors( true ); | ||
$dom = new DOMDocument(); | ||
$dom->loadHTML( '<?xml encoding="UTF-8">' . $content ); | ||
libxml_clear_errors(); | ||
|
||
foreach ( $dom->getElementsByTagName( 'img' ) as $img ) { | ||
$src = $img->getAttribute( 'src' ); | ||
|
||
if ( ! empty( $src ) && $src == esc_url( $src ) ) { | ||
$images[] = array( | ||
'src' => $src, | ||
); | ||
} | ||
} | ||
} | ||
|
||
return $images; | ||
} | ||
add_filter( 'wpseo_sitemap_urlimages', 'siteorigin_yoast_sitemap_images_compat', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.