• Resolved dlogan

    (@dlogan)


    I have a page that pulls the first post from a category, but I want to have another page that pulls the 2nd post, and a third page that pulls the 3rd post, etc.

    Here is the page, which we use to create the HTML for our email newsletter: https://centralpa.aiga.org/email

    And here is the code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style>
    body {
    	font-family:Georgia,Times,serif;
    	font-size:12px;
    	font-size-adjust:none;
    	font-style:normal;
    	font-variant:normal;
    	font-weight:normal;
    	line-height:normal;
    }
    .big {
    	font-size: 24px;
    }
    .header {
    	color: #FFFFFF;
    }
    .header a{
    	color: #FFFFFF;
    }
    .body {
    	color: #666666;
    	line-height: 22px;
    }
    a {
    	color: #333333;
    	text-decoration: underline;
    }
    
    </style>
    </head>
    <body bgcolor="#CDCDCD" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table border="0" cellpadding="0" cellspacing="0" align="center" width="636">
      <tr>
        <td><img src="<?php bloginfo('template_url');?>/images/email_header.jpg" alt="AIGA Central PA" border="0" usemap="#Map"/></td>
      </tr>
      <tr>
        <td>
    	<table border="0" cellpadding="6" align="center" width="600" bgcolor="#FFFFFF">
            <tr>
              <td colspan="2">
    
    			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<?if (get_post_meta(get_the_ID(), "Show", true)):?>
    			<table width="100%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td bgcolor="#CC3300" class="header" style="padding: 10px;"><span class="big"><?the_title()?></span><br /><?the_content()?></td>
                  </tr>
                </table>
    			<?endif;?>
                <?php endwhile; endif; ?>
    
    			<?php $my_query = new WP_Query('category_name=Upcoming Events&orderby=date&order=ASC&posts_per_page=1'); while ($my_query->have_posts()) : $my_query->the_post(); ?>
    			  <img src="<?php echo get_meta_image_url(get_post_meta(get_the_ID(), "Email Image", true))?>" width="600"/><br />
    			<table width="100%" border="0" cellpadding="0" cellspacing="0" >
    				  <tr>
    					<td valign="top">
    					<br />
    					<table width="100%" border="0" cellpadding="10" cellspacing="0" >
    					  <tr>
    						<td class="body">
    							<p><span class="big"><?the_title()?></span></p>
    							<p><?php the_time('F jS, Y') ?> | <a href="<?php the_permalink()?>">Click Here to Register/RSVP</a></p>
    							<p><?the_content()?></p>
    						</td>
    					  </tr>
    					</table>
    
    					<?if (get_post_meta(get_the_ID(), "Registration Info", true)):?>
    					</td>
    					<td valign="top">
    					<br />
    					<table width="250" border="0" cellpadding="10" cellspacing="0">
    					  <tr>
    						<td bgcolor="#EA8624" class="header">Register for this Event </td>
    					  </tr>
    					  <tr>
    						<td bgcolor="#FBE9D7" class="body">
    							<?php $info = get_post_meta($post->ID, 'Registration Info', true); ?><?php echo $info; ?>
    							<?if (get_post_meta(get_the_ID(), "Nonmember", true)):?>
    							<p>
    							<?php $nonmember = get_post_meta($post->ID, 'Nonmember', true); ?>
    							<strong>Non-members:</strong> $<?php echo $nonmember; ?> <a href="<?php the_permalink()?>">Register</a>
    							</p>
    							<?endif;?>
    
    							<?if (get_post_meta(get_the_ID(), "Student Nonmember", true)):?>
    							<p>
    							<?php $studentnonmember = get_post_meta($post->ID, 'Student Nonmember', true); ?>
    							<strong>Student Non-members:</strong> $<?php echo $studentnonmember; ?>  <a href="<?php the_permalink()?>">Register</a>
    							</p>
    							<?endif;?>
    
    							<?if (get_post_meta(get_the_ID(), "Member", true)):?>
    							<p>
    							<?php $member = get_post_meta($post->ID, 'Member', true); ?>
    							<strong>Members:</strong> $<?php echo $member; ?>  <a href="<?php the_permalink()?>">Register</a>
    							</p>
    							<?endif;?>
    
    							<?if (get_post_meta(get_the_ID(), "Student", true)):?>
    							<p>
    							<?php $student = get_post_meta($post->ID, 'Student', true); ?>
    							<strong>Students:</strong> $<?php echo $student; ?>  <a href="<?php the_permalink()?>">Register</a>
    							</p>
    							<?endif;?>
    						</td>
    					  </tr>
    					</table>
    					<?endif;?>
    
    					</td>
    				  </tr>
    			</table>
    
    			  </td>
    		</tr>
    			<?php endwhile; ?>
    			<tr>
    			  <td colspan="2"><table width="100%" border="0" cellpadding="10" cellspacing="0">
    				  <tr>
    					<td bgcolor="#DADADA" class="body">&copy; 2010 AIGA Central PA Chapter | The professional association for design.</td>
    				  </tr>
    				</table></td>
    			</tr>
    	  </table></td>
      </tr>
    </table>
    
    <map name="Map" id="Map"><area shape="rect" coords="155,107,251,133" href="https://centralpa.aiga.org" />
    <area shape="rect" coords="258,107,403,133" href="https://centralpa.aiga.org/category/upcoming-events" />
    <area shape="rect" coords="411,107,585,131" href="[fwd_url]" />
    </map></body>
    </html>

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display the second post in a category?’ is closed to new replies.