11
11
12
12
// Function to output meta description based on tutorial's short description
13
13
function thp_add_meta_description () {
14
- if (is_singular ('tutorial_handbook ' )) {
14
+ if (is_singular ('shys_tutorial_handbook ' )) {
15
15
global $ post ;
16
16
17
17
// Retrieve the custom short description
@@ -43,7 +43,7 @@ function thp_add_paid_meta_box() {
43
43
'thp_paid_meta_box ' ,
44
44
'Paid Tutorial ' ,
45
45
'thp_paid_meta_box_callback ' ,
46
- 'tutorial_handbook ' ,
46
+ 'shys_tutorial_handbook ' ,
47
47
'side '
48
48
);
49
49
}
@@ -74,7 +74,7 @@ function thp_add_price_meta_box() {
74
74
'thp_price_meta_box ' ,
75
75
'Tutorial Price ' ,
76
76
'thp_price_meta_box_callback ' ,
77
- 'tutorial_handbook ' , // Ensure this matches your custom post type
77
+ 'shys_tutorial_handbook ' , // Ensure this matches your custom post type
78
78
'side ' ,
79
79
'high ' // Position it high up in the sidebar
80
80
);
@@ -120,15 +120,15 @@ function thp_register_custom_post_type() {
120
120
'publicly_queryable ' => true ,
121
121
'show_in_rest ' => true
122
122
);
123
- register_post_type ('tutorial_handbook ' , $ args );
123
+ register_post_type ('shys_tutorial_handbook ' , $ args );
124
124
}
125
125
add_action ('init ' , 'thp_register_custom_post_type ' );
126
126
127
127
// Generate nested toc
128
128
function thp_generate_toc ($ content ) {
129
129
global $ post ;
130
130
131
- if ($ post ->post_type === 'tutorial_handbook ' ) {
131
+ if ($ post ->post_type === 'shys_tutorial_handbook ' ) {
132
132
$ matches = array ();
133
133
preg_match_all ('/<h([2-6])[^>]*>([^<]+)<\/h[2-6]>/ ' , $ content , $ matches );
134
134
@@ -208,7 +208,7 @@ function thp_add_hide_meta_box() {
208
208
'thp_hide_meta_box ' ,
209
209
'Hide from General Listing ' ,
210
210
'thp_hide_meta_box_callback ' ,
211
- 'tutorial_handbook ' ,
211
+ 'shys_tutorial_handbook ' ,
212
212
'side '
213
213
);
214
214
}
@@ -238,7 +238,7 @@ function thp_add_description_meta_box() {
238
238
'thp_description_meta_box ' , // ID
239
239
'Post Description ' , // Title
240
240
'thp_description_meta_box_callback ' , // Callback
241
- 'tutorial_handbook ' , // Post type
241
+ 'shys_tutorial_handbook ' , // Post type
242
242
'normal ' , // Context
243
243
'high ' // Priority
244
244
);
@@ -276,7 +276,7 @@ function thp_save_description_meta_box($post_id) {
276
276
}
277
277
278
278
// Check the user's permissions.
279
- if (isset ($ _POST ['post_type ' ]) && $ _POST ['post_type ' ] === 'tutorial_handbook ' ) {
279
+ if (isset ($ _POST ['post_type ' ]) && $ _POST ['post_type ' ] === 'shys_tutorial_handbook ' ) {
280
280
if (!current_user_can ('edit_post ' , $ post_id )) {
281
281
return ;
282
282
}
@@ -298,7 +298,7 @@ function thp_add_memo_meta_box() {
298
298
'thp_memo_meta_box ' , // ID
299
299
'Internal Memo ' , // Title
300
300
'thp_memo_meta_box_callback ' , // Callback
301
- 'tutorial_handbook ' , // Post type
301
+ 'shys_tutorial_handbook ' , // Post type
302
302
'normal ' , // Context
303
303
'high ' // Priority
304
304
);
@@ -336,7 +336,7 @@ function thp_save_memo_meta_box($post_id) {
336
336
}
337
337
338
338
// Check the user's permissions.
339
- if (isset ($ _POST ['post_type ' ]) && $ _POST ['post_type ' ] === 'tutorial_handbook ' ) {
339
+ if (isset ($ _POST ['post_type ' ]) && $ _POST ['post_type ' ] === 'shys_tutorial_handbook ' ) {
340
340
if (!current_user_can ('edit_post ' , $ post_id )) {
341
341
return ;
342
342
}
@@ -358,7 +358,7 @@ function thp_enqueue_toc_styles() {
358
358
359
359
// Check if the post is of type 'tutorial_handbook' or if it contains the shortcodes
360
360
if (
361
- is_singular ('tutorial_handbook ' ) ||
361
+ is_singular ('shys_tutorial_handbook ' ) ||
362
362
(isset ($ post ->post_content ) && (has_shortcode ($ post ->post_content , 'shy_tutorials ' ) || has_shortcode ($ post ->post_content , 'shy_private_tutorials ' )))
363
363
) {
364
364
wp_enqueue_style ('thp_toc_styles ' , plugin_dir_url (__FILE__ ) . 'style.css ' , array (), filemtime (plugin_dir_path (__FILE__ ) . 'style.css ' ));
@@ -368,7 +368,7 @@ function thp_enqueue_toc_styles() {
368
368
369
369
// Access Control - Assign users to specific tutorials (simplified example)
370
370
function thp_add_meta_boxes () {
371
- add_meta_box ('thp_access_control ' , 'Access Control ' , 'thp_access_control_callback ' , 'tutorial_handbook ' , 'side ' );
371
+ add_meta_box ('thp_access_control ' , 'Access Control ' , 'thp_access_control_callback ' , 'shys_tutorial_handbook ' , 'side ' );
372
372
}
373
373
add_action ('add_meta_boxes ' , 'thp_add_meta_boxes ' );
374
374
@@ -394,7 +394,7 @@ function thp_save_post($post_id) {
394
394
add_action ('save_post ' , 'thp_save_post ' );
395
395
396
396
function thp_restrict_access ($ content ) {
397
- if (get_post_type () === 'tutorial_handbook ' ) {
397
+ if (get_post_type () === 'shys_tutorial_handbook ' ) {
398
398
$ is_paid = get_post_meta (get_the_ID (), '_is_paid ' , true ); // Check if the post is marked as paid
399
399
400
400
if ($ is_paid ) {
@@ -431,7 +431,7 @@ function shy_assigned_articles_shortcode($atts) {
431
431
432
432
<?php
433
433
// Query for all posts in the 'tutorial_handbook' post type
434
- $ args = array ('post_type ' => 'tutorial_handbook ' , 'posts_per_page ' => -1 );
434
+ $ args = array ('post_type ' => 'shys_tutorial_handbook ' , 'posts_per_page ' => -1 );
435
435
$ query = new WP_Query ($ args );
436
436
437
437
if ($ query ->have_posts ()) {
@@ -504,8 +504,8 @@ function shy_knowledge_base_shortcode($atts) {
504
504
<div class="articles-list">
505
505
506
506
<?php
507
- // Query for all posts in the 'tutorial_handbook ' post type
508
- $ args = array ('post_type ' => 'tutorial_handbook ' , 'posts_per_page ' => -1 );
507
+ // Query for all posts in the 'shys_tutorial_handbook ' post type
508
+ $ args = array ('post_type ' => 'shys_tutorial_handbook ' , 'posts_per_page ' => -1 );
509
509
$ query = new WP_Query ($ args );
510
510
511
511
if ($ query ->have_posts ()) :
@@ -578,12 +578,12 @@ function shy_knowledge_base_shortcode($atts) {
578
578
// Add PayPal Settings submenu
579
579
function thp_add_paypal_settings_submenu () {
580
580
add_submenu_page (
581
- 'edit.php?post_type=tutorial_handbook ' , // Parent slug
582
- 'PayPal Settings ' , // Page title
583
- 'PayPal Settings ' , // Menu title
584
- 'manage_options ' , // Capability
585
- 'thp_paypal_settings ' , // Menu slug
586
- 'thp_paypal_settings_page_callback ' // Callback function
581
+ 'edit.php?post_type=shys_tutorial_handbook ' , // Parent slug
582
+ 'PayPal Settings ' , // Page title
583
+ 'PayPal Settings ' , // Menu title
584
+ 'manage_options ' , // Capability
585
+ 'thp_paypal_settings ' , // Menu slug
586
+ 'thp_paypal_settings_page_callback ' // Callback function
587
587
);
588
588
}
589
589
add_action ('admin_menu ' , 'thp_add_paypal_settings_submenu ' );
@@ -746,7 +746,7 @@ function thp_render_single_article($post_id, $is_paid, $user_has_access, $descri
746
746
/* Logs */
747
747
function thp_register_logs_page () {
748
748
add_submenu_page (
749
- 'edit.php?post_type=tutorial_handbook ' , // Parent slug
749
+ 'edit.php?post_type=shys_tutorial_handbook ' , // Parent slug
750
750
'Logs ' , // Page title
751
751
'Logs ' , // Menu title
752
752
'manage_options ' , // Capability
@@ -1040,7 +1040,7 @@ function thp_register_transaction_post_type() {
1040
1040
'public ' => false ,
1041
1041
'publicly_queryable ' => false ,
1042
1042
'show_ui ' => true ,
1043
- 'show_in_menu ' => 'edit.php?post_type=tutorial_handbook ' , // Make it a sub-menu
1043
+ 'show_in_menu ' => 'edit.php?post_type=shys_tutorial_handbook ' , // Make it a sub-menu
1044
1044
'query_var ' => true ,
1045
1045
'capability_type ' => 'post ' ,
1046
1046
'has_archive ' => false ,
0 commit comments