Wordpress 3.5: własna galeria z dołączonymi obrazami nie działa
Właśnie zaktualizowałem do Wordpress 3.5, ale to rozbiło małą część mojego kodu: jest plik php, który ładuje określony post ze swoją galerią przez AJAX.
Kod wygląda tak:
<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('../../../../wp-load.php');
$id = $_POST['id'];
// query post with this identifier
query_posts('meta_key=identifier&meta_value='.$id);
if (have_posts()) :
while (have_posts()) : the_post();
// add content
$content = apply_filters('the_content', get_the_content());
echo '<div class="content-inner">'.$content.'</div>';
endwhile;
endif;
?>
Post zawiera krótki kod [gallery]. Zbudowałem własną galerię Wordpress z tym kodem:
remove_shortcode('gallery');
add_shortcode('gallery', 'parse_gallery_shortcode');
function parse_gallery_shortcode($atts) {
global $post;
extract(shortcode_atts(array(
'orderby' => 'menu_order ASC, ID ASC',
'id' => $post->ID,
'itemtag' => 'dl',
'icontag' => 'dt',
'captiontag' => 'dd',
'columns' => 3,
'size' => 'full',
'link' => 'file'
), $atts));
$args = array(
'post_type' => 'attachment',
'post_parent' => $id,
'numberposts' => -1,
'orderby' => $orderby
);
$images = get_posts($args);
print_r($images);
}
Działa to ze wszystkimi innymi galeriami na mojej stronie, ale nie z tymi załadowanymi przez ajax. I współpracował z Wordpress 3.4.
Czy są zmiany w Wordpress 3.5, które przeoczyłem?