Server IP : 192.158.238.246 / Your IP : 3.18.105.157 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/jenniferflocom/www/wp-content/themes/simple-glassy/inc/ |
Upload File : |
<?php /** * Custom functions that act independently of the theme templates * * Eventually, some of the functionality here could be replaced by core features. * * @package SimpleGlassy */ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; add_filter( 'body_class', 'simpleglassy_body_classes' ); if ( ! function_exists( 'simpleglassy_body_classes' ) ) { /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * * @return array */ function simpleglassy_body_classes( $classes ) { // Fix long non-breaking texts $classes[] = 'text-break'; // Adds a class of group-blog to blogs with more than 1 published author. if ( is_multi_author() ) { $classes[] = 'group-blog'; } // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } return $classes; } } if ( function_exists( 'simpleglassy_adjust_body_class' ) ) { add_filter( 'body_class', 'simpleglassy_adjust_body_class' ); } /** * Display navigation to next/previous post when applicable. */ if ( ! function_exists( 'simpleglassy_post_nav' ) ) { function simpleglassy_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> <nav class="container-fluid navigation post-navigation my-3 bg-glassy rounded"> <h2 class="sr-only"><?php esc_html_e( 'Post navigation', 'simple-glassy' ); ?></h2> <div class="row nav-links"> <?php if ( get_previous_post_link() ) { previous_post_link( '<div class="col py-2 pl-2 pr-1 nav-previous"><i class="sgicon sgicon-angle-double-left" aria-hidden="true"></i> %link</div>', _x( '%title', 'Previous post link', 'simple-glassy' ) ); } if ( get_next_post_link() ) { next_post_link( '<div class="col py-2 pr-2 pl-1 nav-next text-right">%link <i class="sgicon sgicon-angle-double-right" aria-hidden="true"></i></div>', _x( '%title', 'Next post link', 'simple-glassy' ) ); } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php } } if ( ! function_exists( 'simpleglassy_pingback' ) ) { /** * Add a pingback url auto-discovery header for single posts of any post type. */ function simpleglassy_pingback() { if ( is_singular() && pings_open() ) { echo '<link rel="pingback" href="' . esc_url( get_bloginfo( 'pingback_url' ) ) . '">' . "\n"; } } } add_action( 'wp_head', 'simpleglassy_pingback' ); if ( ! function_exists( 'simpleglassy_mobile_web_app_meta' ) ) { /** * Add mobile-web-app meta. */ function simpleglassy_mobile_web_app_meta() { echo '<meta name="mobile-web-app-capable" content="yes">' . "\n"; echo '<meta name="apple-mobile-web-app-capable" content="yes">' . "\n"; echo '<meta name="apple-mobile-web-app-title" content="' . esc_attr( get_bloginfo( 'name' ) ) . ' - ' . esc_attr( get_bloginfo( 'description' ) ) . '">' . "\n"; } } add_action( 'wp_head', 'simpleglassy_mobile_web_app_meta' ); if ( ! function_exists( 'simpleglassy_default_body_attributes' ) ) { /** * Adds schema markup to the body element. * * @param array $atts An associative array of attributes. * @return array */ function simpleglassy_default_body_attributes( $atts ) { $atts['itemscope'] = ''; $atts['itemtype'] = 'http://schema.org/WebSite'; return $atts; } } add_filter( 'simpleglassy_body_attributes', 'simpleglassy_default_body_attributes' ); add_filter( 'the_password_form', 'simpleglassy_password_form' ); if ( ! function_exists( 'simpleglassy_password_form' ) ) { /** * Customize input form of password protected page. */ function simpleglassy_password_form( $form = '' ) { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $form = '<p>' . __( 'This content is password protected. To view it please enter the password below:', 'simple-glassy' ) . '</p> <form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post" class="form-inline"> <label for="' . esc_attr( $label ) . '" class="sr-only">' . __( 'Password', 'simple-glassy' ) . '</label><input name="post_password" id="' . esc_attr( $label ) . '" placeholder="' . esc_attr__( 'Password', 'simple-glassy' ) . '" type="password" size="20" maxlength="20" class="form-control w-auto mr-1" /><input type="submit" name="Submit" value="' . esc_attr__( 'Submit', 'simple-glassy' ) . '" class="btn btn-primary" /> </form> '; return $form; } } function simpleglassy_custom_logo_output( $html ) { $html = str_replace( 'custom-logo-link', 'custom-logo-link mr-sm-3', $html ); return $html; } add_filter( 'get_custom_logo', 'simpleglassy_custom_logo_output', 10 ); // Escapes all occurances of 'the_archive_description'. add_filter( 'get_the_archive_description', 'simpleglassy_escape_the_archive_description' ); if ( ! function_exists( 'simpleglassy_escape_the_archive_description' ) ) { /** * Escapes the description for an author or post type archive. * * @param string $description Archive description. * @return string Maybe escaped $description. */ function simpleglassy_escape_the_archive_description( $description ) { if ( is_author() || is_post_type_archive() ) { return wp_kses_post( $description ); } /* * All other descriptions are retrieved via term_description() which returns * a sanitized description. */ return $description; } } // End of if function_exists( 'simpleglassy_escape_the_archive_description' ). // Escapes all occurances of 'the_title()' and 'get_the_title()'. add_filter( 'the_title', 'simpleglassy_kses_title' ); // Escapes all occurances of 'the_archive_title' and 'get_the_archive_title()'. add_filter( 'get_the_archive_title', 'simpleglassy_kses_title' ); if ( ! function_exists( 'simpleglassy_kses_title' ) ) { /** * Sanitizes data for allowed HTML tags for post title. * * @param string $data Post title to filter. * @return string Filtered post title with allowed HTML tags and attributes intact. */ function simpleglassy_kses_title( $data ) { // Tags not supported in HTML5 are not allowed. $allowed_tags = array( 'abbr' => array(), 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'b' => array(), 'bdo' => array( 'dir' => true, ), 'blockquote' => array( 'cite' => true, 'lang' => true, 'xml:lang' => true, ), 'cite' => array( 'dir' => true, 'lang' => true, ), 'dfn' => array(), 'em' => array(), 'i' => array( 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, ), 'code' => array(), 'del' => array( 'datetime' => true, ), 'ins' => array( 'datetime' => true, 'cite' => true, ), 'kbd' => array(), 'mark' => array(), 'pre' => array( 'width' => true, ), 'q' => array( 'cite' => true, ), 's' => array(), 'samp' => array(), 'span' => array( 'dir' => true, 'align' => true, 'lang' => true, 'xml:lang' => true, ), 'small' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'u' => array(), 'var' => array(), ); $allowed_tags = apply_filters( 'simpleglassy_kses_title', $allowed_tags ); return wp_kses( $data, $allowed_tags ); } } // End of if function_exists( 'simpleglassy_kses_title' ).