Skip to content

Commit 4832d31

Browse files
committed
changed post type
1 parent 55a40b2 commit 4832d31

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

tuts.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// Function to output meta description based on tutorial's short description
1313
function thp_add_meta_description() {
14-
if (is_singular('tutorial_handbook')) {
14+
if (is_singular('shys_tutorial_handbook')) {
1515
global $post;
1616

1717
// Retrieve the custom short description
@@ -43,7 +43,7 @@ function thp_add_paid_meta_box() {
4343
'thp_paid_meta_box',
4444
'Paid Tutorial',
4545
'thp_paid_meta_box_callback',
46-
'tutorial_handbook',
46+
'shys_tutorial_handbook',
4747
'side'
4848
);
4949
}
@@ -74,7 +74,7 @@ function thp_add_price_meta_box() {
7474
'thp_price_meta_box',
7575
'Tutorial Price',
7676
'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
7878
'side',
7979
'high' // Position it high up in the sidebar
8080
);
@@ -120,15 +120,15 @@ function thp_register_custom_post_type() {
120120
'publicly_queryable' => true,
121121
'show_in_rest' => true
122122
);
123-
register_post_type('tutorial_handbook', $args);
123+
register_post_type('shys_tutorial_handbook', $args);
124124
}
125125
add_action('init', 'thp_register_custom_post_type');
126126

127127
// Generate nested toc
128128
function thp_generate_toc($content) {
129129
global $post;
130130

131-
if ($post->post_type === 'tutorial_handbook') {
131+
if ($post->post_type === 'shys_tutorial_handbook') {
132132
$matches = array();
133133
preg_match_all('/<h([2-6])[^>]*>([^<]+)<\/h[2-6]>/', $content, $matches);
134134

@@ -208,7 +208,7 @@ function thp_add_hide_meta_box() {
208208
'thp_hide_meta_box',
209209
'Hide from General Listing',
210210
'thp_hide_meta_box_callback',
211-
'tutorial_handbook',
211+
'shys_tutorial_handbook',
212212
'side'
213213
);
214214
}
@@ -238,7 +238,7 @@ function thp_add_description_meta_box() {
238238
'thp_description_meta_box', // ID
239239
'Post Description', // Title
240240
'thp_description_meta_box_callback', // Callback
241-
'tutorial_handbook', // Post type
241+
'shys_tutorial_handbook', // Post type
242242
'normal', // Context
243243
'high' // Priority
244244
);
@@ -276,7 +276,7 @@ function thp_save_description_meta_box($post_id) {
276276
}
277277

278278
// 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') {
280280
if (!current_user_can('edit_post', $post_id)) {
281281
return;
282282
}
@@ -298,7 +298,7 @@ function thp_add_memo_meta_box() {
298298
'thp_memo_meta_box', // ID
299299
'Internal Memo', // Title
300300
'thp_memo_meta_box_callback', // Callback
301-
'tutorial_handbook', // Post type
301+
'shys_tutorial_handbook', // Post type
302302
'normal', // Context
303303
'high' // Priority
304304
);
@@ -336,7 +336,7 @@ function thp_save_memo_meta_box($post_id) {
336336
}
337337

338338
// 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') {
340340
if (!current_user_can('edit_post', $post_id)) {
341341
return;
342342
}
@@ -358,7 +358,7 @@ function thp_enqueue_toc_styles() {
358358

359359
// Check if the post is of type 'tutorial_handbook' or if it contains the shortcodes
360360
if (
361-
is_singular('tutorial_handbook') ||
361+
is_singular('shys_tutorial_handbook') ||
362362
(isset($post->post_content) && (has_shortcode($post->post_content, 'shy_tutorials') || has_shortcode($post->post_content, 'shy_private_tutorials')))
363363
) {
364364
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() {
368368

369369
// Access Control - Assign users to specific tutorials (simplified example)
370370
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');
372372
}
373373
add_action('add_meta_boxes', 'thp_add_meta_boxes');
374374

@@ -394,7 +394,7 @@ function thp_save_post($post_id) {
394394
add_action('save_post', 'thp_save_post');
395395

396396
function thp_restrict_access($content) {
397-
if (get_post_type() === 'tutorial_handbook') {
397+
if (get_post_type() === 'shys_tutorial_handbook') {
398398
$is_paid = get_post_meta(get_the_ID(), '_is_paid', true); // Check if the post is marked as paid
399399

400400
if ($is_paid) {
@@ -431,7 +431,7 @@ function shy_assigned_articles_shortcode($atts) {
431431

432432
<?php
433433
// 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);
435435
$query = new WP_Query($args);
436436

437437
if ($query->have_posts()) {
@@ -504,8 +504,8 @@ function shy_knowledge_base_shortcode($atts) {
504504
<div class="articles-list">
505505

506506
<?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);
509509
$query = new WP_Query($args);
510510

511511
if ($query->have_posts()) :
@@ -578,12 +578,12 @@ function shy_knowledge_base_shortcode($atts) {
578578
// Add PayPal Settings submenu
579579
function thp_add_paypal_settings_submenu() {
580580
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
587587
);
588588
}
589589
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
746746
/* Logs */
747747
function thp_register_logs_page() {
748748
add_submenu_page(
749-
'edit.php?post_type=tutorial_handbook', // Parent slug
749+
'edit.php?post_type=shys_tutorial_handbook', // Parent slug
750750
'Logs', // Page title
751751
'Logs', // Menu title
752752
'manage_options', // Capability
@@ -1040,7 +1040,7 @@ function thp_register_transaction_post_type() {
10401040
'public' => false,
10411041
'publicly_queryable' => false,
10421042
'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
10441044
'query_var' => true,
10451045
'capability_type' => 'post',
10461046
'has_archive' => false,

0 commit comments

Comments
 (0)