diff --git a/composer.lock b/composer.lock index e56e4be..0c0526b 100644 --- a/composer.lock +++ b/composer.lock @@ -321,12 +321,12 @@ "source": { "type": "git", "url": "https://github.com/timber/timber.git", - "reference": "282285c3fb19be10ad8f71090ebd4e43c86f958b" + "reference": "bc1298fdb842903337ca550ce91710b99b9c265f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/timber/timber/zipball/282285c3fb19be10ad8f71090ebd4e43c86f958b", - "reference": "282285c3fb19be10ad8f71090ebd4e43c86f958b", + "url": "https://api.github.com/repos/timber/timber/zipball/bc1298fdb842903337ca550ce91710b99b9c265f", + "reference": "bc1298fdb842903337ca550ce91710b99b9c265f", "shasum": "" }, "require": { @@ -431,7 +431,7 @@ "type": "open_collective" } ], - "time": "2026-07-03T10:35:14+00:00" + "time": "2026-08-21T10:23:00+00:00" }, { "name": "twig/twig", @@ -439,12 +439,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "9036d8c5aae201a13450f4e60ce5536ac7c11070" + "reference": "84c50511513f4a522fd3c957b05c789f0960bea5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/9036d8c5aae201a13450f4e60ce5536ac7c11070", - "reference": "9036d8c5aae201a13450f4e60ce5536ac7c11070", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/84c50511513f4a522fd3c957b05c789f0960bea5", + "reference": "84c50511513f4a522fd3c957b05c789f0960bea5", "shasum": "" }, "require": { @@ -512,7 +512,7 @@ "type": "tidelift" } ], - "time": "2026-08-16T08:53:58+00:00" + "time": "2026-08-19T17:01:15+00:00" } ], "packages-dev": [ @@ -886,17 +886,17 @@ "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "ae25c932f7cc86a4394d1dfae0d3d956172bc284" + "reference": "484ee34a5855a5f4d3b74e2c6b7f76d1ef2d004d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/ae25c932f7cc86a4394d1dfae0d3d956172bc284", - "reference": "ae25c932f7cc86a4394d1dfae0d3d956172bc284", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/484ee34a5855a5f4d3b74e2c6b7f76d1ef2d004d", + "reference": "484ee34a5855a5f4d3b74e2c6b7f76d1ef2d004d", "shasum": "" }, "require": { "ext-json": "*", - "php": ">=5.3.2" + "php": ">=7.4" }, "provide": { "wordpress/core-implementation": "7.1.x-dev" @@ -926,7 +926,7 @@ "source": "https://core.trac.wordpress.org/browser", "wiki": "https://codex.wordpress.org/" }, - "time": "2026-08-17T15:45:58+00:00" + "time": "2026-08-20T00:28:42+00:00" }, { "name": "johnpbloch/wordpress-core-installer", @@ -2821,12 +2821,12 @@ "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "2d143e9441ea0d3df5ec79b50179fa2f2a78b2aa" + "reference": "4682ac59887211d071b204054f6ba060c04b6a09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/2d143e9441ea0d3df5ec79b50179fa2f2a78b2aa", - "reference": "2d143e9441ea0d3df5ec79b50179fa2f2a78b2aa", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/4682ac59887211d071b204054f6ba060c04b6a09", + "reference": "4682ac59887211d071b204054f6ba060c04b6a09", "shasum": "" }, "require": { @@ -2892,7 +2892,7 @@ "type": "thanks_dev" } ], - "time": "2026-08-17T00:58:01+00:00" + "time": "2026-08-20T23:49:49+00:00" }, { "name": "staabm/side-effects-detector", diff --git a/functions.php b/functions.php index 728cd90..87bdb1a 100755 --- a/functions.php +++ b/functions.php @@ -1,4 +1,5 @@ require_classes([ - '\Timber\Site', - '\Conifer\Site', - // add your own classes here + '\Timber\Site', + '\Conifer\Site', + // add your own classes here ]); // Check that all requirements have been met if (!$pluginManager->requirements_met()) { - // plugins haven't initialized properly; bail - return; + // plugins haven't initialized properly; bail + return; } // Build out the site. // Put WordPress configurations, such as filter and action hooks, // inside the config function passed to Site::configure(). $site = new Site(); -$site->configure(function() { +$site->configure(function () { /* * @groot config_callback @@ -67,11 +68,11 @@ * This is new in Timber 2.0. * @see https://timber.github.io/docs/v2/guides/class-maps/ */ - add_filter('timber/post/classmap', function(array $map) { + add_filter('timber/post/classmap', function (array $map) { return array_merge($map, [ // For pages, instantiate a FrontPage for the globally configured home page, // otherwise return a regular Page. - 'page' => function(\WP_Post $page) { + 'page' => function (\WP_Post $page) { static $homeId; $homeId = $homeId ?? get_option('page_on_front'); return $page->ID === $homeId ? FrontPage::class : Page::class; @@ -93,16 +94,16 @@ add_filter('timber/menuitem/classmap', function ($classmap) { $custom_classmap = [ 'primary' => MenuItem::class, - 'utility' => MenuItem::class, + 'utility' => MenuItem::class, ]; - + return array_merge($classmap, $custom_classmap); }); $this->add_twig_helper(new ThemeTwigHelper()); - add_theme_support( 'post-thumbnails' ); - add_theme_support( 'menus' ); + add_theme_support('post-thumbnails'); + add_theme_support('menus'); //use editor-style.css for the admin center RTE add_editor_style(); @@ -114,15 +115,18 @@ * Disable comments across the site */ $this->disable_comments(); + // Hide Tags from admin menu and post editor + $this->disable_tags(); //remove quick post from dashboard - function remove_dashboard_widgets() { + function remove_dashboard_widgets() + { global $wp_meta_boxes; unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); } add_action('wp_dashboard_setup', 'remove_dashboard_widgets'); - add_action('wp_enqueue_scripts', function() { + add_action('wp_enqueue_scripts', function () { //Enqueue our own project-specific JavaScript, including dependencies. $this->enqueue_script( 'project-common', @@ -137,27 +141,27 @@ function remove_dashboard_widgets() { [], ['file' => 'scripts.version'] ); - + $this->enqueue_style('swiper-css', 'dist/slideshows.css', [], ['file' => 'styles.version']); $this->enqueue_style('project-css', 'style.css', [], ['file' => 'styles.version']); $this->enqueue_style('project-print-css', 'print.css', [], ['file' => 'styles.version'], 'print'); - wp_dequeue_style( 'wp-block-library' ); //remove block library wp css + wp_dequeue_style('wp-block-library'); //remove block library wp css wp_dequeue_style('gform_theme_ie11'); //remove ie11 support for gravity forms }); //remove unneccesary additional emoji scripts - remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); - remove_action( 'wp_print_styles', 'print_emoji_styles' ); + remove_action('wp_head', 'print_emoji_detection_script', 7); + remove_action('wp_print_styles', 'print_emoji_styles'); // disable default Gallery - add_filter( 'use_default_gallery_style', '__return_false' ); + add_filter('use_default_gallery_style', '__return_false'); // CUSTOM IMAGE CROPS - add_image_size( 'gallery', 950, 600, true ); //gallery slideshow flex pattern - add_image_size( 'article-card', 380, 250, true ); //article-card partial - add_image_size( 'article-list-card', 276, 200, true ); //article-card partial + add_image_size('gallery', 950, 600, true); //gallery slideshow flex pattern + add_image_size('article-card', 380, 250, true); //article-card partial + add_image_size('article-list-card', 276, 200, true); //article-card partial // use this to unset or add image size options for RTE image insert /*add_filter( 'image_size_names_choose', function($sizes) { @@ -178,7 +182,7 @@ function remove_dashboard_widgets() { 'utility' => 'Utility Navigation', ]); - add_filter('timber/context', function(array $context) : array { + add_filter('timber/context', function (array $context): array { $context['primary_menu'] = Timber::get_menu('primary'); $context['utility_menu'] = Timber::get_menu('utility'); @@ -187,67 +191,49 @@ function remove_dashboard_widgets() { }); /* ADDITIONAL UTILITIES/CUSTOMIZATIONS FOR THEME */ - + //hide posts from admin menu // add_action('admin_menu', function(){ // remove_menu_page('edit.php'); // }); //REMOVE UNUSED MENU ITEMS - function remove_unused_admin_menu_items() { - remove_submenu_page( 'themes.php', 'font-library.php' ); - remove_submenu_page( 'themes.php', 'site-editor.php' ); - remove_submenu_page( 'themes.php', 'theme-editor.php' ); + function remove_unused_admin_menu_items() + { + remove_submenu_page('themes.php', 'font-library.php'); + remove_submenu_page('themes.php', 'site-editor.php'); + remove_submenu_page('themes.php', 'theme-editor.php'); // Appearance > Patterns (slug varies by WP/Gutenberg context) - remove_submenu_page( 'themes.php', 'site-editor.php?p=/pattern' ); - remove_submenu_page( 'themes.php', 'site-editor.php?p=%2Fpattern' ); + remove_submenu_page('themes.php', 'site-editor.php?p=/pattern'); + remove_submenu_page('themes.php', 'site-editor.php?p=%2Fpattern'); } - add_action( 'admin_menu', 'remove_unused_admin_menu_items', 999 ); - - // Hide Tags from admin menu and post editor - add_action('admin_menu', function() { - remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=post_tag'); - }); - add_action('init', function() { - //Hide tags for posts and all cpts - $types = get_post_types(['public' => true], 'names'); - - // Keep tags enabled for The Events Calendar post type(s). - $excluded_types = [ - 'tribe_events', - ]; - - foreach ($types as $type) { - if (in_array($type, $excluded_types, true)) { - continue; - } - unregister_taxonomy_for_object_type('post_tag', $type); - } - }); + add_action('admin_menu', 'remove_unused_admin_menu_items', 999); //remove read more tag - add_filter( 'mce_buttons', 'sc_remove_tiny_mce_buttons_from_row1'); - function sc_remove_tiny_mce_buttons_from_row1( $buttons ) { + add_filter('mce_buttons', 'sc_remove_tiny_mce_buttons_from_row1'); + function sc_remove_tiny_mce_buttons_from_row1($buttons) + { $remove_buttons = array( 'wp_more', // read more link ); - foreach ( $buttons as $button_key => $button_value ) { - if ( in_array( $button_value, $remove_buttons ) ) { - unset( $buttons[ $button_key ] ); + foreach ($buttons as $button_key => $button_value) { + if (in_array($button_value, $remove_buttons)) { + unset($buttons[$button_key]); } } return $buttons; } //REMOVE TEXT COLOR OPTION FROM RTE - add_filter( 'mce_buttons_2', 'sc_remove_tiny_mce_buttons_from_row2'); - function sc_remove_tiny_mce_buttons_from_row2( $buttons ) { + add_filter('mce_buttons_2', 'sc_remove_tiny_mce_buttons_from_row2'); + function sc_remove_tiny_mce_buttons_from_row2($buttons) + { $remove_buttons = array( 'forecolor', // text color ); - foreach ( $buttons as $button_key => $button_value ) { - if ( in_array( $button_value, $remove_buttons ) ) { - unset( $buttons[ $button_key ] ); + foreach ($buttons as $button_key => $button_value) { + if (in_array($button_value, $remove_buttons)) { + unset($buttons[$button_key]); } } return $buttons; @@ -261,7 +247,8 @@ function sc_remove_tiny_mce_buttons_from_row2( $buttons ) { */ add_filter('template_include', 'get_password_protected_template', 99); - function get_password_protected_template($template) { + function get_password_protected_template($template) + { global $post; if (!empty($post) && is_singular() && post_password_required($post->ID)) { @@ -281,31 +268,33 @@ function get_password_protected_template($template) { * Uses input crop data to generate retina size * */ - function add_retina_for_cropped_thumbnails( $input, $croppedSize, $temporaryCopyFile, $currentFilePath ) { + function add_retina_for_cropped_thumbnails($input, $croppedSize, $temporaryCopyFile, $currentFilePath) + { - $temporaryCopyFile = generate_retina_filename( $temporaryCopyFile, '@2x' ); - $retina_file = generate_retina_filename( $currentFilePath, '@2x' ); + $temporaryCopyFile = generate_retina_filename($temporaryCopyFile, '@2x'); + $retina_file = generate_retina_filename($currentFilePath, '@2x'); $currentFilePathInfo = pathinfo($retina_file); - $currentFilePathInfo['basename'] = wp_basename($retina_file);//uses the i18n version of the file-basename - + $currentFilePathInfo['basename'] = wp_basename($retina_file); //uses the i18n version of the file-basename + $retina_w = $croppedSize['width'] * 2; $retina_h = $croppedSize['height'] * 2; - - $cropped = wp_crop_image( // * @return string|WP_Error|false New filepath on success, WP_Error or false on failure. - $input->sourceImageId, // * @param string|int $src The source file or Attachment ID. - $input->selection->x, // * @param int $src_x The start x position to crop from. - $input->selection->y, // * @param int $src_y The start y position to crop from. - $input->selection->x2 - $input->selection->x, // * @param int $src_w The width to crop. - $input->selection->y2 - $input->selection->y, // * @param int $src_h The height to crop. - $retina_w, // * @param int $dst_w The destination width. - $retina_h, // * @param int $dst_h The destination height. - false, // * @param int $src_abs Optional. If the source crop points are absolute. - $temporaryCopyFile // * @param string $dst_file Optional. The destination file to write to. + + $cropped = wp_crop_image( // * @return string|WP_Error|false New filepath on success, WP_Error or false on failure. + $input->sourceImageId, // * @param string|int $src The source file or Attachment ID. + $input->selection->x, // * @param int $src_x The start x position to crop from. + $input->selection->y, // * @param int $src_y The start y position to crop from. + $input->selection->x2 - $input->selection->x, // * @param int $src_w The width to crop. + $input->selection->y2 - $input->selection->y, // * @param int $src_h The height to crop. + $retina_w, // * @param int $dst_w The destination width. + $retina_h, // * @param int $dst_h The destination height. + false, // * @param int $src_abs Optional. If the source crop points are absolute. + $temporaryCopyFile // * @param string $dst_file Optional. The destination file to write to. ); - + // delete old file - $should_delete = apply_filters('crop_thumbnails_should_delete_old_file', + $should_delete = apply_filters( + 'crop_thumbnails_should_delete_old_file', false, // default value $input->activeImageSizes->name, $input->activeImageSizes, @@ -313,32 +302,29 @@ function add_retina_for_cropped_thumbnails( $input, $croppedSize, $temporaryCopy ); $_error = false; - if( !empty($cropped) ) { - if( $should_delete ) { - @unlink($currentFilePathInfo['dirname'].DIRECTORY_SEPARATOR.$currentFilePathInfo['basename']); + if (!empty($cropped)) { + if ($should_delete) { + @unlink($currentFilePathInfo['dirname'] . DIRECTORY_SEPARATOR . $currentFilePathInfo['basename']); } - if(!@copy($cropped, $retina_file)) { + if (!@copy($cropped, $retina_file)) { $_error = true; } - if(!@unlink($cropped)) { + if (!@unlink($cropped)) { $_error = true; } - } + } } - add_action( 'crop_thumbnails_after_crop', 'add_retina_for_cropped_thumbnails', 10, 4 ); + add_action('crop_thumbnails_after_crop', 'add_retina_for_cropped_thumbnails', 10, 4); - function generate_retina_filename( $file, $suffix ) { - $dir = pathinfo( $file, PATHINFO_DIRNAME ); - $ext = pathinfo( $file, PATHINFO_EXTENSION ); - - $name = wp_basename( $file, ".$ext" ); + function generate_retina_filename($file, $suffix) + { + $dir = pathinfo($file, PATHINFO_DIRNAME); + $ext = pathinfo($file, PATHINFO_EXTENSION); + + $name = wp_basename($file, ".$ext"); $new_ext = $ext; - - return trailingslashit( $dir ) . "{$name}{$suffix}.{$new_ext}"; + + return trailingslashit($dir) . "{$name}{$suffix}.{$new_ext}"; } /** END CROP THUMBNAILS PLUGIN - RETINA SUPPORT */ - }); - - -?>