Adding custom columns/fields to Joomla article

Today we will learn how to add more columns/fields to Joomla *_content table. At first we should have to add a column in *_content table.
Run in for instance phpMyAdmin.
ALTER TABLE `jos_content` ADD `test` VARCHAR( 255 ) NOT NULL

Edit administrator/components/com_content/models/article.xml add:

In the first params section for instance below the access entry. Add var $test = null; to libraries/joomla/database/table/content.php
Now add $form->set('test', $row->test); to editContent() in administrator/components/com_content/controller.php
The result is that you now have a new field called test that can be used in various ways to display a separate text that is not a part of the article.


36 thoughts on “Adding custom columns/fields to Joomla article

  1. Hi,

    Thanks for your post on Adding custom columns/fields to Joomla article.

    I am building a website with Joomla and have beed trying to look for a tool that would allow me to add custom fields
    into articles…after looking at various tools I was also thinking of manually adding the field in jos_content … but did not proceed … cause i was concerned whether i would be affecting the other operations in joomla. But since i have seen your post .. i am more convinced to try it out …

    Your instructions :
    1. “Edit administrator/components/com_content/models/article.xml add:” ( not sure what to add here in article.xml, can you please explain further…)

    2. Also would you know whether modifying the *_content table would cause any issues in the other operations of Joomla?

    Also it would be a great learning experience if you could tell me why we have to do each of the steps after manually creating the fields … or maybe you can forward a link to some documentation …

    Thank you very much.

  2. hey rana.

    the ppt file helped a lot.
    i was able to follow it and add the custom field to myu articles in admin without issue.
    so thanks; nice work.

    but now i am struggling to use it in my template…
    specifically, i want to draw that value in “test” out to the category page that lists articles on my site.

    i can modify the html, but am unsure of how to pass the new variable so that i can use it in the template. any help greatly appreciated.

    thanks again.

  3. Hi there,
    Very smart post! Thank you very much for the effort.
    I followed step by step what you write in the ppt but I still have an issue when I save my article, it says :

    Unknown column ‘test’ in ‘field list’ SQL=UPDATE `jos_content` SET `title`=’Arbres et résultats template’,`test`=’xcd’,`alias`= …

    Note : I create the coumn ‘test’ through phpmyadmin.

    Thank you in advance for your response,
    Have a good day.

  4. Hi,

    Nice post, worked just fine.
    I just wondered how I can make use of this field in my frontend template? How can I show the value somewhere?

    Thanks in advance!

  5. This is what I am looking for! thanks! MAN

    1 thing, I added a custom filed, called “release date”, I wanna it to be displayed on frontpage to replace the “created date”

    but seems the new field can not be added to front page.

  6. Thanks a lot for your help. Its really works for me. But one thing is still not clear how I will display this custom field in the frontend.
    please help me in this regd.
    Thank you agian…..

  7. Adding custom columns to the category list layout

    The category list layout now is able to show in the heading the title, date, author and hits. I would like to add a column displaying the content of a custom field I added to my articles, for example ISBN number and the price of a book I wrote an article on.

    So I’m able to add custom fields to an article, but I would like these fields to show up in a new column in the category list layout.

    Any suggestions on how to do this?

    • Hi Dewa,
      Just edit bellow files and change commented (bold) lines. Here i take isbn as a extra field for jom_content table.

      function _buildQuery($state = 1)
      global $mainframe;
      // Get the page/component configuration
      $params = &$mainframe->getParams();

      // If voting is turned on, get voting data as well for the content items
      $voting = ContentHelperQuery::buildVotingQuery($params);

      // Get the WHERE and ORDER BY clauses for the query
      $where = $this->_buildContentWhere($state);
      $orderby = $this->_buildContentOrderBy($state);

      $query = 'SELECT cc.title AS category,, a.title, a.alias, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' .
      ' a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, a.attribs, a.hits, a.images, a.urls, a.ordering, a.metakey, a.metadesc, a.access,a.isbn,' .
      ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":",, a.alias) ELSE END as slug,'.
      ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":",, cc.alias) ELSE END as catslug,'.
      ' CHAR_LENGTH( a.`fulltext` ) AS readmore, AS author, u.usertype, AS groups, as author_email'.$voting['select'] .
      ' FROM #__content AS a' .
      ' LEFT JOIN #__categories AS cc ON a.catid =' .
      ' LEFT JOIN #__users AS u ON = a.created_by' .
      ' LEFT JOIN #__groups AS g ON a.access ='.

      return $query;

      <td align="center" class="sectiontableheaderescape($this->params->get('pageclass_sfx')); ?>" width="5%" nowrap="nowrap">
      lists['order_Dir'], $this->lists['order'] ); ?>

      <td align="center" class="sectiontableheaderescape($this->params->get('pageclass_sfx')); ?>" nowrap="nowrap">


      escape($item->hits) ? $this->escape($item->hits) : '-'; ?>

      escape($item->isbn); ?>

      Please dont forget change colspan value.

      If any query just ask me. Best of luck.


  8. Hi

    Thank you for the post.

    My new field is already in the Backend – and I can add what value I want , however when I publish the article , I have a problem.

    I can see the new field in the article view , however I am not able to see it in Category Blog view – where usually I have the articles with “read more”. I cannot see the field there.

    Any tips please??

    What I did is :
    go to:


    Scroll to about line 361 and add new fields at the following code:

    $query = ‘SELECT cc.title AS category,, a.title, ……..

    But no results – still cannot see it there.

    Help 🙂

    • Hi
      Have you modify components\com_content\views\category\tmpl\default_items.php file? You should have change this file also if you want to see your newly added field in your category list layout. I have explain details in my previous comment. If you need remote support let me know.


  9. Hi Rana,

    It looks like there is a missing line in your article above:

    “Edit administrator/components/com_content/models/article.xml add:

    ?????? <—– nothing shows here!

    In the first params section for instance below the access entry."

    can you write what is supposed to go in the ??? space for the article.xml document?

    thanks for your cool blog,


  10. Pingback: 2010 in review « The Dreamer!

  11. i added extra field

    its showing on article manger – admin view

    but not showing user view of article

    thanks for your help

  12. Hi,

    Nice post, I’m working with j1.5.22 and on the backend your customization worked fine.
    Wondering how can I show now my new fields on the frontend side. Which php files should be changed to show fields in the article page?

    Thanks in advance!

    • Hello

      Few days ago i have discussed about this, please check (December 14, 2010 at 1:37 PM) Reply. If any further query let me know.


  13. Hi Saidur,

    How would you add the custom fields in Joomla 1.6? Your explanation of how to do it for 1.5 was pretty easy but since file structure is different in 1.6 i could figure it out. Thanks

  14. Hi there great post

    But I was wondering does this works for Joomla 1.6?

    I am trying this titorial but without any results since some files are just not there in Joomla 1.6….

    I would love to add a custom filed like this in Joomla 1.6

    Hope you can help….

  15. Hi,
    I dont know if some of you have this problem, but my joomla site is so slow when saving an article. i read in internet that maybe is mysql configuration, i had cahnged query_cache size with 64m and key_buffer with 128mb, my server is pentium 4 2.8ghz and 1gb of ram, and still being same thing. so slow, several minutes to save an article.
    At somewhere i read that maybe hiding some fields from the listed articles in article manager, could reduce the queries joomla does to show articles after saving or aplying. could you please help me telling me how to hide or delete some fields from showing, like frontend, access and ID? maybe could help me to accelerate the saving time of articles. thanks in dvance!

    p.d. i have 13500 articles

  16. Hi Saidur,

    Please update the ppt for joomla 1.6. it would be of gr8 help to joomla 1.6 users.

    Thanks in advance.

    -Dhananjaya Kumar

  17. Hi saidur,

    Great article, helped me very much. Much appreciable if the PPT is posted for Joomal 1.6.

    Thanks in advance,
    Dhananjaya Kumar T.R

  18. Hi There,

    Thanks heaps for the nice and clear info. Im on Joomla 2.5 and could you please post instructions to do it on 2.5? Thanks heaps

  19. Oh my goodness! Amazing article dude! Thank you, However I
    am encountering problems with your RSS. I don’t understand why I can’t subscribe to it. Is there anyone else having similar RSS issues? Anyone who knows the solution can you kindly respond? Thanx!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s