Placing Default content in every WP post?

Discussion in 'Blogging' started by pratik, Mar 18, 2008.

  1. #1
    hi there,

    I have a blog... in tht i have to place an image banner and a subscribe to RSS via email form in every post i make.. i mean at the end of the post...

    So, can how do i do this.. i mean can i edit the single post file from the theme i am using... by placing an <img> tag??

    or there is some other way around...

    Thanks in advance
     
    pratik, Mar 18, 2008 IP
  2. CaffinePhil

    CaffinePhil Banned

    Messages:
    945
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is probably the totally wrong way to do this but you could write a new post and copy the code you want in every post. Then Title the next few posts and add the content, save but don't publish and these will act as a template for when you want to make a new post.

    There is probably an easier way.
     
    CaffinePhil, Mar 19, 2008 IP
  3. devilkitty

    devilkitty Peon

    Messages:
    303
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Whenever i've wanted to add anything to every post. I have done it as you stated in your first post. Edited the theme to get the image/advert/specific text in the right place. It might be kinda dodgy if your trying to place it in the middle of your post. But if your looking for the top or bottom of each post. Then the theme editing should be the easiet way to deal with it.

    Just back up your current theme. Then play about with it editing and refreshing the page as you go along until you have it where you want it.

    Regards
    DK
     
    devilkitty, Mar 19, 2008 IP
  4. CaffinePhil

    CaffinePhil Banned

    Messages:
    945
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Which part of the theme do you edit, is it the main theme file?
     
    CaffinePhil, Mar 19, 2008 IP
  5. MTbiker

    MTbiker Well-Known Member

    Messages:
    2,536
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    170
    #5
    I do it by editing the single.php file. You can put another div in there with images, links, etc.

    Example:

    <div style="margin: 20px 0; border: 1px dotted #000000;">
    	<img src="images/rss.gif" alt="rss" width="16" /> Like my blog?  Then  <a href="http://feeds.feedburner.com/myblog">subscribe to my RSS feed</a>.
    </div>
    PHP:
     
    MTbiker, Mar 19, 2008 IP
  6. CaffinePhil

    CaffinePhil Banned

    Messages:
    945
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    How about if you don't have a single.php file, I have these:

    * reset-fonts-grids-tabs.css
    * Stylesheet
    * Main Index Template
    * Page Template
    * Archives
    * Comments
    * Footer
    * functions.php
    * Header
    * Search Results
    * searchform.php
    * Sidebar
     
    CaffinePhil, Mar 19, 2008 IP
  7. MTbiker

    MTbiker Well-Known Member

    Messages:
    2,536
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    170
    #7
    Phil: comments.php usually works in that case (if the theme doesn't use a single.php file). You'd just put the code at the top of the file in this case.
     
    MTbiker, Mar 19, 2008 IP
    pratik likes this.
  8. Ikki

    Ikki Peon

    Messages:
    474
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You can also edit the "Main Index Template" script.

    Find this:
    <div class="entry">
    	<?php the_content('Read more &raquo;'); ?>
    </div>
    PHP:
    ... and replace it with:
    <div class="entry">
    	<?php the_content('Read more &raquo;'); ?>
    	<div style="margin: 20px 0; border: 1px dotted #000000;">
    		Put here whatever you want to show right after your post.
    	</div>
    </div>
    PHP:
    That will put in all your posts anything you want automatically. Give it a try. The "div" tag isn't necessary. I borrowed it from MTBiker's post (hope you don't mind ;)).

    P.S.: I'd recommend you backup that file before making any changes to it.
     
    Ikki, Mar 19, 2008 IP
    pratik likes this.
  9. pratik

    pratik Notable Member

    Messages:
    2,306
    Likes Received:
    114
    Best Answers:
    0
    Trophy Points:
    200
    #9
    Thanks guys.... i tried MTbiker's codes.. and it worked :)

    Thanks to all....
     
    pratik, Mar 19, 2008 IP