Page 1 of 1

Add post custom field

Posted: Thu May 12, 2016 10:19 am
by mahmut
Hi,
I want to add a new field to the content?

Image

Thanks.

Re: Add post custom field

Posted: Fri May 13, 2016 1:53 pm
by Edi
Sorry, at the moment custom fields are not part of the core of Bludit. You can try to write a plugin. ;-)

Re: Add post custom field

Posted: Mon May 30, 2016 4:48 am
by diego
Hi,
you can add the field.

For example I added the field, source

edit bl-kernel/dbpost.class.php and add the field source

Code: Select all

private $dbFields = array(
	'title'=>			array('inFile'=>true,	'value'=>''),
	'content'=>		array('inFile'=>true,	'value'=>''),
	'description'=>		array('inFile'=>false,	'value'=>''),
	'username'=>		array('inFile'=>false,	'value'=>''),
	'status'=>			array('inFile'=>false,	'value'=>'draft'),
	'tags'=>			array('inFile'=>false,	'value'=>array()),
	'allowComments'=>	array('inFile'=>false,	'value'=>0),
	'date'=>			array('inFile'=>false,	'value'=>''),
	'dateModified'=>	array('inFile'=>false,	'value'=>''),
	'coverImage'=>		array('inFile'=>false,	'value'=>''),
	'source'=>			array('inFile'=>false,	'value'=>'')
);
edit bl-kernel/admin/view/new-post.php and add

Code: Select all

HTML::formInputText(array(
	'name'=>'source',
	'value'=>'',
	'class'=>'uk-width-1-1 uk-form-large',
	'placeholder'=>'Source link'
));
The name of the input text, need to be the same as the name of field.

Re: Add post custom field

Posted: Tue May 31, 2016 12:07 am
by Edi
Thank you, Diego!

So simple... Never thought of the possibilities of arrays. :oops:

Re: Add post custom field

Posted: Wed Jun 01, 2016 1:17 am
by diego
Edi wrote:Thank you, Diego!

So simple... Never thought of the possibilities of arrays. :oops:
I need document this kind of thing :roll:

Re: Add post custom field

Posted: Fri Jun 03, 2016 3:18 am
by jmonroe
Very, very good information. Diego...You should document this kind of thing ;-)

Re: Add post custom field

Posted: Sat Sep 15, 2018 6:53 pm
by msdoc11
How to do this for version 3.0?

Re: Add post custom field

Posted: Sat Sep 15, 2018 7:09 pm
by Edi
dbpost.class.php is in Bludit v3.0.0 pages.class.php.