Title: Using Pages to create page elements
Last modified: August 20, 2016

---

# Using Pages to create page elements

 *  [Patrick Orr](https://wordpress.org/support/users/patrick-orr/)
 * (@patrick-orr)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/using-pages-to-create-page-elements/)
 * Hello All,
    I have an idea for my portfolio, but am not sure I can find a way
   to use wordpress to make it happen, any help is greatly appreciated.
 * I am using pages with feature images to link to populate my portfolio. The code
   looks like this:
 *     ```
       <?php
           global $post;
           $myposts = get_posts('numberposts=100&offset=news&category_name=portfolio');
           foreach($myposts as $post) :
           setup_postdata($post);
       ?>
       <div class="workitem">
            <div class="workitem_photo"<?php the_post_thumbnail('150,200'); ?></div>
            <div class="workitem_title"><?php the_title();?></div>
            <div class="workitem_description"><?php the_excerpt(); ?></div>
            <a class="workitem_projectdetails" href="<?php the_permalink(); ?>" style="display:none;">Project Details</a>
         </div>
       <?php endforeach; ?>
       ```
   
 * This works great, I can just make a page, and it updates my porfolio on the homepage.
   The only problem is that my portfolio has a navigation system that hinges on 
   each of these items having overlapping class tags to catagorize each item for
   sorting.
 * Normally I would would just add the class here:
    `<div class="workitem ***CATEGORY***"
   >`
 * but this wont work if I am using pages to dynamically create it.
    Is there any
   way I can create a custom handle in the wordpress page creation tool and then
   use a php reference to grag it… something like this:
 * `<div class="workitem <?php custom_category();?><">`
 * Here is a link to my site set up without the wordpress dynamic items implimented
   so you can get a feel for how the menu works.[](http://patrickorr.ca/)

The topic ‘Using Pages to create page elements’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * 0 replies
 * 1 participant
 * Last reply from: [Patrick Orr](https://wordpress.org/support/users/patrick-orr/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/using-pages-to-create-page-elements/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
