Title: Fetch posts from particular category in given code
Last modified: August 20, 2016

---

# Fetch posts from particular category in given code

 *  [ratulupadhyay](https://wordpress.org/support/users/ratulupadhyay/)
 * (@ratulupadhyay)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/fetch-posts-from-particular-category-in-given-code/)
 * Hi guys,
 * My theme uses a background image for the single posts. But the problem is my 
   high resolution images are only in ‘Featured’ category and all the other images
   from various categories are low res.
 * So I want that the posts fetch images for background only from the featured category
   and not any random image from all images. This code in footer interested me as
   it seems to be doing the job of fetching images, but I couldn’t resolve the issue.
 * Thanks in advance. 🙂
 *     ```
       // Random image from post gallery
   
       	if(get_post_meta($pageID, $shortname.'_show_random_fullsize_value', true) == 'true'){				
   
       		$term_id_array = array();
   
       		foreach($post_terms as $index => $value){
   
       			$term_id_array[$index] = $index;
   
       		}		
   
       		$random_post = max_query_term_posts( 1 , $term_id_array, 'gallery', 'rand' );
       ```
   
 * For example on this post, [http://photography.vigaversa.com/gallery/yellows-blooming-at-her-feet/](http://photography.vigaversa.com/gallery/yellows-blooming-at-her-feet/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/fetch-posts-from-particular-category-in-given-code/#post-3582422)
 * please contact the theme’s developer via themeforest for support.
 * this forum does not support commercial themes.
 *  Thread Starter [ratulupadhyay](https://wordpress.org/support/users/ratulupadhyay/)
 * (@ratulupadhyay)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/fetch-posts-from-particular-category-in-given-code/#post-3582435)
 * Well thanks for the reply, I’ll try to contact the developers.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fetch posts from particular category in given code’ is closed to new 
replies.

## Tags

 * ["background-image"](https://wordpress.org/support/topic-tag/background-image/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [ratulupadhyay](https://wordpress.org/support/users/ratulupadhyay/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/fetch-posts-from-particular-category-in-given-code/#post-3582435)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
