Reputation: 3843
This is a shortcode:
<?php
/**
* Get all the registered image sizes along with their dimensions
*/
function show_all_image_sizes(){
$image_sizes = wp_get_registered_image_subsizes();
return '<pre>' . print_r($image_sizes) . '</pre>';
}
Using it:
Result:
Rendered HTML:
What is going on here? Namely:
Upvotes: 1
Views: 643
Reputation: 2201
return
with echo
<?php
/**
* Get all the registered image sizes along with their dimensions
*/
function show_all_image_sizes(){
$image_sizes = wp_get_registered_image_subsizes();
echo '<pre>',print_r($image_sizes),'</pre>';
}
print_r
here is presumably just for debugging. If you want to output the data in that array in your html, you'll need to loop over it and echo strings of html with those values.Upvotes: 1