Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MasterHans/8a0f1b19f28014a3da2d to your computer and use it in GitHub Desktop.
Save MasterHans/8a0f1b19f28014a3da2d to your computer and use it in GitHub Desktop.
<?php
global $post;
global $wp_query;
$currentPageCatId = get_cat_ID( "pagename" );
$NewsCatPostsArray = query_posts( 'cat='.$currentPageCatId);
$current_news_postId = $NewsCatPostsArray[$i]->ID;
$current_news_postUrl = get_permalink($current_news_postId);
$query_images_args = array('post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1,'post_parent' => $current_news_postId);
$query_images = new WP_Query($query_images_args);
$images = array();
foreach ( $query_images->posts as $image) {
$images[]= $image->guid;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment