Add post custom field

Post Reply
mahmut
Ssr. Bludit
Posts: 28
Joined: Fri Feb 12, 2016 2:27 pm

Thu May 12, 2016 10:19 am

Hi,
I want to add a new field to the content?

Image

Thanks.
User avatar
Edi
Site Admin
Posts: 1279
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Fri May 13, 2016 1:53 pm

Sorry, at the moment custom fields are not part of the core of Bludit. You can try to write a plugin. ;-)
Last edited by Edi on Tue May 31, 2016 12:06 am, edited 1 time in total.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
diego
Site Admin
Posts: 695
Joined: Sat May 16, 2015 2:53 pm
Contact:

Mon May 30, 2016 4:48 am

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.
User avatar
Edi
Site Admin
Posts: 1279
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Tue May 31, 2016 12:07 am

Thank you, Diego!

So simple... Never thought of the possibilities of arrays. :oops:
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
diego
Site Admin
Posts: 695
Joined: Sat May 16, 2015 2:53 pm
Contact:

Wed Jun 01, 2016 1:17 am

Edi wrote:Thank you, Diego!

So simple... Never thought of the possibilities of arrays. :oops:
I need document this kind of thing :roll:
User avatar
jmonroe
Sr. Bludit
Posts: 35
Joined: Mon Feb 22, 2016 8:06 am
Location: USA
Contact:

Fri Jun 03, 2016 3:18 am

Very, very good information. Diego...You should document this kind of thing ;-)
Jeremy Monroe
Kreativmind Show Support for Bludit via Patreon
msdoc11
Jr. Bludit
Posts: 1
Joined: Sat Sep 15, 2018 6:50 pm

Sat Sep 15, 2018 6:53 pm

How to do this for version 3.0?
User avatar
Edi
Site Admin
Posts: 1279
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Sat Sep 15, 2018 7:09 pm

dbpost.class.php is in Bludit v3.0.0 pages.class.php.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
Post Reply