Add 'web/app/themes/badegg/' from commit 'b31aa7550b02a4516fdf161f53dc7666854c9a14'
git-subtree-dir: web/app/themes/badegg git-subtree-mainline:b862ff9755git-subtree-split:b31aa7550b
This commit is contained in:
135
web/app/themes/badegg/app/Admin/Blocks.php
Normal file
135
web/app/themes/badegg/app/Admin/Blocks.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin;
|
||||
|
||||
class Blocks
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_action('allowed_block_types_all', [$this, 'blacklist'], 100, 2);
|
||||
}
|
||||
|
||||
public function blacklist()
|
||||
{
|
||||
// Reference:
|
||||
// https://www.wpexplorer.com/how-to-remove-gutenberg-blocks/
|
||||
// https://www.wpexplorer.com/wordpress-core-blocks-list/
|
||||
|
||||
// Existing blocks with Blade templates
|
||||
// https://roots.io/acorn/docs/rendering-blade-views/#existing-blocks-with-blade-templates
|
||||
|
||||
$blocks = array_keys( \WP_Block_Type_Registry::get_instance()->get_all_registered() );
|
||||
|
||||
$blacklist = [
|
||||
// Design
|
||||
'core/button',
|
||||
'core/comment-template',
|
||||
'core/home-link',
|
||||
'core/navigation-link',
|
||||
'core/navigation-submenu',
|
||||
'core/buttons',
|
||||
'core/column',
|
||||
'core/columns',
|
||||
'core/group',
|
||||
'core/more',
|
||||
'core/nextpage',
|
||||
'core/separator',
|
||||
'core/spacer',
|
||||
'core/text-columns',
|
||||
|
||||
// Embed
|
||||
'core/embed',
|
||||
|
||||
// Media
|
||||
'core/cover',
|
||||
'core/file',
|
||||
'core/gallery',
|
||||
'core/image',
|
||||
'core/media-text',
|
||||
'core/audio',
|
||||
'core/video',
|
||||
|
||||
// Reusable
|
||||
'core/block',
|
||||
|
||||
// Text
|
||||
'core/footnotes',
|
||||
'core/heading',
|
||||
'core/list',
|
||||
'core/code',
|
||||
'core/details',
|
||||
'core/freeform',
|
||||
'core/list-item',
|
||||
'core/missing',
|
||||
'core/paragraph',
|
||||
'core/preformatted',
|
||||
'core/pullquote',
|
||||
'core/quote',
|
||||
'core/table',
|
||||
'core/verse',
|
||||
|
||||
// Theme
|
||||
'core/avatar',
|
||||
'core/comment-author-name',
|
||||
'core/comment-content',
|
||||
'core/comment-date',
|
||||
'core/comment-edit-link',
|
||||
'core/comment-reply-link',
|
||||
'core/comments',
|
||||
'core/comments-pagination',
|
||||
'core/comments-pagination-next',
|
||||
'core/comments-pagination-numbers',
|
||||
'core/comments-pagination-previous',
|
||||
'core/comments-title',
|
||||
'core/loginout',
|
||||
'core/navigation',
|
||||
'core/pattern',
|
||||
'core/post-author',
|
||||
'core/post-author-biography',
|
||||
'core/post-author-name',
|
||||
'core/post-comments-form',
|
||||
'core/post-content',
|
||||
'core/post-date',
|
||||
'core/post-excerpt',
|
||||
'core/post-featured-image',
|
||||
'core/post-navigation-link',
|
||||
'core/post-template',
|
||||
'core/post-terms',
|
||||
'core/post-title',
|
||||
'core/query',
|
||||
'core/query-no-results',
|
||||
'core/query-pagination',
|
||||
'core/query-pagination-next',
|
||||
'core/query-pagination-numbers',
|
||||
'core/query-pagination-previous',
|
||||
'core/query-title',
|
||||
'core/read-more',
|
||||
'core/site-logo',
|
||||
'core/site-tagline',
|
||||
'core/site-title',
|
||||
'core/template-part',
|
||||
'core/term-description',
|
||||
'core/post-comments',
|
||||
|
||||
// Widgets
|
||||
'core/legacy-widget',
|
||||
'core/widget-group',
|
||||
'core/archives',
|
||||
'core/calendar',
|
||||
'core/categories',
|
||||
'core/latest-comments',
|
||||
'core/latest-posts',
|
||||
'core/page-list',
|
||||
'core/page-list-item',
|
||||
'core/rss',
|
||||
'core/search',
|
||||
'core/shortcode',
|
||||
'core/social-link',
|
||||
'core/tag-cloud',
|
||||
'core/html',
|
||||
'core/social-links',
|
||||
];
|
||||
|
||||
return array_values( array_diff( $blocks, $blacklist ) );
|
||||
}
|
||||
}
|
||||
67
web/app/themes/badegg/app/Admin/Comments.php
Normal file
67
web/app/themes/badegg/app/Admin/Comments.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin;
|
||||
|
||||
class Comments
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_action('admin_init', [$this, 'commentstatusdiv']); // Disable comment status div meta box
|
||||
add_action('wp_dashboard_setup', [$this, 'dashboard_activity']); // Remove the Activity widget
|
||||
add_action('wp_before_admin_bar_render', [$this, 'remove_menu_item']); // Remove from admin bar
|
||||
add_action('admin_menu', [$this, 'admin_menu']); // Remove from backend menu
|
||||
add_action('wp_dashboard_setup', [$this, 'dashboard_recent_comments']); // Remove Dashboard Meta Box
|
||||
add_filter('comments_rewrite_rules', '__return_empty_array'); // Remove comment rewrite rule
|
||||
add_action('after_theme_setup', [$this, 'theme_support']); // Remove comment theme support
|
||||
add_filter('rewrite_rules_array', [$this, 'rewrite']); // Clean up rewrite rule
|
||||
}
|
||||
|
||||
public function commentstatusdiv()
|
||||
{
|
||||
remove_meta_box( 'commentstatusdiv', 'post', 'normal' );
|
||||
remove_post_type_support( 'post', 'comments' );
|
||||
|
||||
remove_meta_box( 'commentstatusdiv', 'page', 'normal' );
|
||||
remove_post_type_support( 'page', 'comments' );
|
||||
}
|
||||
|
||||
public function dashboard_activity()
|
||||
{
|
||||
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
|
||||
}
|
||||
|
||||
public function remove_menu_item()
|
||||
{
|
||||
global $wp_admin_bar;
|
||||
$wp_admin_bar->remove_menu('comments');
|
||||
}
|
||||
|
||||
public function admin_menu()
|
||||
{
|
||||
remove_menu_page( 'edit-comments.php' );
|
||||
remove_submenu_page( 'options-general.php', 'options-discussion.php' );
|
||||
}
|
||||
|
||||
public function dashboard_recent_comments()
|
||||
{
|
||||
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
|
||||
}
|
||||
|
||||
public function theme_support()
|
||||
{
|
||||
remove_theme_support('comments');
|
||||
}
|
||||
|
||||
public function rewrite($rules)
|
||||
{
|
||||
foreach ($rules as $rule => $rewrite) {
|
||||
if (preg_match('/.*(feed)/', $rule)) {
|
||||
unset($rules[$rule]);
|
||||
}
|
||||
if (preg_match('/.*(comment-page)/', $rule)) {
|
||||
unset($rules[$rule]);
|
||||
}
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
27
web/app/themes/badegg/app/Admin/DisablePost.php
Normal file
27
web/app/themes/badegg/app/Admin/DisablePost.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin;
|
||||
|
||||
class DisablePost
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_filter('register_post_type_args', [$this, 'args'], 0, 2);
|
||||
add_filter('register_taxonomy_args', [$this, 'args'], 0, 2);
|
||||
}
|
||||
|
||||
public function args($args, $type)
|
||||
{
|
||||
$types = [
|
||||
'post',
|
||||
'post_tag',
|
||||
'category',
|
||||
];
|
||||
|
||||
if(in_array($type, $types)) {
|
||||
$args['public'] = false;
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
22
web/app/themes/badegg/app/Admin/Enqueue.php
Normal file
22
web/app/themes/badegg/app/Admin/Enqueue.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin;
|
||||
|
||||
class Enqueue
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_action( 'admin_enqueue_scripts', [$this, 'fontawesome']);
|
||||
}
|
||||
|
||||
public function fontawesome()
|
||||
{
|
||||
wp_enqueue_style(
|
||||
'fontawesome',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css',
|
||||
false,
|
||||
'6.5.2',
|
||||
'all'
|
||||
);
|
||||
}
|
||||
}
|
||||
24
web/app/themes/badegg/app/Admin/Integrations.php
Normal file
24
web/app/themes/badegg/app/Admin/Integrations.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin;
|
||||
|
||||
class Integrations
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_action( 'wp_head', [$this, 'FathomAnalytics']);
|
||||
}
|
||||
|
||||
public function FathomAnalytics()
|
||||
{
|
||||
$fathomID = get_field('badegg_integrations_fathom_id', 'option');
|
||||
|
||||
if($fathomID && WP_ENV == 'production'): ?>
|
||||
|
||||
<!-- Fathom - beautiful, simple website analytics -->
|
||||
<script src="https://cdn.usefathom.com/script.js" data-site="<?= $fathomID ?>" defer></script>
|
||||
<!-- / Fathom -->
|
||||
|
||||
<?php endif;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user