Shantz WP Prefix Suffix
== Description ==
Shantz WP Prefix Suffix is a light-weight and easy to use plugin which allows you to add any text and/or HTML/CSS code to your posts and/or pages as prefix (top / beginning), middle and/or suffix (bottom /end). (That includes even any new or old posts and pages and even your feed)
Examples of use cases could be to include your copyright message, advertisements (like adsense, etc), permalinks, your other site links, any other custom messages. This works very fine with ads as you don’t have to manipulate your posts or templates to add the ad code, shantz-wp-prefix-suffix will do that for you automatically for all posts and you also get basic controls whether to “display” the ad or not (on home pages, excerpts, etc).
Features:
- Add Prefix to all your posts automatically.
- Add Prefix to all your pages automatically.
- Add Suffix to all your posts automatically.
- Add Suffix to all your pages automatically.
- You can control the number of paragraphs/words after which your code/text should be added while using the “middle” option.
- Prefix/Suffix can be plain text, HTML, CSS, PHP, javascript etc.
- Optionally display/not display on home page/excerpts etc.
- Control plugin order for fine control over where your code/text is displayed.
Download: http://wordpress.org/extend/plugins/shantz-wp-prefix-suffix/
== Installation ==
The shantz-wp-prefix-suffix plugin can be installed in following easy steps:
1. Unzip “shantz-wp-prefix-suffix” archive and put all files into your “plugins” folder (/wp-content/plugins/). It is advisable to create a sub directory into the plugins folder, like /wp-content/plugins/shantz-wp-prefix-suffix/
2. Activate the plugin
3. Go to Options > Shantz WP Prefix Suffix, adjust your settings and save them.
== Frequently Asked Questions ==
= How do I add My copyright message and post permalink so as to protect myself against RSS feed scrapers =
Add the following code to “Suffix text box” and check the “enable php input” option (without the “pre” and “code” tags. I put them there for the wordpress readme parser):
© <a href="http://tech.shantanugoel.com/">Shantanu Goel</a> | <a href="<?php echo get_permalink();?>"><?php the_title();?></a>
= How do I use this for Adsense =
You can either paste your javascript code in the text box and ads will appear automatically in your posts. If you use an ad management plugin like adsense-manager then you can paste the code given by that plugin in the text box, so that all your posts/pages will be “able” to display the code but actual display is controlled by your ad management plugin.
= How to upgrade to a new version =
Use the automatic upgrade option in WordPress or simply overwrite the old files with the new ones.
= How can I contribute to keep the development of this plugin going =
You could add a link to my blog from your site or click on the donate link on the settings screen
= My question isn’t listed here =
Post a comment here, or contact me through the contact page.
== Screenshots ==
You can see the plugin in action on this site on any post (The links at top of each post, the adsense ads in the middle of the posts and the copyright notice and feed subscription links at the bottom)
== Version History ==
- Version 1.1.4
- Fixed input field size issues on settings page
- Fixed the issue where the settings were not being saved
- Version 1.1.3
- Removed some debug code that crept into last version
- Version 1.1.2
- Added option for controlling plugin priority to resolve order issues if there are other plugins that add text to your posts.
- WP 2.7.1 Compatibility
- Minor cosmetic changes
- Version 1.1.1
- Fixed a bug that was causing conflicts with some other plugins that add content to end of posts
- Version 1.1.0
- Added option to add code/text to the middle of the posts
- Version 1.0.5
- Added option to enable/disable adding prefix/suffix to home page
- Added option to enable/disable adding prefix/suffix to excerpts
- Fixed a bug in which the prefix/suffix was displaying even if you set it not to
- Version 1.0.4
- Added option for using php code for prefix and suffix
- Version 1.0.3
- Fixed a bug that was causing prefix-suffix to not display under certain conditions
- Version 1.0.2
- Fixed a typo that was causing errors while activating the plugin
- Version 1.0.1
- Options to not display the prefix/suffix on pages also works for WP < 2.1
- Version 1.0.0
- Initial version



[...] Shantz WordPress Prefix Suffix [...]
Hi,
I haven’t installed this jet, but is it possible to do this Prefix/Suffix only for special Categories?
@GPSchnyder: Not right now, but I might add it to the plugin if I get a few more requests for the same..
[...] Shantz WordPress Prefix Suffix [...]
Hi Shantanu,
I was wondering if you could share with me where I could acquire the code to add the social-bookmarking site icons to my blog posts. Also, would it be possible to customize them, as in add/remove certain ones?
Thanks.
@Kedavix: I use the plugin “sociable” for this. You can find it at http://wordpress.org/extend/plugins/sociable/ . And yes, it has a loooot of sites and you can choose which ones to display. And I think it’d be easy enough to add new ones if not already present in there..
Great! I’ve found it. The number of supported sites is waaay more than enough. Thanks.
Hi
do you have any idea why I get a
“Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected ‘{‘ in C:\xampplite\htdocs\wordpress\wp-content\plugins\shantz-wp-prefix-suffix\shantz-wp-prefix-suffix.php on line 135″
when I try to activate the plugin?
@Lars: oops!! you are correct..Somehow there is a closing brace missing for the “if” condition. I’ll try to release a fixed version in a couple of days when I get time. Meanwhile, you can fix it by opening the shantz-wp-prefix-suffix.php in any text editor. Go to line 135 and add a “)” (without the quotes) before the “{“.
Thanks for the bug report.
Currently as of Saturday, April 05 2008 this plugin failed under WordPress 2.5. Will you be updating it to work with 2.5?
This is the notification WP gave me:
Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected ‘{‘ in /home/thom/citb/wp-content/plugins/shantz-wp-prefix-suffix/shantz-wp-prefix-suffix.php on line 135
@Thom: The plugin is fully WP2.5 compatible. However, somehow in my last upload a mistake crept into the plugin. I’ll be releasing a fixed version soon. However, meanwhile you can fix it by opening the shantz-wp-prefix-suffix.php in any text editor. Go to line 135 and add a “)” (without the quotes) before the “{”.
Thank You Shantanu! This fixed the problem – I really like your QOTD plugin and I am looking forward to trying this one out!
No Problems, Thom. BTW I’ve uploaded the fixed version as well.
[...] Shantz WordPress Prefix Suffix [...]
Should it add the suffix to old posts to? Why isn’t the suffix showing up on my site?: http://www.web-magnet.com/
nathan, it will add the suffix to your old posts as well.
Can you send me a screenshot of your settings?
nathan, thanks for reporting the bug. I have fixed it. You can download the updated version now.
[...] Shantz WordPress Prefix Suffix 1.0.3 » Shantanu Goel (url) This plugin shall give you the ability to add any text/HTML/CSS code to the beginning or end of your posts and/or pages. Go to shantz-wp-prefix-suffix for updates and support. Also visit my tech site. [...]
This is a great plug in
Hey, I have been using this plugin for a while now and loving it but unfortunately after I upgraded to wordpress 2.6 there has been some problem that is if uncheck “Add suffix to pages?” option then it wont show the prefix in post’s too otherwise its fine
Saad: Thanks for reporting the issue. I’ll check it out over the weekend. I think thats because I vaguely remember reading that page/post thing changed a bit in 2.6.
Thanks For the prompt Reply! looking forward to an update!
Saad: I just went over this. It seems to be working here with all the possible combinations of the options on my blog as well as a local test blog running on WP 2.6 as well as WP 2.6.1. Can you make sure that you are running version 1.0.3 of the plugin?
Can you send me a screen shot of your settings? Also, if possible, make the settings, as u mentioned, on ur blog and let me know so that I can try to see if there is something wrong that I can detect from your blog’s pages.
Ooops Sorry! i deactivated the plugin and activated it again and everything was fine, sorry to bother you, how noobish of me
Hello! i wanted to know is there a way in which i can place the code where i want to show the prefix/suffix in the single post.php file?
Saad: Do you mean that you want to display prefix/suffix “only” on single posts and not on front page? because if you turn on the display on posts option then it displays the prefix/suffix on single posts as well as front page.
Shantanu I mean is there any code that I can place in the single post.php file manually instead of enabling the option so that i can determine where the suffix shows up
example:
http://yoast.com/wordpress/sociable/
^see here, sociable allows you to to place a code where you want the icons to show!
i want to show the suffix below the adsense ads see here:
http://www.geekishblog.com/2008/08/exclude-your-own-visits-from-google-analytics-on-your-wordpress-blog/
ohk. Yes, there is a way to do that but it’s a long winded way as in there is no function as such that u can call to get it. I’ll put out the code for u tmrw as its quite late here now..otherwise i might even update the plugin to wrap it around a function that can be used easily..
No problem take your time! Thank you so much, Appreciated!
Saad:Sorry for the late reply. Anyways, here is the code
Let me know if it worked for u as I’ve not tried it out.
Hey Shantz!
well the code is working after i put tag in the start and end of the code
now i think it wont show up in the feeds will it?
btw thanks mate!
which tags did you put saad? the php start and end tags? I had put them in the sample code but it was having problems in showing up so removed them..
Abt the feeds, I think it would show up there as well…
Yeah! the php start and end tags. Ok Thanks Mate Much Appreciated!
[...] Shantz WordPress Prefix Suffix [...]
[...] Shantz WordPress Prefix Suffix [...]
[...] Shantz WordPress Prefix Suffix [...]
[...] Shantz WordPress Prefix Suffix [...]
[...] Shantz WP Prefix Suffix – is a light plugin to quickly add text/htm/css before and/or after your posts and/or pages. [...]
[...] Shantz WordPress Prefix Suffix [...]
hi. Thanks for plugin
perfect.
Regards
This plug-in is really good
why do you add a back link on each post?
After i installed this plugin, each post has a link “powered by shantz-wp-prefix-suffix” that links back to your site.
that really kills this plugin
@km603: You can remove the backlink (as mentioned in the readme.txt file included in the plugin). Just open the shantz-wp-prefix-suffix.php file, go to line 229, and set the variable $promote to ‘false’ instead of ‘true’. In next version I’ll give this as a configurable option through the settings screen in wordpress dashboard.
Hi there,
Great plugin – it works a charm except it won’t seem to display pictures on the actual post pages, only on the front page? Any way around this?
Thank-you
Problem solved – had to expand the url, many thanks – great job!
[...] Shantanu’s WP Prefix Suffix Plugin is not really an ad plugin. It allows you to add some form of content, text, HTML/CSS, javascript, etc., before, after, or in the middle of the a page or post. It can easily be used for ads, you just need to paste the code into one of the 3 input boxed, depending on where you want the ad to appear. And you have control over whether it appears on pages, posts, your homepage, and your excerpts. Easy to set up, and can be very useful for all kinds of things, but somewhat limited for ad placement. [...]
[...] and easy to use plugin which allows you to add any text and/or HTML/CSS code to your posts …..read more Download Plugin! Version 1.1.1 Last Updated: November 27, 2008 Author: Shantanu Goel Visit [...]
Hi Shantanu
Is it possible to have code in the suffix based on categories?
Thanks
@Scott: Although there is no built-in “option” for this, but this can be easily achieved using the “php” option. Whatever suffix you want, you can enclose them around a bit of php code that echoes ur suffix only based on categories. If you want more details, you can contact me through the contact page.
For some reason I cannot get this to work. First off, the little boxes for “Plugin Priority” et al are too small for me to be able to read any numbers I place in them. Secondly, whenever I click on the “Update Settings” button nothing happens. I am using the latest version of the plugin and WP 2.7.1.
@Mike: I found an issue with the plugin’s settings page with WP versions > 2.7. The issue is known and will be fixed in next version..
@All: The issues are fixed now. With v 1.1.4. Please download it from wordpress plugin repository. I’ll update the copy on this site soon as well..
[...] more details and downloads, head on to the Shantz WP Prefix Suffix Home Page and do not hesitate to post any questions you have, or feature requests as [...]
[...] the settings were no longer being saved. Also fixed some minor cosmetic issues. So, hop on to the Shantz WordPress Prefix Suffix Home Page for downloads and details. And yes, don’t forget to leave [...]
I just upgraded to 1.1.4 (and WordPress 2.7.1) and the plugin no longer places content in the middle of posts properly. Looking at the code I see it splits the post content on a closing p tag. Looking at the content it is parsing, I see the line breaks have not yet been converted to paragraph tags. I fixed this by changin a couple lines. Starting around line 338 I changed:
$array = explode(“”, $content);
for($i = 0; $i < count($array); $i++)
{
$temp_content .= $array[$i];
to:
$array = explode(“\r\n\r\n”, $content);
for($i = 0; $i < count($array); $i++)
{
$temp_content .= $array[$i] . “\r\n\r\n”;
The first line I changed from should read:
$array = explode(“</p>”, $content);
(the comment processing form stripped that tag)
@Mike: Thanks for that. It seems a bit weird though as I haven’t faced this issue at all in 2.7.1 and line breaks have already been converted to paragraph tags. I’ll test this out again as you have mentioned and incorporate your patch accordingly. BTW, there is another option already there for such instances that you can also specify number of words, and it will add it after minimum of the two things (no. of paragraphs and no. of words). Thanks once again
[...] Shantz WordPress Prefix Suffix (Plugin Homepage) [...]
Hi, I’ve been looking for ages for a plugin to add say, a single random or another post to the end of a single post page. This may be the answer – but how could I add post(s) either random or otherwise using this?
Probably this is a bit ambitious, but if you can quickly even point me in the right direction I’d appreciate it!
Andy, yes you can accomplish this easily (random as well as particular post). Look at the wordpress functions wp_get_single_post, get_posts, query_posts etc and you can use them in the text box given in plugin settings after enabling the “php” option in the plugin settings.
Thanks very much for the prompt reply – I had a look at that but don’t yet have the PHP experience to work out the exact code to put in the box to display say, 5 random posts but not the one in the post. Tried several times but just got the code line that I put in obviously I’ve done it wrong! I’ll leave it for a while and study php some more. Thanks again. Andy
you did enclose the code in beginning and ending tags, that identify it as php, right?
Yes, I did but I couldn’t work out the syntax to get the code to work (and the way I wanted). I tried some of the php examples from the codex and the syntax for them seemed correct but none worked when put in the PHP box. I just got the code displayed.
As I said, I’ll spend some time looking at the examples on the codex and see how I get on when I have the time.
[...] I just signed up with them as an affiliate and added a banner to the bottom of my posts using the Shantz WordPress Prefix/Suffix Plugin which I also love by the [...]
I just want to say I’m shocked you only have a 3 star rating. I love this plugin and use it on all my WordPress installs. It’s perfect and it gets the job done with as little fuss as possible and I like that. Thank you for sharing this cool little blogging tool.
divageekdesigns.com
@ibdreamy: Thanks a lot for the nice words
Let me know if you would like to see anything added to it
Hello,
I just installed this plug-in yesterday and am very impressed. It does everything I want right now, plus more that I’ll want in the future. I am also impressed with how quickly and effectively you answer questions on here.
Here’s a problem I’m having. It seems to operate fine, it’s displaying everything correctly, but when I try to save a new draft it brings up a plain white screen with this message instead of saving my draft:
Warning: Cannot modify header information – headers already sent by (output started at /home7/phoxieph/public_html/consciousme/wp-content/plugins/shantz-wp-prefix-suffix/shantz-wp-prefix-suffix.php:317) in /home7/phoxieph/public_html/consciousme/wp-includes/pluggable.php on line 865
I can get around this by deactivating the plug-in, but when I reactivate I have the same problem.
Thanks!
-Carlos
@Carlos: Do you have any caching plugin on your site? Can you try these steps once: 1. Disable caching 2. Delete all cache (through plugin and if possible manually by ssh’ing to your hosting account) 3. Enable caching 4. Now try creating a draft.
BTW, which WP version are you using?
I don’t even know what a caching plugin is. I have the version of wordpress before 2.9.1. I haven’t upgraded yet because I need to back up everything first.
@carlos: There is one more thing. Can you check if you have any spaces or blank lines before opening “” tags in shantz-wp-prefix-suffix.php file? Sometimes this can happen due to your ftp server. If yes, then remove these blank lines. If you are not sure, then send me a copy of this php file using the contact form from the contact link at top and I’ll take a look.
php not work with wordpress 2.91
I’ve just installed this plugin to V 2.91 it seems O.K. but the Settings link doesn’t appear so there is no way of creating ADs. Any advice?
@Sue: I am using it on 2.9.1 as well and it works fine. Are you sure you can’t see the settings link? try this link http://yourwebsite.com/wp-admin/options-general.php?page=shantz-wp-prefix-suffix.php
One issue I notice. The suffix goes before the [read more] more, even if I set settings to be ‘after 10 paragraphs’ or X number of words. It always wants to place it before [Read more] in intro text. How do I stop this? When you get full article view, it’s at bottom where it should be.
@Scotty: hmm…that is how I coded it to be actually that if the given setting is more than end of article, then it posts at the end. And for front page articles, it deems the more tag as the end of the article..I can provide a setting to over-ride this behaviour. Meanwhile, you can use a workaround that you can surround your prefix with a check for the home page, i.e., “if(!is_home()){}”. This will make sure that the suffix is not posted on the home page. I do the same thing for my blog for all the stuff you see at the bottom of any post.
Hi,
Does this plugin work with WP 3.0.2?
Thanks
[...] href="Go to shantz-wp-prefix-suffix for updates and support. Also visit my tech site. For Programming and secure coding related info, [...]
[...] Shantz WP Prefix Suffix is a light-weight and easy to use plugin which allows you to add any text and/or HTML/CSS code to your posts and/or pages as prefix (top / beginning), middle and/or suffix (bottom /end). (That includes even any new or old posts and pages and even your feed) Examples of use cases could be to include your copyright message, advertisements (like adsense, etc), permalinks, your other site links, any other custom messages. This works very fine with ads as you don’t have to manipulate your posts or templates to add the ad code, shantz-wp-prefix-suffix will do that for you automatically for all posts and you also get basic controls whether to “display” the ad or not (on home pages, excerpts, etc). (For Complete Details and to see the plugin in use, go to my tech blog) [...]