-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new options to show authors and categories (#186)
* refactor: simplify class names with namespaces * feat: new options for bylines, categories, and underwriter style/placement * feat: move override logic to plugin theme helpers * fix: properly restrict adding/deleting of sponsor terms * refactor: combine sponsor override settings with sponsors taxonomy panel * chore: update help description for sponsor URL setting * refactor: update name of localized variable, to avoid confusion * fix: negative override
- Loading branch information
Showing
6 changed files
with
404 additions
and
114 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,40 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { addFilter } from '@wordpress/hooks'; | ||
import { registerPlugin } from '@wordpress/plugins'; | ||
import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { Sidebar } from './sidebar'; | ||
import { TaxonomyPanel } from './taxonomy-panel'; | ||
|
||
const { post_type: postType, cpt } = window.newspack_sponsors_data; | ||
|
||
/** | ||
* Filter the PostTaxonomies component. | ||
*/ | ||
addFilter( 'editor.PostTaxonomyType', 'newspack-sponsors-editor', TaxonomyPanel ); | ||
|
||
/** | ||
* Register plugin editor settings. | ||
* For sponsor posts, this is a separate sidebar panel. | ||
* For all other post types, it is pre-pended to the Sponsors sidebar panel. | ||
*/ | ||
registerPlugin( 'newspack-sponsors-editor', { | ||
render: Sidebar, | ||
icon: null, | ||
} ); | ||
if ( cpt === postType ) { | ||
registerPlugin( 'newspack-sponsors-editor', { | ||
render: () => ( | ||
<PluginDocumentSettingPanel | ||
className="newspack-sponsors" | ||
name="newspack-sponsors" | ||
title={ __( 'Sponsor Settings', 'newspack-sponsors' ) } | ||
> | ||
<Sidebar /> | ||
</PluginDocumentSettingPanel> | ||
), | ||
icon: null, | ||
} ); | ||
} |
Oops, something went wrong.