Support Forum

Blog Post Linking plugin add link text before the beginning of the page

24 Answers

New Answer

MP Mr Papa
Mr Papa
Member

yeah, I know you want to fix your issue… I was more referring to what you were doing as to removing a filter…

I am only guess that you want to remove the potential second use of the filter the_content that Andy mentioned…  and no, if you want to add a filter usage, it would be in the theme, not the plugin…  we use the filter, but then it calls our routine…  if you are trying to do something different, then please explain…

What I was asking you to do is to search through the wp theme you are using for any apply_filters() function calls and see if there were any for the filter the_content…  if so, you would see what the callback they were using was…

but I am also wondering if Any was really saying that your sp theme was actually calling the wp function the_content() twice vs the filter…  in that case, you would want to search your theme for that function call the_content() and see where its done…  since you did not find a second one, I was wonder if perhaps it was done via a filter vs a direct call…

for example, we do:

       add_filter(‘the_content’, ‘sp_render_forum’, 1);

so our callback is sp_render_forum…  so look for something similar in your wp theme and lets see if your theme is keying and outputting data based on that filter since you cannot find multiple calls to the_content()…

BB Bruce Brown
Bruce Brown
Member

Sorry, I guess I’m thick headed, tired and grumpy. I finally get what you mean about the the_content being called from a filter, and will look at that closer.

What is the function that creates the “Join the Forum discussion on this Topic”. Can’t I just run a remove_filter on that, then place that function on the page where I want it?

MP Mr Papa
Mr Papa
Member

these would be the two you are looking for

    add_filter(‘the_content’,                 ‘sp_linking_show_blog_link’);
    add_filter(‘the excerpt’,                 ‘sp_linking_show_blog_link’);

do you have a link to this theme? we might be able to look at it and see what is up…

and dont worry about asking questions… we are here to help… and frankly, Andy wrote the blog linking stuff, so he knows it better than I! kiss

BB Bruce Brown
Bruce Brown
Member

Well, I did a more thorough search through the theme’s files. I did not find any apply_filters (aside from one in the functions files). And a few of the files do have two the_content calls, but they are nested in “if” statements. I wonder….

And yes, I do have a link to the theme as we are using it here ya go: http://www.commonsensereview.com/dailypost.zip

 

And I think I’ll call it a night. Thanks for the help. Sorry if my crankiness came though a bit too much.

YS Yellow Swordfish
Yellow Swordfish
Member

Morning Bruce and Son of Bruce

Rather than mess with your theme filters I would suggest using a standard template tag in the theme template(s). This will ensure that it only gets run the once. Then you can turn off the option in the forum admin. The downside of course is that you are making customisation to your WP theme template but easier to deal with probably than messing with filters.

If you want to take this route the template tag call is:

spBlogTopicLink($postid, $show_img);

You need to pass the $post id. The standard for this when placed in the loop is the global $post->ID so I would try that and hopefully your theme does support it.

The second parameter is just a true/false on whether you want the little icon to show alongside the label text. It defaults to true.

That template tag performs the echo so you do not need to echo it.

MP Mr Papa
Mr Papa
Member

some how I knew Andy would have a better solution on this one! smile

BB Bruce Brown
Bruce Brown
Member

Round 2, a new day :-).

 

So here’s what I did (this was before Swordfish’s above post):

In the header template file,

<?php remove_filter('the_content','sp_linking_show_blog_link'); ?>

Then in the content template file, where I want the link:

<?php echo sp_linking_show_blog_link(); ?>

  Now I’m gonna mess around with Swordfish’s template tag he posted above. Thank you both for the help. smile

MP Mr Papa
Mr Papa
Member

okay, let us know how it goes…  and if you run into any more questions on it…