WordPress users: How can I add a link to each Post automatically?

7 replies
(Hope this is the right forum)...

Hi guys,

I've been pulling my hair trying to find a plugin that does this (meaning, I'm not good enough with code to create some kind of "rule" that makes this happen):

I've got a site I'm working on in WordPress. It's made up of "Pages". One of the pages is a blog, which displays "Posts". I need a way to add the following text/link to the bottom of each Post - and only Post, not the bottom of each page:

"Click here to return to Our Blog!"

I've tried two or three WordPress "post footer" plugins; they all do what they say, except they add the text/link I specify to both the bottom of each Post AND each Page; I need to add a link to only the bottom of each Post automatically.

If anyone can help me out (either with a free plugin suggestion, or simple code, explaining exactly where it should go), I'd hugely appreciate it.

Thanks!
#add #automatically #link #post #users #wordpress
  • Profile picture of the author CyberSorcerer
    Add the code in the Wordpress loop, that way it will be put into each post. This would be a simple thing for your outsourcer and web programmer.
    {{ DiscussionBoard.errors[3827432].message }}
    • Profile picture of the author celente
      Originally Posted by CyberSorcerer View Post

      Add the code in the Wordpress loop, that way it will be put into each post. This would be a simple thing for your outsourcer and web programmer.
      yes a loop would work well in this situation.

      Also, the warrior forum has very good guys that can do this for you, for a decent price.

      Just advertise on looking to hire section.
      {{ DiscussionBoard.errors[3830271].message }}
  • Profile picture of the author Istvan Horvath
    Just a note of WP "spelling": only Pages are spelled with capital P in the WP docs, posts never.

    If by the "bottom of each post" you mean the single post view of each post... (NOT the multipost view as on index, archives etc.) - then the file to edit is single.php in your theme folder.
    You can insert anything you want to be displayed on all posts before the Loop is ended; i.e. before the line(s) that say something like
    endwhile / endif
    Signature

    {{ DiscussionBoard.errors[3827459].message }}
  • Profile picture of the author christopher jon
    The easiest way to do it is add your link in single.php. That is the template used for 'posts' while pages.php is the template used for pages.

    Code:
    <p><a href = "http://your-page-url-here">Click here to return to Our Blog!</a></p>
    Where exactly do you put it? Well, it really depends on the theme you are using. Experiment a little and have fun with it. It's not going to break anything. If you're using TwentyTen, good luck, that theme is a maze.

    Using a plugin for something so easy is silly
    {{ DiscussionBoard.errors[3827472].message }}
    • Profile picture of the author bummed.out
      Originally Posted by christopher jon View Post

      The easiest way to do it is add your link in single.php. That is the template used for 'posts' while pages.php is the template used for pages.

      Code:
      <p><a href = "http://your-page-url-here">Click here to return to Our Blog!</a></p>
      Where exactly do you put it? Well, it really depends on the theme you are using. Experiment a little and have fun with it. It's not going to break anything. If you're using TwentyTen, good luck, that theme is a maze.

      Using a plugin for something so easy is silly
      Thank you; I will try this!

      "Just a note of WP "spelling": only Pages are spelled with capital P in the WP docs, posts never."

      Cheers, thanks.

      Thanks, people. I'm going to give this a try. I agree, I thought it's a bit much to use a plugin to only add one line - but when you don't necessarily know code, or even where to put it, plugins are tempting. I'll report back.

      Peace
      {{ DiscussionBoard.errors[3829083].message }}
  • Profile picture of the author bummed.out
    Yes! It worked; you guys are awesome; thanks a ton! The only thing I'm not sure about is why, when I add <strong> tags to that line of HTML, it appears as bold text in Internet Explorer, but not in Google Chrome. Not a big deal, but if anyone has an idea, go for it.

    Oh - one other question; though the line I added now appears at the bottom of every post, it is probably several lines below the very bottom of each post. Is there any way to make it appear just one or two under the last line of text in each post?

    When I added my text/link into single.php, I've got it directly under a </div> tag, so it looks like this (formatting's a bit off, pasting into here, but you get the idea)

    </div>
    <p><a href="http:mysite.com/blog">Click here to return to Our Blog!</a><p>
    <?php endwhile; endif; ?>

    I already tried moving the </div> up one line; nothing bad happened, but my text is still several lines below the last line of the post.

    What do you think?

    Cheers
    {{ DiscussionBoard.errors[3829103].message }}
  • Profile picture of the author Istvan Horvath
    Did you try
    a) putting the paragraph inside the div - or
    b) not using paragraph tags?

    Explanation: divs and paragraph by default are rendered with margin-top and margin-bottom; that might be the reason for the "gap".
    Signature

    {{ DiscussionBoard.errors[3829769].message }}

Trending Topics