Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pages/docs/DatabaseORM/seeding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ return new class extends Seeder {
VALUES
(1,'','Mauritania','MR','Mauritanian Ouguiya','','','MRO',0.00,'africa','publish')");
}
}
};
```

## WordPress prefix
Expand Down Expand Up @@ -130,7 +130,7 @@ return new class extends Seeder {
VALUES
(1,'','Mauritania','MR','Mauritanian Ouguiya','','','MRO',0.00,'africa','publish')");
}
}
};
```

In this case the table name will be `my_plugin_products`.
Expand Down Expand Up @@ -169,7 +169,7 @@ return new class extends Seeder {
]
);
}
}
};
```
### Remove the WordPress prefix

Expand Down Expand Up @@ -208,7 +208,7 @@ return new class extends Seeder {
]
);
}
}
};
```

In the Model class, you have to set to false the second parameter of the `DB::getTableName` method.
Expand Down
25 changes: 25 additions & 0 deletions pages/docs/ServicesProvider/custom-post-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ class MyCustomPostType extends WordPressCustomPostTypeServiceProvider {
*/
protected $plural = 'Starships';

/**
* Whether to include the post type in the REST API.
* Set this to true for the post type to be available in the block editor.
*
* @var bool
*/
protected $showInRest = true;

/**
* Whether to generate a default UI for managing this post type in the admin.
* If not set, the default is inherited from public.
*
* @var bool
*/
protected $showUI = true;

/**
* An alias for calling add_post_type_support() directly. Defaults to title and editor.
* See {@link add_post_type_support()} for documentation.
*
* @var array
*/
protected $supports = ['title', 'editor', 'thumbnail', 'excerpt']; // etc..


/**
* You may override this method in order to register your own actions and filters.
*
Expand Down
24 changes: 24 additions & 0 deletions pages/docs/ServicesProvider/custom-taxonomy-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,27 @@ Add this new Service Provider to the list of providers in the `/config/plugin.ph

'custom_taxonomy_types' => [ '\WPKirk\CustomTaxonomyTypes\MyCustomTaxonomy' ],
```

## Columns
You may add columns to your Custom Taxonomy Type by adding the following code to your Service Provider:
```php filename="plugin/CustomTaxonomyTypes/MyCustomTaxonomy.php" copy
public function registerColumns()
{
return [
'my_new_column_name' => 'Column Name',
];
}
```

and also set the Column Content (where you can process the output), is *mandatory* to use `return` and not an `echo` statement

```php filename="plugin/CustomTaxonomyTypes/MyCustomTaxonomy.php" copy
public function columnContent($string, $column_name, $term_id)
{
if ($column_name === 'my_new_column_name') {
//... your logic here
return 'your_new_content_here';
}
return $string;
}
```