Title: Adding content to pages
Last modified: August 20, 2016

---

# Adding content to pages

 *  [j05hr](https://wordpress.org/support/users/j05hr/)
 * (@j05hr)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/adding-content-to-pages/)
 * Hi
 * I have pages that I need to add content too.
 *     ```
       <div class="portfolio">
       								<div class="portfolioPadding">
       									<a href="f4p.html"><img src="images/f4pHome1.jpg" alt="Image of Bulletproof Designs"/></a>
       								</div><!-- end .portfolioPadding -->
       							</div> <!-- end .portfolio -->
       							<div class="portfolio">
       								<div class="portfolioPadding">
       									<a href="f4p.html"><img src="images/lt4mHome.jpg" alt="Image of Bulletproof Designs"/></a>
       								</div><!-- end .portfolioPadding -->
       							</div> <!-- end .portfolio -->
       							<div class="portfolio">
       								<div class="portfolioPadding">
       									<a href="f4p.html"><img src="images/bodyworks.jpg" alt="Image of Bulletproof Designs"/></a>
       								</div><!-- end .portfolioPadding -->
       							</div> <!-- end .portfolio -->
       							<div class="portfolio">
       								<div class="portfolioPadding">
       									<a href="f4p.html"><img src="images/bulletproofScreenshot3.jpg" alt="Image of Bulletproof Designs"/></a>
       								</div><!-- end .portfolioPadding -->
       							</div> <!-- end .portfolio -->
       ```
   
 * I need to make it so I have <div class=”portfolio”> added to each item.
 * I have it like this at the moment but it only puts it around the whole of the
   content
 *     ```
       <div class="portfolio">
       						<div class="portfolioPadding">
       							<?php the_content(); ?>
       						</div><!-- end .portfolioPadding -->
       					</div><!-- end #portfolio -->
       ```
   
 * I know I can add HTML to the content in WordPress but if it’s for a client and
   they don’t understand HTML, it’s not the right way to do it.
 * How do I go about adding classes around lots of elements in the content?
 * Thanks
 * Josh

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

 *  Anonymous User 7265597
 * (@anonymized-7265597)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/adding-content-to-pages/#post-3437453)
 * can you not create a custom page template for this?
 *  Thread Starter [j05hr](https://wordpress.org/support/users/j05hr/)
 * (@j05hr)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/adding-content-to-pages/#post-3437489)
 * That’s what I’ve done but the problem is it only goes around the content once.
   It needs some sort of loop to add the div class 4 times. That’s the bit I’m not
   sure about. How to do the loop.
 *  Anonymous User 7265597
 * (@anonymized-7265597)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/adding-content-to-pages/#post-3437653)
 *     ```
       $custom_loop = new WP_Query('showposts=5&category_name=Featured&orderby=rand');
       if ( $custom_loop->have_posts() ) :
       	echo '<ul>';
       	while ( $custom_loop->have_posts() ) : $custom_loop->the_post();
       		echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
       	endwhile;
       	wp_reset_query();
       	echo '</ul>';
       endif;
       ```
   
 * from `http://www.kristarella.com/2010/02/wordpress-custom-loops/`
 * the above is an example of a custom loop. you can add your code above and below
   and add in the post to show the content. this should work for you.

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

 The topic ‘Adding content to pages’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: Anonymous User 7265597
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/adding-content-to-pages/#post-3437653)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
