This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums
You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}
| « OMG we almost have a new plugin! | Widgets » |
Posted on 1st Aug 2007 in : Plugins & Widgets
We've had this plugin lying around for so long that we've already updated it twice and still haven't managed to do a public release ...... oooops
Anyway welcome to the AstonishMe Custom Plugin, this plugin allows you to add all sorts of custom stuff directly from your posts giving you far more control over your blog than ever.
Whilst b2evolution is a great little blogging platform, it does have a few drawbacks, one of which is the static keywords and descriptions for each blog. As you probably know, the evil google bot prefers to see keywords and description that are relevant to the content on the page at any given moment. Now you can have custom keywords and description on a per post basis, you can also control the title and even add more meta tags if you want. The title & description of the post are used when you're in single post mode ( it defaults to the stock ones if you don't have one for a post ). The keywords are used whenever the post is being viewed archives/categories/front page etc, only the unique ones are shown so you shouldn't get any duplicates.
Apparently some people like to make their posts look like a tarts boudoir which, up until now, has meant that you either needed a huuuuuuuuuuuuuuge stylesheet or *shudder* you had to restrict yourself to just a few boring styles!! Now you have the ability to add post specific baubles to your blog with no fear of excessive bloat. To make things easier you can target each post specifically simply by using %post% in your class/id names. This will be replaced by am_custom_post_##_ so you can avoid conflicting classnames.
If you happen to be one of those people who are forever adding all sorts of javascript gimmicks so that you can amaze your visitor with some stunning new effect, assuming they have javascript enabled of course, then you're probably going to want to meander through the plugins code and change a 0 to a 1
. This will then allow you to either add your script in <head> or directly inside the post at the spot you type it. Fair warning though, enabling this option will allow any user with posting rights to post javascript, so be think before you enable it huh?
I suppose it's time to tell you how to use all these new found powers huh? First off all you need to do all the usual stuff like, download the plugin, unzip it, upload it, wander into admin and install it. Unlike most of our plugins, this one also involves you ripping a couple of bits out of your skins _main.php. Don't worry though, it's fairly painless and the worst you could do is melt down your server if you delete the wrong bit huh? So, now that you're reassured, crack open your skins _main.php and delete the red bits ![]()
PHP:
<span style="color:red"><title><?php </span> | |
<span style="color:red">$Blog->disp('name', 'htmlhead'); </span> | |
<span style="color:red">request_title( ' - ', '', ' - ', 'htmlhead' ); </span> | |
<span style="color:red">?></title> </span> | |
<base href="<?php skinbase(); /* Base URL for this skin. You need this to fix relative links! */ ?>" /> | |
<span style="color:red"> <meta name="description" content="<?php $Blog->disp( 'shortdesc', 'htmlattr' );?>" /> </span> | |
<span style="color:red"><meta name="keywords" content="<?php $Blog->disp( 'keywords', 'htmlattr' );?>" /> </span> |
From now on, whenever you make a post you have the ability to customise it in all the ways mentioned above by using the following tags. For css and javascript %post% will be replaced with .am_custom_post_##_. For those of you who have been using this plugin for a bit, don't worry, all old style tags still work as well ![]()
Html:
<!--title title to use --> | |
The title to use will be used as the pages html title in single post mode. | |
<!--description post description --> | |
The post description will be used as the pages description in single post mode | |
<!--keywords keywords to add --> | |
The keywords to add will be appended to the pages keywords. The plugin also ensures that there are no duplicate keywords | |
<!--meta meta tag data --> | |
This will add a meta tag <meta meta tag data /> | |
<!--css custom css for post --> | |
The custom css for post will be output between <style> tags | |
<!--script javascript to add --> | |
The javascript to add will be output inside <head> between <script> tags | |
<!--js javascript to add --> | |
The javascript to add will be output inside your post between <script> tags | |
WARNING : This will allow any user with posting rights to post javascript, it's disabled by default. To enable javascript you need to manually change the setting in the plugin code. |
So, now you can decorate your posts to your hearts content, let me know if you have any problems huh?
¥
<!-- stuff here -->
<description> ... </description>
<div class="bText">
<!--title Custom titles rock -->
<!--description This description was brought to you courtesy of the AstonishMe custom plugin -->
<!--keywords b2evolution, plugin, custom css, seo, keywords, description -->
PHP:
echo '<title>'; | |
if( $this->title ) | |
{ | |
echo format_to_output( $this->title, 'htmlhead' ); | |
} else { | |
if( $disp == 'single' ) | |
{ | |
request_title( ' - ', '', ' - ', 'htmlhead' ); | |
} | |
else | |
{ | |
$Blog->disp('name', 'htmlhead'); | |
} | |
| |
} | |
echo '</title>'."\n"; |
PHP:
echo '<title>'; | |
if( $this->title ) | |
{ | |
echo format_to_output( $this->title, 'htmlhead' ); | |
} else { | |
request_title( array( | |
'auto_pilot' => 'seo_title', | |
) ); | |
} | |
echo '</title>'."\n"; |
PHP ( /skins/your-skin/_html_head.inc.php ) :
<head> | |
<?php skin_content_meta(); /* Charset for static pages */ ?> | |
<?php $Plugins->trigger_event( 'SkinBeginHtmlHead' ); | |
add_headline( '<link rel="stylesheet" href="/skins/tacky3/blogrum.css" type="text/css" />' ); | |
/* ?> | |
<title><?php | |
// ------------------------- TITLE FOR THE CURRENT REQUEST ------------------------- | |
request_title( array( | |
'auto_pilot' => 'seo_title', | |
) ); | |
// ------------------------------ END OF REQUEST TITLE ----------------------------- | |
?></title> | |
*/ | |
?> | |
<meta name="description" content="<?php $Blog->disp( 'shortdesc', 'htmlattr' ); ?>" /> | |
<meta name="keywords" content="<?php $Blog->disp( 'keywords', 'htmlattr' ); ?>" /> | |
<?php robots_tag(); ?> |
PHP:
echo '<title>'; | |
if( $this->title ) | |
echo format_to_output( $this->title, 'htmlhead' ); | |
else | |
request_title( array( 'auto_pilot' => 'seo_title' ) ); | |
echo '</title>'; |
PHP:
if( false && $this->title ) |
PHP ( _am_custom.plugin.php ) :
$this->keywords = implode( ',', array_slice( array_unique( $this->keywords ), 0, 100 ) ); // lets avoid duplicate keywords |
Page archived : 26th Feb 2010