Add text to the show parameter category.
17 Apr 2007 - Written by Anthony Olsen
Posted in Resources
Generally if you choose to show the category name under the content that's what it does - but in the april Bamboo Loaded Blog package I wanted to add some text to the category name listed under each article in the same way that you can see it on some other blogging platforms like wordpress etc. So I realised that its actually pretty easy to insert some text such as "posted in" or "filed in" before the category name.
Here is how to do it:
Open content.html.php in a text editor (you can find this file in components/com_content/) and look for the following text:
/**
* Writes Category
*/
function Category( &$row, &$params ) {
if ( $params->get( 'category' ) ) {
?>
<?php echo $row->category;
?>
<?php
}
}
The bit that you need to edit is after the tag. So just insert the words/phrase you want to use like so:
/**
* Writes Category
*/
function Category( &$row, &$params ) {
if ( $params->get( 'category' ) ) {
?>
Posted in
<?php
echo $row->category;
?>
<?php
}
}
If you wanted to get really funky you could add text to the written by statement that follows directly afterwards.
/**
* Writes Author name
*/
function Author( &$row, &$params ) {
if ( ( $params->get( 'author' ) ) && ( $row->author != '' ) ) {
?>
<?php
}
}
Just add some text before the <?php echo_WRITTEN_BY. statement and then delete that text like so:
/**
* Writes Author name
*/
function Author( &$row, &$params ) {
if ( ( $params->get( 'author' ) ) && ( $row->author != '' ) ) {
?>
<?php
}
}
And if you wanted to funk it up alot more you could add some text prior to the date like so:
/**
* Writes Create Date
*/
function CreateDate( &$row, &$params ) {
$create_date = null;
if ( intval( $row->created ) != 0 ) {
$create_date = mosFormatDate( $row->created );
}
if ( $params->get( 'createdate' ) ) {
?>
<?php
}
}
Its not groundbreaking or rocket science ... but I think its the little things on your site that make all the difference. Here is a snapshot of what those changes would actually look like.
blog comments powered by Disqus