Created
March 20, 2017 18:17
-
-
Save amostajo/53aa1c5ffa00063cf65bded85ee9b80f to your computer and use it in GitHub Desktop.
Post Gallery - Default settings by code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The class settings is located at PostGallery\Models\PostGallery | |
// There are 2 ways of calling and using this class. | |
// - 1 - Using use statement | |
use PostGallery\Models\PostGallery; | |
$settings = PostGallery::find(); | |
// - 2 - Without use statement | |
$settings = PostGallery\Models\PostGallery::find(); | |
//----------------------------------------- | |
// Then you can read/write the settings by code | |
$settings->can_enqueue = 0; | |
$settings->types = ['custom-post-type','post']; | |
$settings->metabox_context = 'advanced'; | |
$settings->metabox_priority = 'default'; | |
// Then save the settings by code | |
$settings->save(); | |
// Settings are cached, so you will need to clear cached settings | |
// Once cleared, settings will be refreshed | |
$settings->clear(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment