Skip to content

Commit

Permalink
Fix simple liniting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gin0115 committed Dec 2, 2024
1 parent 1a1eeec commit b006789
Showing 1 changed file with 42 additions and 16 deletions.
58 changes: 42 additions & 16 deletions themes/osi/inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
*
* @return array
*/
function osi_body_classes( $classes ) {
Expand All @@ -31,6 +32,8 @@ function osi_body_classes( $classes ) {

/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*
* @return void
*/
function osi_pingback_header() {
if ( is_singular() && pings_open() ) {
Expand All @@ -41,9 +44,11 @@ function osi_pingback_header() {


/**
* Gets rid of current_page_parent class mistakenly being applied to Blog pages while on Custom Post Types
* via https://wordpress.org/support/topic/post-type-and-its-children-show-blog-as-the-current_page_parent
*/
* Gets rid of current_page_parent class mistakenly being applied to Blog pages while on Custom Post Types
* via https://wordpress.org/support/topic/post-type-and-its-children-show-blog-as-the-current_page_parent
*
* @return boolean
*/
function is_blog() {
global $post;
$posttype = get_post_type( $post );
Expand All @@ -70,6 +75,12 @@ function fix_blog_link_on_cpt( $classes, $item, $args ) {
* Use <figure> and <figcaption>
*
* @link http://justintadlock.com/archives/2011/07/01/captions-in-wordpress
*
* @param string $output The caption output. Default empty.
* @param array $attr Attributes of the caption shortcode.
* @param string $content The image element output.
*
* @return string
*/
function osi_caption( $output, $attr, $content ) {
if ( is_feed() ) {
Expand Down Expand Up @@ -105,8 +116,12 @@ function osi_caption( $output, $attr, $content ) {


/**
* remove width attribute of thumbnails
*/
* remove width attribute of thumbnails
*
* @param string $html The HTML content.
*
* @return string
*/
function osi_remove_width_attribute( $html ) {
$html = preg_replace( '/(width|height)="\d*"\s/', '', $html );
return $html;
Expand All @@ -115,9 +130,13 @@ function osi_remove_width_attribute( $html ) {
add_filter( 'image_send_to_editor', 'osi_remove_width_attribute', 10 );

/**
* From http://wordpress.stackexchange.com/questions/115368/overide-gallery-default-link-to-settings
* Default image links in gallery (not the same as image_default_link_type)
*/
* From http://wordpress.stackexchange.com/questions/115368/overide-gallery-default-link-to-settings
* Default image links in gallery (not the same as image_default_link_type)
*
* @param array $settings
*
* @return array
*/
function osi_gallery_default_type_set_link( $settings ) {
$settings['galleryDefaults']['link'] = 'file';
return $settings;
Expand All @@ -126,14 +145,16 @@ function osi_gallery_default_type_set_link( $settings ) {


/**
* Remove the overly opinionated gallery styles
*/
* Remove the overly opinionated gallery styles
*/
add_filter( 'use_default_gallery_style', '__return_false' );


/**
* Inline Media Default assert_options
*/
* Inline Media Default assert_options
*
* @return string
*/
function osi_inline_media_styles() {
$styles = '';
if ( get_custom_header() ) {
Expand All @@ -144,6 +165,8 @@ function osi_inline_media_styles() {

/**
* Check if we're on the license search page
*
* @return boolean
*/
if ( ! function_exists( 'is_license_search' ) ) {

Expand All @@ -159,6 +182,8 @@ function is_license_search() {

/**
* Get the license search query
*
* @return string
*/
if ( ! function_exists( 'get_license_search_query' ) ) {

Expand Down Expand Up @@ -205,9 +230,10 @@ function osi_press_mentions_by_publication_date( $query ) {
}

/**
* Renders the "Created" and "Last modified" string for a page.
*/

* Renders the "Created" and "Last modified" string for a page.
*
* @return void
*/
function osi_the_page_dates() {
if ( is_page() && ! is_home() && ! is_front_page() ) {
$max_date = '2023-02-01'; // February 1, 2023
Expand Down Expand Up @@ -311,7 +337,7 @@ function osi_supporters_shortcode_renderer( array $args = array() ) {
$output .= '</div>';
$output .= '</div>';
}
wp_reset_query(); // Reset the query to the original
wp_reset_postdata();
}

$output .= '</div>';
Expand Down

0 comments on commit b006789

Please sign in to comment.