'https://fonts.gstatic.com', 'crossorigin', ); } return $urls; } add_filter( 'wp_resource_hints', 'inspiro_resource_hints', 10, 2 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function inspiro_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'inspiro' ), 'id' => 'sidebar', 'description' => __( 'Main sidebar that is displayed on the right and can be toggled by clicking on the menu icon.', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Blog Sidebar', 'inspiro' ), 'id' => 'blog-sidebar', 'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 1', 'inspiro' ), 'id' => 'footer_1', 'description' => __( 'Add widgets here to appear in your footer.', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 2', 'inspiro' ), 'id' => 'footer_2', 'description' => __( 'Add widgets here to appear in your footer.', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 3', 'inspiro' ), 'id' => 'footer_3', 'description' => __( 'Add widgets here to appear in your footer.', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 4', 'inspiro' ), 'id' => 'footer_4', 'description' => __( 'Add widgets here to appear in your footer.', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Header Social Icons', 'inspiro' ), 'id' => 'header_social', 'description' => __( 'Widget area in the header. Install the "Social Icons Widget by WPZOOM" plugin and add the widget here.', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Instagram Bar', 'inspiro' ), 'id' => 'footer_instagram_section', 'description' => __( 'Widget area for "Instagram widget by WPZOOM".', 'inspiro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'inspiro_widgets_init' ); /** * Replaces "[...]" (appended to automatically generated excerpts) with ... and * a 'Read more' link. * * @since Inspiro 1.0.0 * * @param string $link Link to single post/page. * @return string 'Read more' link prepended with an ellipsis. */ function inspiro_excerpt_more( $link ) { if ( is_admin() ) { return $link; } $link = sprintf( '', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Post title. */ sprintf( __( 'Read more "%s"', 'inspiro' ), get_the_title( get_the_ID() ) ) ); return ' … ' . $link; } add_filter( 'excerpt_more', 'inspiro_excerpt_more' ); /** * Filters the `sizes` value in the header image markup. * * @since Inspiro 1.0.0 * * @param string $html The HTML image tag markup being filtered. * @param object $header The custom header object returned by 'get_custom_header()'. * @param array $attr Array of the attributes for the image tag. * @return string The filtered header image HTML. */ function inspiro_header_image_tag( $html, $header, $attr ) { if ( isset( $attr['sizes'] ) ) { $html = str_replace( $attr['sizes'], '100vw', $html ); } return $html; } add_filter( 'get_header_image_tag', 'inspiro_header_image_tag', 10, 3 ); /** * Add custom image sizes attribute to enhance responsive image functionality * for post thumbnails. * * @since Inspiro 1.0.0 * * @param array $attr Attributes for the image markup. * @param int $attachment Image attachment ID. * @param array $size Registered image size or flat array of height and width dimensions. * @return array The filtered attributes for the image markup. */ function inspiro_post_thumbnail_sizes_attr( $attr, $attachment, $size ) { if ( is_archive() || is_search() || is_home() ) { $attr['sizes'] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px'; } else { $attr['sizes'] = '100vw'; } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'inspiro_post_thumbnail_sizes_attr', 10, 3 ); /** * Modifies tag cloud widget arguments to display all tags in the same font size * and use list format for better accessibility. * * @since Inspiro 1.0.0 * * @param array $args Arguments for tag cloud widget. * @return array The filtered arguments for tag cloud widget. */ function inspiro_widget_tag_cloud_args( $args ) { $args['largest'] = 1; $args['smallest'] = 1; $args['unit'] = 'em'; $args['format'] = 'list'; return $args; } add_filter( 'widget_tag_cloud_args', 'inspiro_widget_tag_cloud_args' ); /** * Gets unique ID. * * This is a PHP implementation of Underscore's uniqueId method. A static variable * contains an integer that is incremented with each call. This number is returned * with the optional prefix. As such the returned value is not universally unique, * but it is unique across the life of the PHP process. * * @since Inspiro 1.0.0 * * @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead. * * @param string $prefix Prefix for the returned ID. * @return string Unique ID. */ function inspiro_unique_id( $prefix = '' ) { static $id_counter = 0; if ( function_exists( 'wp_unique_id' ) ) { return wp_unique_id( $prefix ); } return $prefix . (string) ++$id_counter; } /** * Show custom logo or blog title and description (backward compatibility) */ function inspiro_custom_logo() { has_custom_logo() ? the_custom_logo() : printf( '%3$s', esc_url( home_url() ), esc_html( get_bloginfo( 'description' ) ), esc_html( inspiro_get_theme_mod( 'custom_logo_text' ) ) ); } /** * Displays the sidebar after the openning tag. */ function display_sidebar_body_open() { get_sidebar(); } add_action( 'wp_body_open', 'display_sidebar_body_open' ); if ( ! function_exists( 'inspiro_comment' ) ) { /** * Custom Comments Template * * @param string $comment Comment text. * @param array $args Comment args. * @param boolean $depth Comment depth. * @return void */ function inspiro_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited switch ( $comment->comment_type ) : case '': case 'comment': ?>
  • id="li-comment-">
    %s', get_comment_author_link() ); ?>
    comment_approved ) : ?>
  • _x( 'Inspiro', 'Block pattern category', 'inspiro' ) ) ); } } add_action( 'init', 'inspiro_register_block_categories' ); /** * Register Block Patterns * * @return void */ function inspiro_register_block_patterns() { if ( class_exists( 'WP_Block_Patterns_Registry' ) ) { register_block_pattern( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_pattern 'inspiro/homepage', array( 'title' => __( 'Homepage', 'inspiro' ), 'description' => _x( 'A call to action with a beautiful two-column gallery below.', 'Block pattern description', 'inspiro' ), 'content' => "\n

    This is some dummy copy. You’re not really supposed to read this dummy copy, it is just a placeholder for people who need some type to visualize what the actual copy might look like if it were real content.

    \n\n\n\n
    \n\n\n\n
    \n
    \n
    \n

    About us

    \n\n\n\n

    This is some dummy copy. You’re not really supposed to read this dummy copy, it is just a placeholder for people who need some type to visualize what the actual copy might look like if it were real content.

    \n\n\n\n\n\n\n\n

    \n
    \n\n\n\n
    \n
    \n\n\n\n
    \"\"
    \n
    \n
    \n
    \n\n\n\n
    \n
    \n
    \n
    \n\n\n\n
    \"\"
    \n
    \n\n\n\n
    \n

    Our Services

    \n\n\n\n

    This is some dummy copy. You’re not really supposed to read this dummy copy, it is just a placeholder for people who need some type to visualize what the actual copy might look like if it were real content.

    \n\n\n\n\n
    \n
    \n
    \n\n\n\n
    \n

    Gallery

    \n\n\n\n\n
    \n\n\n\n
    \n

    Unleash your creativity with Inspiro

    \n\n\n\n

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

    \n\n\n\n
    \n\n\n\n\n
    \n", 'categories' => array( 'inspiro' ), ) ); register_block_pattern( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_pattern 'inspiro/full-section', array( 'title' => __( 'Full-width section', 'inspiro' ), 'description' => _x( 'A call to action with a beautiful two-column gallery below.', 'Block pattern description', 'inspiro' ), 'content' => "\n
    \n
    \n
    \n

    About us

    \n\n\n\n

    This is some dummy copy. You’re not really supposed to read this dummy copy, it is just a placeholder for people who need some type to visualize what the actual copy might look like if it were real content.

    \n\n\n\n\n\n\n\n

    \n
    \n\n\n\n
    \n
    \n\n\n\n
    \"\"
    \n
    \n
    \n
    \n", 'categories' => array( 'inspiro' ), ) ); } } add_action( 'init', 'inspiro_register_block_patterns' );