I’m ready with my first plug in for WordPress 😉
The plug-in adds 2 functions:
– add this page to my favourites(or bookmarks in FireFox)
– „set this page as my home page“
You can control the text, the visual style (the links and images are in a CSS class, called addtofavourites), where and what to display .. 🙂
Download from here (please, check readme.txt after downloading, thanks) 🙂
Please, read the full text for installation and customization instructions
To install:1. Just download (*click*) and unzip the files in your plug in directory (the files shoud be in wp-content/plugins/ (note: the files have to be in add-to-favourites subfolder there in order to display the images and JSs correctly.))
2. Go and activate the plug in
3. Place the following code where you want to see the links.
< ?php if (function_exists('add_to_favourites_text')): ?>
< ?php add_to_favourites_text(); ?>
< ?php endif; ?>
4. Go to Options -> Add to Favourets and set the options and texts that you want to be displayed, this should look something like this:
– The first field is the text that is going to be displayed for Add to Favourites link,
– the second one is the text for „set as home page“,
– the third one is a checkbox – if checked – the „set as home page“ will become available, if not – only „add to favourites“ will be displayed.
– The fourth – Alert text for „set as home page“ if your browser if FireFox or something else, that do not support dynamic change of home page.
– The fifth one is a checkbox – if checked – the „set as homepage“ is displayed only in the index page, if it is not checked – the „set as homepage“ link is displayed in every page.
– The sixt, and last one for this version ( yuup, 0.1 ) is for the visual style – if checked – there is a new line (BR) tag between „set as home page“ and „add to favourites“.
Quiet simple, but it is working perfectly for me 😉
I researched for something like this but didn’t find anything else that I can use, so i wrote my own 😉
That is my first WordPress plug in, hope you’ll find it useful 🙂
Here is the content of readme.txt file:
==== Add to Favourites ====
Tags: favourites, home page
Compatibility: WordPress 2.x, PHP4.3+
Version: 0.1
Contributors:
Plugin URI: http://www.ayanev.com/?p=
Add to Favourites is a plug in that puts customizable text for „add to favourties“ and „set as home page“ links.
===== FEATURES =====
The plugin has the following features:
* User can control the visual style of the links for adding pages in favourites(or bookmarks in FireFox)
* User can control whether to display or not the links
* A template tag (function) is exposed to include the links into templates.
* Plugint installs itself and is setting default option values, when activated.
===== INSTALLATION =====
Copy the files into your wp_content/plugins/add-to-favourites/ directory.
Activate the plugin from Plugins admin menu.
Once the plugin is activated it creates a „Add to Favourites“ panel under „Options“.
This will allow you to manage the texts and control plugin settings.
===== USAGE =====
This example will show the default „add to favourites“ and „set as home page“ links:
< ?php add_to_favourites_text(); ?>
Here is with checking for function to avoid errors:
< ?php if (function_exists('add_to_favourites_text')): ?>
< ?php add_to_favourites_text(); ?>
< ?php endif; ?>
Please, if you are using this plugin, write your URL here, so I will be able to track how are you using the plugin and create something better in the future version 🙂
Thanks
Плъгинът може да се подобри още малко, за да се избегнат празни линкове от типа \“#\“. Повече информация: http://alistapart.com/articles/behavioralseparation
Да, така е, не исках да ползвам различен от стандартния метод, но и така си работи без проблами 🙂
В следващата версия ще добавя и брояч на кликовете, или поне ще оправя anchor-ите да са от рода на… Да са реални линкове, след клик да релоадват към друга страница и после назад – по-лесно ще може да се интегрира така с останалите броячи за кликове 🙂
Има и вариант с popups, но нещо не ми харесва – много хора блокират popup-ите и няма да се получи коректно броене 🙂
Между другото, Ronson, използваш ли скрипта някъде? 🙂
За сега скрипта ти не го ползвам никъде 🙂
Това с релоадването и после връщането назад, сякаш не ми изглежда добра идея, визирайки ползваемостта на сайта. Няма ли начин брояча да го интегрираш директно в javascript-a?
Конкретно за този скрипт, ако трябва да заменяш празните линкове, то май вариантите са линкът да сочи към същата страница или да сочи към друга страница (в случай, че посетителя няма или си е изключил javascript), на която „прилежно“ да се обясни на посетителя, че трябва да си включи javascript, за да се възползва от скрипта 🙂
Малко AJAX и ще стане и без reload 😉
Но за AJAX версия ще ми трябва малко повече време от бруталния reload…
Ако някой иска да помогне – ще се радвам да развием това заедно 😉
Ronson, имаш ли други предложения – какво още може да интегрираме в плъгина ?
Тъй като от php не отбирам въобще, едва ли ще съм ти от някаква полза. Но за генерирания код мога да ти дам няколко предложения:
1. Многократното използване на class=“addtofavourites“ не е добра идея. Най-малкото излишно се „товари“ страницата;
2. Струва ми се добра идея да отделиш целия генериран код на скрипта в един отделен div;
3. Също така може би е добре линковете да са в неподреден списък (ul). Така можеш с css да разполагаш линковете хоризонтално или вертикално. И картинките ти ще са отделно в css-а.
Ronson, нарочно съм оставил тази свобода, за да може супер лесно да се модифицира кода, откъм \“товарене\“ мисля, че точно 30 букви в повече, е абсолютно пренебрежимо, тъй като това се равнява на някаква напълно малоумна и малка картинка 😉
Това, което съм направил там, е абсолютно не добра практика, но като за версия 0.1…
#a rel=\“nofollow\“ class=\“addtofavourites\“ xhref=\“http://www.ayanev.com/#\“ onclick=\“javascript:addBookmark();\“ ##img class=\“addtofavourites\“ alt=\“добави в любими сайтове\“ xsrc=\“http://www.ayanev.com/wp-content/plugins/add-to-favourites/atf.gif\“ /#добави в любими сайтове#
(# – нужните < или > 😉 )Това се среща на две места тук, в тази страница, което е с 24 символа повече в кода… 🙂
В следващите версии задължително ще се опитам да дооправя абсолютно всичко, но сега, ако трябваше и да вкарам още 1 клас (а той е абсолютно задължителен при наличието на UL), нещата щяха да се утежнят повече, ако съм оставил хората, ползващи плъгина, свободно да използват това, като за готов за работа след \“activate\“ по-лесно от оставяне на class= нямаше как 😉
Задължително ще пусна една малка версия съвсем скоро, като нещата ще са в един div с някакъв клас, а останалите линкове и картинки ще са наблъскани в него 😉
Благодаря ти за забележките, радвам се че помагаш 🙂
Great plugin! Thanks!
Pingback: жЏ’д»¶ » Blog Archive » Add to Favourites
Pingback: WordPress iГ§in tam 400 eklenti birsayfada! | PiyanoDegil.org :) Genciz, GГјzeliz.
Pingback: Wordpress 400 Eklenti « www.hakanersoy.org
Pingback: 150 Adet Word Press EklentisiД° TГјrkГ§e AГ§Д±klamalД± | Yozgat Haber PortalД±
Pingback: TГјrkГ§e 155 tane wordpress eklentisi - Bilgi Cehennemi
Pingback: TГјrkГ§e AГ§Д±klamalД± 150 Tane Wordpress Eklentisi - NetMola.Net
Не е лош плъгина 🙂
Pingback: TГјrkГ§e 155 tane wordpress eklentisi 2010 | MyGГјncel.com
Pingback: Türkçe 155 tane wordpress eklentisi | HabernEXt.com
Pingback: En iyi WordPress eklentileri | bilginette
I’ve been using this plugin for years and it’s continued to work perfectly with all versions of wordpress. Thanks, Atanas!
Cheers, Jo! 🙂
Плъгина си го бива. Ще го пробвам и ще споделя след това какво мисля.
Pingback: Mijn 27 wordpress plugins