Shantz WordPress Prefix Suffix
Blog | Tech Blog | Secure Coding | Twitter | RSS Feed | Get Email Updates
| Download: | shantz-wp-prefix-suffix |
|---|---|
| Version: | 1.1.4 |
| Updated: | February 25, 2009 |
| Size: | 9.69 KB |
| Hits: | 462 |
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.
== 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
© Shantanu Goel | Shantz WordPress Prefix Suffix
|
Liked this post? Get FREE Updates Subscribe to RSS feed |







This post has 58 comments
March 14th, 2008
Hi,
I haven't installed this jet, but is it possible to do this Prefix/Suffix only for special Categories?
March 14th, 2008
@GPSchnyder: Not right now, but I might add it to the plugin if I get a few more requests for the same..
March 26th, 2008
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.
March 26th, 2008
@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..
March 27th, 2008
Great! I've found it. The number of supported sites is waaay more than enough. Thanks.
April 2nd, 2008
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?
April 2nd, 2008
@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.
April 6th, 2008
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
April 6th, 2008
@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 “{”.
April 6th, 2008
Thank You Shantanu! This fixed the problem - I really like your QOTD plugin and I am looking forward to trying this one out!
April 7th, 2008
No Problems, Thom. BTW I've uploaded the fixed version as well.
April 7th, 2008
Should it add the suffix to old posts to? Why isn't the suffix showing up on my site?: http://www.web-magnet.com/
April 8th, 2008
nathan, it will add the suffix to your old posts as well.
Can you send me a screenshot of your settings?
April 8th, 2008
nathan, thanks for reporting the bug. I have fixed it. You can download the updated version now.
July 24th, 2008
This is a great plug in
August 13th, 2008
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
August 13th, 2008
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.
August 13th, 2008
Thanks For the prompt Reply! looking forward to an update!
August 17th, 2008
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.
August 17th, 2008
Ooops Sorry! i deactivated the plugin and activated it again and everything was fine, sorry to bother you, how noobish of me
August 20th, 2008
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?
August 21st, 2008
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.
August 22nd, 2008
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/
August 22nd, 2008
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..
August 22nd, 2008
No problem take your time! Thank you so much, Appreciated!
August 28th, 2008
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.
August 29th, 2008
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?
August 29th, 2008
btw thanks mate!
August 29th, 2008
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...
August 29th, 2008
Yeah! the php start and end tags. Ok Thanks Mate Much Appreciated!
November 27th, 2008
hi. Thanks for plugin
perfect.
Regards
December 10th, 2008
This plug-in is really good
December 23rd, 2008
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
December 23rd, 2008
@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.
January 15th, 2009
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
January 15th, 2009
Problem solved - had to expand the url, many thanks - great job!
February 2nd, 2009
Hi Shantanu
Is it possible to have code in the suffix based on categories?
Thanks
February 2nd, 2009
@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.
February 18th, 2009
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.
February 18th, 2009
@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..
February 18th, 2009
@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..
March 3rd, 2009
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";
March 3rd, 2009
The first line I changed from should read:
$array = explode("</p>", $content);
(the comment processing form stripped that tag)
March 3rd, 2009
@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
May 14th, 2009
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!
May 14th, 2009
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.
May 14th, 2009
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
July 13th, 2009
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
July 13th, 2009
@ibdreamy: Thanks a lot for the nice words
Let me know if you would like to see anything added to it
January 12th, 2010
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
January 13th, 2010
@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?
January 13th, 2010
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.
January 18th, 2010
php not work with wordpress 2.91
February 9th, 2010
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?
February 16th, 2010
@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
May 15th, 2009
you did enclose the code in beginning and ending tags, that identify it as php, right?
May 15th, 2009
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.
January 13th, 2010
@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.
Trackbacks