PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.0
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.0
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Classes / hooks.php

hooks.php in Adminify – White Label, Admin Menu Editor, Login Customizer 2.0.0, at Inc/Classes/hooks.php

100 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Classes;
4
5 // no direct access allowed
6 if (!defined('ABSPATH')) exit;
7 /**
8 * WPAdminify
9 *
10 * @author Jewel Theme <support@jeweltheme.com>
11 */
12 class Hooks
13 {
14 public function __construct()
15 {
16 // https://wordpress.stackexchange.com/questions/25034/how-to-remove-screen-options-and-help-links-in-the-admin-area
17 // https://wordpress.stackexchange.com/questions/73561/how-to-remove-all-widgets-from-dashboard
18 // Hide Screen Options and Contextual Help
19
20 // Add Featured Image or Post Thumbnail to RSS Feed
21 add_filter('the_excerpt_rss', [$this, 'jltwp_adminify_rss_post_thumbnail']);
22 add_filter('the_content_feed', [$this, 'jltwp_adminify_rss_post_thumbnail']);
23
24 //Add Categories to WordPress Pages, add tag and category support to pages
25 add_action('init', [$this, 'jltwp_adminify_tags_categories_support_all']);
26 add_action('pre_get_posts', [$this, 'jltwp_adminify_tags_categories_support_query']);
27
28 // Remove WordPress Version Number
29 add_filter('the_generator', [$this, 'jltwp_adminify_remove_version']);
30
31 //Remove Default Image Links in WordPress
32 add_action('admin_init', [$this, 'jltwp_adminify_imagelink_setup'], 10);
33
34
35
36 // WP Adminify Custom Tweaks
37 add_filter('manage_posts_columns', [$this, 'jltwp_adminify_columns_attachments'], 1);
38 add_action('manage_posts_custom_column', [$this, 'jltwp_adminify_custom_columns_attachments'], 1, 2);
39 }
40
41
42 function jltwp_adminify_columns_attachments($attachmentCount)
43 {
44 $attachmentCount['wp_adminify_post_attachments'] = esc_html__('Attachment(s)', WP_ADMINIFY_TD);
45 return $attachmentCount;
46 }
47
48 function jltwp_adminify_custom_columns_attachments($adminify_col_name, $id)
49 {
50 if ($adminify_col_name === 'wp_adminify_post_attachments') {
51 $attachments = get_children(array('post_parent' => $id));
52 $adminifyAttachments = count($attachments);
53 if ($adminifyAttachments != 0) {
54 echo $adminifyAttachments;
55 }
56 }
57 }
58
59
60 function jltwp_adminify_rss_post_thumbnail($content)
61 {
62 global $post;
63 if (has_post_thumbnail($post->ID)) {
64 $content = '<p>' . get_the_post_thumbnail($post->ID) .
65 '</p>' . get_the_content();
66 }
67 return $content;
68 }
69
70
71 function jltwp_adminify_tags_categories_support_all()
72 {
73 register_taxonomy_for_object_type('post_tag', 'page');
74 register_taxonomy_for_object_type('category', 'page');
75 }
76
77 // ensure all tags and categories are included in queries
78 function jltwp_adminify_tags_categories_support_query($wp_query)
79 {
80 if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
81 if ($wp_query->get('category_name')) $wp_query->set('post_type', 'any');
82 }
83
84
85 function jltwp_adminify_remove_version()
86 {
87 return '';
88 }
89
90
91 function jltwp_adminify_imagelink_setup()
92 {
93 $image_set = get_option('image_default_link_type');
94
95 if ($image_set !== 'none') {
96 update_option('image_default_link_type', 'none');
97 }
98 }
99 }
100