clean up
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
3 changed files
with
111 additions
and
210 deletions
| ... | @@ -3,10 +3,12 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED); | ... | @@ -3,10 +3,12 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED); |
| 3 | @ini_set( 'upload_max_size' , '64M' ); | 3 | @ini_set( 'upload_max_size' , '64M' ); |
| 4 | @ini_set( 'post_max_size', '64M'); | 4 | @ini_set( 'post_max_size', '64M'); |
| 5 | @ini_set( 'max_execution_time', '300' ); | 5 | @ini_set( 'max_execution_time', '300' ); |
| 6 | |||
| 6 | require_once __DIR__ . '/vendor/autoload.php'; | 7 | require_once __DIR__ . '/vendor/autoload.php'; |
| 7 | require_once 'inc/users.php'; | 8 | require_once 'inc/users.php'; |
| 8 | require_once 'inc/learn.php'; | 9 | require_once 'inc/learn.php'; |
| 9 | require_once 'inc/menus.php'; | 10 | require_once 'inc/menus_widgets.php'; |
| 11 | require_once 'inc/custom_post_type.php'; | ||
| 10 | 12 | ||
| 11 | add_action('wp_enqueue_scripts', 'theme_broker_enqueue_scripts'); | 13 | add_action('wp_enqueue_scripts', 'theme_broker_enqueue_scripts'); |
| 12 | function theme_broker_enqueue_scripts() | 14 | function theme_broker_enqueue_scripts() |
| ... | @@ -129,9 +131,6 @@ function theme_broker_enqueue_scripts() | ... | @@ -129,9 +131,6 @@ function theme_broker_enqueue_scripts() |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 131 | 133 | ||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | function wp_disable_emojis() | 134 | function wp_disable_emojis() |
| 136 | { | 135 | { |
| 137 | remove_action('wp_head', 'print_emoji_detection_script', 7); | 136 | remove_action('wp_head', 'print_emoji_detection_script', 7); |
| ... | @@ -156,7 +155,6 @@ function my_deregister_styles(){ | ... | @@ -156,7 +155,6 @@ function my_deregister_styles(){ |
| 156 | add_action('init', 'wp_disable_emojis'); | 155 | add_action('init', 'wp_disable_emojis'); |
| 157 | 156 | ||
| 158 | 157 | ||
| 159 | |||
| 160 | add_filter('the_content', 'attachment_image_link_remove_filter'); | 158 | add_filter('the_content', 'attachment_image_link_remove_filter'); |
| 161 | function attachment_image_link_remove_filter($content) | 159 | function attachment_image_link_remove_filter($content) |
| 162 | { | 160 | { |
| ... | @@ -200,42 +198,6 @@ add_theme_support('custom-header'); | ... | @@ -200,42 +198,6 @@ add_theme_support('custom-header'); |
| 200 | 198 | ||
| 201 | 199 | ||
| 202 | 200 | ||
| 203 | |||
| 204 | |||
| 205 | function register_widgets() | ||
| 206 | { | ||
| 207 | |||
| 208 | |||
| 209 | register_sidebar(array( | ||
| 210 | 'name' => 'Footer Sidebar 1', | ||
| 211 | 'id' => 'footer-sidebar-1', | ||
| 212 | 'description' => 'Appears in the footer area', | ||
| 213 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', | ||
| 214 | 'after_widget' => '</aside>', | ||
| 215 | 'before_title' => '<h3 class="widget-title">', | ||
| 216 | 'after_title' => '</h3>', | ||
| 217 | )); | ||
| 218 | register_sidebar(array( | ||
| 219 | 'name' => 'Footer Sidebar 2', | ||
| 220 | 'id' => 'footer-sidebar-2', | ||
| 221 | 'description' => 'Appears in the footer area', | ||
| 222 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', | ||
| 223 | 'after_widget' => '</aside>', | ||
| 224 | 'before_title' => '<h3 class="widget-title">', | ||
| 225 | 'after_title' => '</h3>', | ||
| 226 | )); | ||
| 227 | register_sidebar(array( | ||
| 228 | 'name' => 'Footer Sidebar 3', | ||
| 229 | 'id' => 'footer-sidebar-3', | ||
| 230 | 'description' => 'Appears in the footer area', | ||
| 231 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', | ||
| 232 | 'after_widget' => '</aside>', | ||
| 233 | 'before_title' => '<h3 class="widget-title">', | ||
| 234 | 'after_title' => '</h3>', | ||
| 235 | )); | ||
| 236 | |||
| 237 | } | ||
| 238 | |||
| 239 | add_action('admin_head', 'my_custom_css'); | 201 | add_action('admin_head', 'my_custom_css'); |
| 240 | 202 | ||
| 241 | function my_custom_css() { | 203 | function my_custom_css() { |
| ... | @@ -246,8 +208,8 @@ function my_custom_css() { | ... | @@ -246,8 +208,8 @@ function my_custom_css() { |
| 246 | </style>'; | 208 | </style>'; |
| 247 | } | 209 | } |
| 248 | 210 | ||
| 249 | //end register_widgets() | 211 | |
| 250 | add_action('widgets_init', 'register_widgets'); | 212 | |
| 251 | 213 | ||
| 252 | 214 | ||
| 253 | /** | 215 | /** |
| ... | @@ -316,81 +278,7 @@ function projectivemotion_logout_home($logouturl, $redir) | ... | @@ -316,81 +278,7 @@ function projectivemotion_logout_home($logouturl, $redir) |
| 316 | return $logouturl . '&redirect_to=' . urlencode($redir); | 278 | return $logouturl . '&redirect_to=' . urlencode($redir); |
| 317 | } | 279 | } |
| 318 | 280 | ||
| 319 | /** | ||
| 320 | * Redirect login page to custom login page | ||
| 321 | */ | ||
| 322 | function redirect_login_page() | ||
| 323 | { | ||
| 324 | |||
| 325 | // Store for checking if this page equals wp-login.php | ||
| 326 | $page_viewed = basename($_SERVER['SCRIPT_NAME']); | ||
| 327 | 281 | ||
| 328 | // Where we want them to go | ||
| 329 | $login_page = site_url('/broker-login'); | ||
| 330 | |||
| 331 | // Two things happen here, we make sure we are on the login page | ||
| 332 | // and we also make sure that the request isn't coming from a form | ||
| 333 | // this ensures that our scripts & users can still log in and out. | ||
| 334 | |||
| 335 | if ($page_viewed == "wp-login.php" && $_GET["action"] == 'rp') { | ||
| 336 | |||
| 337 | $key = $_GET["key"]; | ||
| 338 | $login = $_GET["login"]; | ||
| 339 | $password_reset = site_url('/password-reset/?action=rp&key=' . $key . '&login=' . $login); | ||
| 340 | |||
| 341 | // And away they go... | ||
| 342 | wp_redirect($password_reset); | ||
| 343 | exit(); | ||
| 344 | } | ||
| 345 | if ($page_viewed == "wp-login.php" && $_GET["action"] == 'lostpassword') { | ||
| 346 | |||
| 347 | $lost = site_url('/lost-password/'); | ||
| 348 | // And away they go... | ||
| 349 | wp_redirect($lost); | ||
| 350 | exit(); | ||
| 351 | } | ||
| 352 | if ($page_viewed == "wp-login.php" && $_GET["action"] == 'logout') { | ||
| 353 | |||
| 354 | wp_logout(); | ||
| 355 | } | ||
| 356 | if ($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') { | ||
| 357 | |||
| 358 | // And away they go... | ||
| 359 | wp_redirect($login_page); | ||
| 360 | exit(); | ||
| 361 | } | ||
| 362 | } | ||
| 363 | |||
| 364 | //add_action('init', 'redirect_login_page'); | ||
| 365 | |||
| 366 | function my_login_redirect($redirect_to, $request, $user) | ||
| 367 | { | ||
| 368 | //is there a user to check? | ||
| 369 | global $user; | ||
| 370 | if (isset($user->roles) && is_array($user->roles)) { | ||
| 371 | //check for admins | ||
| 372 | if (in_array("administrator", $user->roles)) { | ||
| 373 | // redirect them to the default place | ||
| 374 | // return home_url(); | ||
| 375 | return $redirect_to; //get rid of this for testing purposes | ||
| 376 | } else { | ||
| 377 | return $redirect_to; | ||
| 378 | } | ||
| 379 | } else { | ||
| 380 | return $redirect_to; | ||
| 381 | } | ||
| 382 | } | ||
| 383 | |||
| 384 | //add_filter("login_redirect", "my_login_redirect", 10, 3); | ||
| 385 | |||
| 386 | // Change from email address | ||
| 387 | //add_filter('wp_mail_from', 'custom_wp_mail_from'); | ||
| 388 | function custom_wp_mail_from($email) | ||
| 389 | { | ||
| 390 | //Make sure the email is from the same domain | ||
| 391 | //as your website to avoid being marked as spam. | ||
| 392 | return 'lost_password@thecommonwell.ca'; | ||
| 393 | } | ||
| 394 | 282 | ||
| 395 | add_filter('mandrill_payload', 'sendEmailThroughMandrillSubaccount', 100); | 283 | add_filter('mandrill_payload', 'sendEmailThroughMandrillSubaccount', 100); |
| 396 | function sendEmailThroughMandrillSubaccount(array $message) | 284 | function sendEmailThroughMandrillSubaccount(array $message) |
| ... | @@ -410,19 +298,6 @@ function custom_wp_mail_from_name($original_email_from) | ... | @@ -410,19 +298,6 @@ function custom_wp_mail_from_name($original_email_from) |
| 410 | add_action('wp_ajax_nopriv_ajax-callback', 'ajax_callback'); | 298 | add_action('wp_ajax_nopriv_ajax-callback', 'ajax_callback'); |
| 411 | add_action('wp_ajax_ajax-callback', 'ajax_callback'); | 299 | add_action('wp_ajax_ajax-callback', 'ajax_callback'); |
| 412 | 300 | ||
| 413 | // Disable password reset function | ||
| 414 | function remove_lostpassword_text($text) | ||
| 415 | { | ||
| 416 | if ($text == 'Lost your password?') { | ||
| 417 | $text = ''; | ||
| 418 | } | ||
| 419 | |||
| 420 | return $text; | ||
| 421 | } | ||
| 422 | |||
| 423 | //add_filter('gettext', 'remove_lostpassword_text'); | ||
| 424 | |||
| 425 | |||
| 426 | 301 | ||
| 427 | add_action('init', 'handle_preflight'); | 302 | add_action('init', 'handle_preflight'); |
| 428 | function handle_preflight() | 303 | function handle_preflight() |
| ... | @@ -450,75 +325,6 @@ add_role( | ... | @@ -450,75 +325,6 @@ add_role( |
| 450 | ); | 325 | ); |
| 451 | 326 | ||
| 452 | 327 | ||
| 453 | // Our custom post type function | ||
| 454 | function create_posttype() | ||
| 455 | { | ||
| 456 | |||
| 457 | // Set UI labels for Custom Post Type | ||
| 458 | $labels = array( | ||
| 459 | 'name' => _x('Notifications', 'Post Type General Name', 'commonwell-corp'), | ||
| 460 | 'singular_name' => _x('Notification', 'Post Type Singular Name', 'commonwell-corp'), | ||
| 461 | 'menu_name' => __('Notifications', 'commonwell-corp'), | ||
| 462 | 'parent_item_colon' => __('Parent Notification', 'commonwell-corp'), | ||
| 463 | 'all_items' => __('All Notifications', 'commonwell-corp'), | ||
| 464 | 'view_item' => __('View Notification', 'commonwell-corp'), | ||
| 465 | 'add_new_item' => __('Add New Notification', 'commonwell-corp'), | ||
| 466 | 'add_new' => __('Add New', 'commonwell-corp'), | ||
| 467 | 'edit_item' => __('Edit Notification', 'commonwell-corp'), | ||
| 468 | 'update_item' => __('Update Notification', 'commonwell-corp'), | ||
| 469 | 'search_items' => __('Search Notification', 'commonwell-corp'), | ||
| 470 | 'not_found' => __('Not Found', 'commonwell-corp'), | ||
| 471 | 'not_found_in_trash' => __('Not found in Trash', 'commonwell-corp'), | ||
| 472 | ); | ||
| 473 | |||
| 474 | // Set other options for Custom Post Type | ||
| 475 | |||
| 476 | $args = array( | ||
| 477 | 'label' => __('notifications', 'twentythirteen'), | ||
| 478 | 'description' => __('notification news and reviews', 'twentythirteen'), | ||
| 479 | 'labels' => $labels, | ||
| 480 | // Features this CPT supports in Post Editor | ||
| 481 | 'supports' => array( | ||
| 482 | 'title', | ||
| 483 | 'editor', | ||
| 484 | 'excerpt', | ||
| 485 | 'author', | ||
| 486 | 'thumbnail', | ||
| 487 | 'comments', | ||
| 488 | 'featured_image', | ||
| 489 | 'set_featured_image', | ||
| 490 | 'use_featured_image', | ||
| 491 | 'revisions', | ||
| 492 | 'custom-fields', | ||
| 493 | ), | ||
| 494 | // You can associate this CPT with a taxonomy or custom taxonomy. | ||
| 495 | 'taxonomies' => array('genres'), | ||
| 496 | /* A hierarchical CPT is like Pages and can have | ||
| 497 | * Parent and child items. A non-hierarchical CPT | ||
| 498 | * is like Posts. | ||
| 499 | */ | ||
| 500 | 'hierarchical' => false, | ||
| 501 | 'public' => true, | ||
| 502 | 'show_ui' => true, | ||
| 503 | 'show_in_menu' => true, | ||
| 504 | 'show_in_nav_menus' => true, | ||
| 505 | 'show_in_admin_bar' => true, | ||
| 506 | 'menu_position' => 5, | ||
| 507 | 'can_export' => true, | ||
| 508 | 'has_archive' => true, | ||
| 509 | 'exclude_from_search' => false, | ||
| 510 | 'publicly_queryable' => true, | ||
| 511 | 'capability_type' => 'post', | ||
| 512 | ); | ||
| 513 | |||
| 514 | // Registering your Custom Post Type | ||
| 515 | register_post_type('notifications', $args); | ||
| 516 | |||
| 517 | |||
| 518 | } | ||
| 519 | |||
| 520 | // Hooking up our function to theme setup | ||
| 521 | add_action('init', 'create_posttype'); | ||
| 522 | 328 | ||
| 523 | /* | 329 | /* |
| 524 | * Creating a function to create our CPT | 330 | * Creating a function to create our CPT |
| ... | @@ -879,13 +685,10 @@ function add_hr_shortcode() | ... | @@ -879,13 +685,10 @@ function add_hr_shortcode() |
| 879 | 685 | ||
| 880 | 686 | ||
| 881 | add_action('wp_logout', 'remove_custom_cookie_admin'); | 687 | add_action('wp_logout', 'remove_custom_cookie_admin'); |
| 882 | function remove_custom_cookie_admin() | 688 | function remove_custom_cookie_admin() |
| 883 | { | 689 | { |
| 884 | setcookie('dialog_cookie', '', time() - 96400, '/'); | 690 | setcookie('dialog_cookie', '', time() - 96400, '/'); |
| 885 | } | 691 | } |
| 886 | |||
| 887 | |||
| 888 | |||
| 889 | 692 | ||
| 890 | if (!function_exists('str_contains')) { | 693 | if (!function_exists('str_contains')) { |
| 891 | function str_contains(string $haystack, string $needle): bool | 694 | function str_contains(string $haystack, string $needle): bool |
| ... | @@ -1039,11 +842,8 @@ function ParseXML($xml) { | ... | @@ -1039,11 +842,8 @@ function ParseXML($xml) { |
| 1039 | 842 | ||
| 1040 | 843 | ||
| 1041 | 844 | ||
| 1042 | /** | 845 | // Disable User Notification of Password Change Confirmation |
| 1043 | * Disable User Notification of Password Change Confirmation | ||
| 1044 | */ | ||
| 1045 | add_filter( 'send_password_change_email', '__return_false' ); | 846 | add_filter( 'send_password_change_email', '__return_false' ); |
| 1046 | |||
| 1047 | // Disables the block editor from managing widgets in the Gutenberg plugin. | 847 | // Disables the block editor from managing widgets in the Gutenberg plugin. |
| 1048 | add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' ); | 848 | add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' ); |
| 1049 | // Disables the block editor from managing widgets. | 849 | // Disables the block editor from managing widgets. | ... | ... |
| 1 | <?php | ||
| 2 | |||
| 3 | // Our custom post type function | ||
| 4 | function create_posttype() | ||
| 5 | { | ||
| 6 | |||
| 7 | |||
| 8 | $labels = array( | ||
| 9 | 'name' => _x('Notifications', 'Post Type General Name', 'commonwell-corp'), | ||
| 10 | 'singular_name' => _x('Notification', 'Post Type Singular Name', 'commonwell-corp'), | ||
| 11 | 'menu_name' => __('Notifications', 'commonwell-corp'), | ||
| 12 | 'parent_item_colon' => __('Parent Notification', 'commonwell-corp'), | ||
| 13 | 'all_items' => __('All Notifications', 'commonwell-corp'), | ||
| 14 | 'view_item' => __('View Notification', 'commonwell-corp'), | ||
| 15 | 'add_new_item' => __('Add New Notification', 'commonwell-corp'), | ||
| 16 | 'add_new' => __('Add New', 'commonwell-corp'), | ||
| 17 | 'edit_item' => __('Edit Notification', 'commonwell-corp'), | ||
| 18 | 'update_item' => __('Update Notification', 'commonwell-corp'), | ||
| 19 | 'search_items' => __('Search Notification', 'commonwell-corp'), | ||
| 20 | 'not_found' => __('Not Found', 'commonwell-corp'), | ||
| 21 | 'not_found_in_trash' => __('Not found in Trash', 'commonwell-corp'), | ||
| 22 | ); | ||
| 23 | |||
| 24 | |||
| 25 | $args = array( | ||
| 26 | 'label' => __('notifications', 'twentythirteen'), | ||
| 27 | 'description' => __('notification news and reviews', 'twentythirteen'), | ||
| 28 | 'labels' => $labels, | ||
| 29 | 'supports' => array( | ||
| 30 | 'title', | ||
| 31 | 'editor', | ||
| 32 | 'excerpt', | ||
| 33 | 'author', | ||
| 34 | 'thumbnail', | ||
| 35 | 'comments', | ||
| 36 | 'featured_image', | ||
| 37 | 'set_featured_image', | ||
| 38 | 'use_featured_image', | ||
| 39 | 'revisions', | ||
| 40 | 'custom-fields', | ||
| 41 | ), | ||
| 42 | |||
| 43 | 'taxonomies' => array('genres'), | ||
| 44 | 'hierarchical' => false, | ||
| 45 | 'public' => true, | ||
| 46 | 'show_ui' => true, | ||
| 47 | 'show_in_menu' => true, | ||
| 48 | 'show_in_nav_menus' => true, | ||
| 49 | 'show_in_admin_bar' => true, | ||
| 50 | 'menu_position' => 5, | ||
| 51 | 'can_export' => true, | ||
| 52 | 'has_archive' => true, | ||
| 53 | 'exclude_from_search' => false, | ||
| 54 | 'publicly_queryable' => true, | ||
| 55 | 'capability_type' => 'post', | ||
| 56 | ); | ||
| 57 | |||
| 58 | register_post_type('notifications', $args); | ||
| 59 | |||
| 60 | |||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | add_action('init', 'create_posttype'); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -174,3 +174,40 @@ function clean_custom_moblie_menus() | ... | @@ -174,3 +174,40 @@ function clean_custom_moblie_menus() |
| 174 | } | 174 | } |
| 175 | echo $menu_list; | 175 | echo $menu_list; |
| 176 | } | 176 | } |
| 177 | |||
| 178 | |||
| 179 | |||
| 180 | function register_widgets() | ||
| 181 | { | ||
| 182 | register_sidebar(array( | ||
| 183 | 'name' => 'Footer Sidebar 1', | ||
| 184 | 'id' => 'footer-sidebar-1', | ||
| 185 | 'description' => 'Appears in the footer area', | ||
| 186 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', | ||
| 187 | 'after_widget' => '</aside>', | ||
| 188 | 'before_title' => '<h3 class="widget-title">', | ||
| 189 | 'after_title' => '</h3>', | ||
| 190 | )); | ||
| 191 | register_sidebar(array( | ||
| 192 | 'name' => 'Footer Sidebar 2', | ||
| 193 | 'id' => 'footer-sidebar-2', | ||
| 194 | 'description' => 'Appears in the footer area', | ||
| 195 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', | ||
| 196 | 'after_widget' => '</aside>', | ||
| 197 | 'before_title' => '<h3 class="widget-title">', | ||
| 198 | 'after_title' => '</h3>', | ||
| 199 | )); | ||
| 200 | register_sidebar(array( | ||
| 201 | 'name' => 'Footer Sidebar 3', | ||
| 202 | 'id' => 'footer-sidebar-3', | ||
| 203 | 'description' => 'Appears in the footer area', | ||
| 204 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', | ||
| 205 | 'after_widget' => '</aside>', | ||
| 206 | 'before_title' => '<h3 class="widget-title">', | ||
| 207 | 'after_title' => '</h3>', | ||
| 208 | )); | ||
| 209 | |||
| 210 | } | ||
| 211 | |||
| 212 | |||
| 213 | add_action('widgets_init', 'register_widgets'); | ... | ... |
-
Please register or sign in to post a comment