Hallo Forum,
ich habe ein kleines Problem mit einer Funktion, die ich in die functions.php geschrieben habe.
Die Funktion durchsucht den Post nach Bilder anhängen und stellt diese dar.
Nur wie kann ich in der gleichen Funktion die gewählte Kategorie des Posts bestimmen und wieder geben?
Code
/*-----------------------------------------------------------------------------------*//* Load all Images from a Post
/*-----------------------------------------------------------------------------------*/
function show_all_thumbs() {
global $post;
$post = get_post($post);
$countImg = 0;
/* image code */
$images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent='.$post->ID);
if($images){
foreach( $images as $imageID => $imagePost ){
unset($the_b_img);
$class = single_cat_title();
$the_b_img = wp_get_attachment_image($imageID, 'large', false);
$thumblist .= '<div id="images'.$class.'" class="image_'.$countImg.'"><a href="'.get_attachment_link($imageID).'">'.$the_b_img.'</a></div>';
$countImg++;
}
}
return $thumblist;
}
Alles anzeigen
viele Grüße