WordPress.org

Ready to get started?Download WordPress

Forums

Adding advert to a custom page (1 post)

  1. markjames1234
    Member
    Posted 1 year ago #

    Hi,
    I'm try to add a horizontal advert under the most recent post on a custom page of posts. I've got the page as I want it without the advert: http://www.markmcnee.com/plants-in-your-garden/ but when I try to add the php code from http://codex.wordpress.org/User:Tomhanna/Adding_Ads_to_Wordpress the advert appears as it should under the post but the white back ground behind the writing disappears! I'm not a programmer and very confused.
    the code is:

    <?php
    /*
    Template Name: Garden plants with advert
    */
    
    /* if you are not using this in a child of Twenty Eleven,
    *  you need to replicate the html structure of your own theme.
    */
    
    get_header(); 
    
    ?>
    
    <div id="primary">
      <div id="content" role="main">
    <html>
     <img title="Primula denticulata flower"
     style="width: 200px; height: 150px; float: left;"
     alt="Primula denticulata flower"
     src="http://www.markmcnee.com/wp-content/uploads/2012/05/Primula-denticulata.jpg"
     hspace="8" vspace="8">
    <p>I would hope this possibly eclectic  collection of plants will develop into a mixture of common garden plants which you are likely to common across in the majority of gardens and interesting ones I have grown or just come across and I feel should be more widely grown. While this is very much a personal collection I would hope there is something of help and /or interest to many other people and would be interested to here your views on the inclusions and omissions. </p>
    <p>While it may not be as comprehensive as others I would hope to try and make it as accessible as possible to non gardeners.  The fact I have chosen to use the scientific names may be contrary to this but it is made for the simple reason that common names for the same plant vary widely just from one region to another and can unfortunately end up coursing confusion. That said the attempts and arguments of scientist trying to decide what the &ldquo;correct&rdquo; name of a plant is can end up creating a fair bit of confusion anyway!</p><p>To try and make this list as friendly as possible I will as far as possible try and provide more than one picture of the plants, any common names I can find, an indication of how likely you are to come across it and a description in as plain as English as possible. To keep the list as accessable as I can I will base the names on the <acronym title="Royal Horticultural Society">RHS</acronym> horticultural database, this may well mean nothing to you now but hopely as we go on it will, and in the mean time it will make life easier.</p>
     </html>
    
      <?php
    
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
      $args = array(
    	// Change these category SLUGS to suit your use.
    	'category_name' => 'plants',
    	'paged' => $paged
      );
    
      $list_of_posts = new WP_Query( $args ); 
    
      twentyeleven_content_nav( 'nav-above' );
      while ( $list_of_posts->have_posts() ): $list_of_posts->the_post();
    
        // Display content of posts
        get_template_part( 'content', get_post_format() );
    
      endwhile;
      twentyeleven_content_nav( 'nav-below' );
      ?>
      </div><!-- /#content -->
    </div><!-- /#primary -->
    <?php get_footer();

    Can anyone help please?

Topic Closed

This topic has been closed to new replies.

About this Topic