1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

In WP where do I put custom code for specific post if some of it has to go in the header?

Discussion in 'Blogging' started by Rambo the Great, Sep 3, 2014.

  1. Rambo the Great

    Rambo the Great Junior Member

    Joined:
    Jun 30, 2014
    Messages:
    154
    Likes Received:
    11
    I want to use this code for an image gallery:

    Code:
     <html>
    <head>
    <style>
    div.img   {
          margin: 5px;
        padding: 5px;
        border: 1px solid #0000ff;
              height: auto;
          width: auto;
              float: left;
          text-align: center;
      }
        
    div.img img   {
          display: inline;
              margin: 5px;
          border: 1px solid #ffffff;
      }
        
    div.img a:hover img   {
            border:1px solid #0000ff;
      }
        
    div.desc   {
              text-align: center;
          font-weight: normal;
              width: 120px;
          margin: 5px;
      }
    </style>
    </head>
    <body>
    
    <div class="img">
          <a target="_blank" href="klematis_big.htm">
              <img src="klematis_small.jpg" alt="Klematis" width="110"   height="90">
          </a>
          <div class="desc">Add a description of the image here</div>
    </div>
    <div class="img">
          <a target="_blank" href="klematis2_big.htm">
          <img src="klematis2_small.jpg" alt="Klematis" width="110"   height="90">
          </a>
          <div class="desc">Add a description of the image here</div>
    </div>
    <div class="img">
          <a target="_blank" href="klematis3_big.htm">
          <img src="klematis3_small.jpg" alt="Klematis" width="110"   height="90">
          </a>
          <div class="desc">Add a description of the image here</div>
    </div>
    <div class="img">
          <a target="_blank" href="klematis4_big.htm">
          <img src="klematis4_small.jpg" alt="Klematis" width="110"   height="90">
          </a>
          <div class="desc">Add a description of the image here</div>
    </div>
    
    </body>
    </html> 
    
    
    but where does the header stuff go? cos I cant just dump it in the text part of the post can i?
     
    Last edited: Sep 3, 2014
  2. Rambo the Great

    Rambo the Great Junior Member

    Joined:
    Jun 30, 2014
    Messages:
    154
    Likes Received:
    11
    someone answer me please
     
  3. Schvamp

    Schvamp Power Member

    Joined:
    Feb 13, 2012
    Messages:
    684
    Likes Received:
    549
    Location:
    Hogwarts
    You paste everything between <style></style> in style.css in your theme folder and between <body></body> where you want to show the images.
    You may need to give those style sub ids tho, as they might mess with your theme style otherwise.
     
    • Thanks Thanks x 1
  4. Rambo the Great

    Rambo the Great Junior Member

    Joined:
    Jun 30, 2014
    Messages:
    154
    Likes Received:
    11
    I realised a much simpler solution was finding a plugin :p.

    Still messing around with coding my own sites from scratch but it seems to be easier to either do it one way or the other.