Add post custom field

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

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

Image

Thanks.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

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: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Thank you, Diego!

So simple... Never thought of the possibilities of arrays. :oops:
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

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: 38
Joined: Mon Feb 22, 2016 8:06 am
Location: USA
Contact:

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

How to do this for version 3.0?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

dbpost.class.php is in Bludit v3.0.0 pages.class.php.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply