Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3442970
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:44:03+00:00 2026-05-18T08:44:03+00:00

I am wanting to insert some code after each post in WordPress… I know

  • 0

I am wanting to insert some code after each post in WordPress… I know you can do it after this for example, in single.php

<?php the_content(); ?>

However if I do that it puts it in the wrong place.. an example post is here: http://www.hardwareblog.com/348/computer-hardware/top-10-gadget-gift-ideas-to-avoid-this-christmas/ — if I put it AFTER the code example above it will be placed AFTER the sociable & facebook links….. I want to put it BEFORE those, so it’s RIGHT AFTER the post.

I did some checking & testing.. this code here from post-template.php

function the_content($more_link_text = null, $stripteaser = 0) {
    $content = get_the_content($more_link_text, $stripteaser);
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]&gt;', $content);
    echo $content;
}

It seems the facebook & sociable code is inserted into the output within the apply_filters() function…. though I can’t work out where.

Any help on what I am trying to do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:44:04+00:00Added an answer on May 18, 2026 at 8:44 am

    Here is an example of a filter on the content and the function:

        function the_content_replacer($content) 
        {
    //global $post, $posts;
           //$content = str_replace(']]>', ']]&gt;', $content);
    
     $content .= "\n<div style=\"display:none;\">text here</div>"; 
    
    //$content = preg_replace('/="http:\/\/cnn/i', 
    // '="http://example.com?http://cnn', $content, -1); 
           return $content;
        }
        add_filter('the_content', 'the_content_replacer', 1);
    
    1. much more examples on this filter on http://wordpress.stackexchange.com ……….
    2. You can just copy and paste the piece of content in the file “functions.php” in your theme and it will work.
    3. You can also just drop it in the directory wp-content/mu-plugins if your run multisite so it works on all the blogs in your multisite environment.
    4. the third parameters determines the importance of when applying the filter, see: https://wordpress.stackexchange.com/questions/2126/at-what-priority-does-add-filter-overwrite-core-functions

    –> it is better to post all WordPress questions in http://wordpress.stackexchange.com !!!

    –> if you use e.g.

    $content .= "\n<div style=\"display:none;\">text here</div>";
    

    it will not remove a closing paragraph tag (note the linebreak at the beginning of the string)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wanting to find the distance between two different points. This I know
In Resharper when I go back to edit some existing code.. eg. wanting to
Wanting to implement authentication by client certificates I am experiencing some issues. First some
I am wanting to insert a datetime into a MySql data base using Java
I have the below code that i am wanting to into certain files so
I'd like if someone could give me some advice on creating this script, which
I have this code I been working on but I'm having a hard time
Can anyone recommend an xml rpc library or client for wordpress using java? I've
I wanting to show prices for my products in my online store. I'm currently
Not wanting to re-invent the wheel or anything, I was wondering if there's a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.