1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to add a Small Sentence at the start or end of each Post in single.php

Discussion in 'WordPress' started by charlyms21, Jul 16, 2010.

  1. #1
    I would like to add a small sentence showing for
    eg:For More Effective Weight Loss Tips Go to LINK and lose Weight Quickly
    or something like that.
    But I have already made my blog some months before and now I would Like to add this small text of <p>Paragraph</p> before or after each wordpress Blog posts which I already updated.
    I would like to know how is it possible to do that from editing files from single.php
     
    charlyms21, Jul 16, 2010 IP
  2. charlyms21

    charlyms21 Peon

    Messages:
    178
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    My single.php file goes like this
    So here for eg: if I want to add a small paragraph containing my affiliate link at the start of each post or to add a small Paragraph at the end of each post,what should I do?
     
    charlyms21, Jul 16, 2010 IP
  3. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I wouldn't bother editing single.php, when it comes to editing/adding posts in the future it will just make it awkward :).

    Instead, just run this in phpMyAdmin with your text inside the single quotes:
    
    UPDATE wp_posts SET post_content = CONCAT(post_content, 'For More Effective Weight Loss Tips Go to LINK and lose Weight Quickly') WHERE post_type = 'post'
    
    Code (markup):
    It will add that text to the end of every post
     
    Deacalion, Jul 16, 2010 IP
  4. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you really want to do it via editing single.php, just add the text underneath:
    
    <?php the_content(__('Continue reading','panorama') . ' &#39;' . get_the_title('', '', false) . '&#39;&raquo;'); ?>
    
    PHP:
     
    Deacalion, Jul 16, 2010 IP
  5. charlyms21

    charlyms21 Peon

    Messages:
    178
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Can you show me how do I add this in my PHP my admin.I am using hostgator.Also what should I do to add a small paragraph at the start of each post.Like for

    eg:"UK and Canada Users,click here for the same offer"

    to be added at the start of each and every post linking to a different Page altogether
     
    charlyms21, Jul 16, 2010 IP
  6. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    First you need to go to your cPanel. http://www.your-site.co.uk:2082/ and log in with you account details. (host will have provided you with them)
    Then look for the phpMyAdmin link, click that. Then on the left above where it says "Please select a database" - look for something that looks like wordpress or if theres only one line, click that.
    Now near the top there should be a tab called "SQL", click it. Copy and paste the SQL code into the box and click 'Go'.

    Here is the SQL code to put text at the beginning of every post, once again - change text to suite what ever you want :).
    
    UPDATE wp_posts SET post_content = CONCAT('UK and Canada Users,click here for the same offer ', post_content) WHERE post_type = 'post'
    
    Code (markup):
     
    Deacalion, Jul 16, 2010 IP