• 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)

    can you not create a custom page template for this?

    Thread Starter j05hr

    (@j05hr)

    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)

    $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.