From d900378173829480110634dee263a310d2c4906a Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 26 Aug 2023 02:49:10 +0100 Subject: [PATCH] All: Remove remnants of "twentyeleven" theme This theme was developed by forking the built-in "twentyeleven" theme. Not much was left of it, other than: * confusing function name prefixes * unused apply_filters() hoook. * unused utility functions. I've converted hooks to inline closures, and utility functions to the jq_ prefix and moved to the appropiate file. --- themes/jquery/author.php | 2 +- themes/jquery/comments.php | 2 +- themes/jquery/content-single.php | 4 +- themes/jquery/content.php | 2 +- themes/jquery/functions.php | 90 ++++++++------------------------ themes/jquery/image.php | 2 +- themes/jquery/sidebar-footer.php | 2 +- 7 files changed, 29 insertions(+), 75 deletions(-) diff --git a/themes/jquery/author.php b/themes/jquery/author.php index 7b753c7b..ead7e832 100755 --- a/themes/jquery/author.php +++ b/themes/jquery/author.php @@ -38,7 +38,7 @@ if ( get_the_author_meta( 'description' ) ) : ?>
- +

diff --git a/themes/jquery/comments.php b/themes/jquery/comments.php index 5582afe5..3635b766 100755 --- a/themes/jquery/comments.php +++ b/themes/jquery/comments.php @@ -16,7 +16,7 @@
    - 'twentyeleven_comment' ) ); ?> + 'jq_comment' ) ); ?>
1 && get_option( 'page_comments' ) ) : ?> diff --git a/themes/jquery/content-single.php b/themes/jquery/content-single.php index c500474c..dd5bd251 100755 --- a/themes/jquery/content-single.php +++ b/themes/jquery/content-single.php @@ -8,7 +8,7 @@
@@ -48,7 +48,7 @@
- +

diff --git a/themes/jquery/content.php b/themes/jquery/content.php index 0d9a490c..f07ecd1d 100755 --- a/themes/jquery/content.php +++ b/themes/jquery/content.php @@ -27,7 +27,7 @@ diff --git a/themes/jquery/functions.php b/themes/jquery/functions.php index e2d67b86..46595ec2 100755 --- a/themes/jquery/functions.php +++ b/themes/jquery/functions.php @@ -5,24 +5,16 @@ * For more information on hooks, actions, and filters, see https://codex.wordpress.org/Plugin_API. */ -require_once( 'functions.jquery.php' ); +require_once 'functions.jquery.php'; /** * Set the content width based on the theme's design and stylesheet. */ -if ( ! isset( $content_width ) ) +if ( !isset( $content_width ) ) { $content_width = 584; +} -/** - * Tell WordPress to run twentyeleven_setup() when the 'after_setup_theme' hook is run. - */ -add_action( 'after_setup_theme', 'twentyeleven_setup' ); - -if ( ! function_exists( 'twentyeleven_setup' ) ): -/** - * Sets up theme defaults and registers support for various WordPress features. - */ -function twentyeleven_setup() { +add_action( 'after_setup_theme', function () { // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); @@ -31,55 +23,38 @@ function twentyeleven_setup() { // This theme uses wp_nav_menu() in one location. register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) ); -} -endif; // twentyeleven_setup +} ); /** * Returns a "Continue Reading" link for excerpts */ -function twentyeleven_continue_reading_link() { +function jq_continue_reading_link() { return ' ' . __( 'Continue reading ', 'twentyeleven' ) . ''; } /** - * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyeleven_continue_reading_link(). + * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis + * and jq_continue_reading_link(). * * To override this in a child theme, remove the filter and add your own * function tied to the excerpt_more filter hook. */ -function twentyeleven_auto_excerpt_more( $more ) { - return ' …' . twentyeleven_continue_reading_link(); -} -add_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' ); - -/** - * Adds a pretty "Continue Reading" link to custom post excerpts. - * - * To override this link in a child theme, remove the filter and add your own - * function tied to the get_the_excerpt filter hook. - */ -function twentyeleven_custom_excerpt_more( $output ) { - if ( has_excerpt() && ! is_attachment() ) { - $output .= twentyeleven_continue_reading_link(); - } - return $output; -} -// add_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' ); +add_filter( 'excerpt_more', function ( $more ) { + return ' …' . jq_continue_reading_link(); +} ); /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. */ -function twentyeleven_page_menu_args( $args ) { +add_filter( 'wp_page_menu_args', function ( $args ) { $args['show_home'] = true; return $args; -} -add_filter( 'wp_page_menu_args', 'twentyeleven_page_menu_args' ); +} ); /** * Register our sidebars and widgetized areas. Also register the default Epherma widget. */ -function twentyeleven_widgets_init() { - +add_action( 'widgets_init', function () { register_sidebar( array( 'name' => __( 'Main Sidebar', 'twentyeleven' ), 'id' => 'sidebar-1', @@ -128,28 +103,12 @@ function twentyeleven_widgets_init() { 'before_title' => '

', 'after_title' => '

', ) ); -} -add_action( 'widgets_init', 'twentyeleven_widgets_init' ); - -/** - * Display navigation to next/previous pages when applicable - */ -function twentyeleven_content_nav( $nav_id ) { - global $wp_query; - - if ( $wp_query->max_num_pages > 1 ) : ?> - - comment_type ) : case 'pingback' : @@ -241,14 +199,12 @@ function twentyeleven_comment( $comment, $args, $depth ) { break; endswitch; } -endif; // ends check for twentyeleven_comment() -if ( ! function_exists( 'twentyeleven_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. - * Create your own twentyeleven_posted_on to override in a child theme + * Create your own jq_posted_on to override in a child theme */ -function twentyeleven_posted_on() { +function jq_posted_on() { printf( __( 'Posted on by ', 'twentyeleven' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), @@ -259,14 +215,13 @@ function twentyeleven_posted_on() { esc_html( get_the_author() ) ); } -endif; /** * Adds two classes to the array of body classes. * The first is if the site has only had one author with published posts. * The second is if a singular post being displayed */ -function twentyeleven_body_classes( $classes ) { +add_filter( 'body_class', function ( $classes ) { if ( ! is_multi_author() ) { $classes[] = 'single-author'; @@ -276,5 +231,4 @@ function twentyeleven_body_classes( $classes ) { $classes[] = 'singular'; return $classes; -} -add_filter( 'body_class', 'twentyeleven_body_classes' ); +} ); diff --git a/themes/jquery/image.php b/themes/jquery/image.php index 7c70b244..e7741469 100755 --- a/themes/jquery/image.php +++ b/themes/jquery/image.php @@ -67,7 +67,7 @@ } ?> ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height. ?> diff --git a/themes/jquery/sidebar-footer.php b/themes/jquery/sidebar-footer.php index 3f2864f9..845365aa 100755 --- a/themes/jquery/sidebar-footer.php +++ b/themes/jquery/sidebar-footer.php @@ -17,7 +17,7 @@ return; // If we get this far, we have widgets. Let do this. ?> -
> +
>