300,
'height' => 300,
'flex-width' => false,
'flex-height' => false,
'header-text' => array(
'site-title',
'site-description',
),
'unlink-homepage-logo' => true,
)
);
// Register the main menu.
register_nav_menus(
array(
'primary' => __( 'Primary Menu', 'marianne' ),
'footer' => __( 'Footer Menu', 'marianne' ),
)
);
/*
* Enable support for Post Thumbnails on posts and pages
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*
* @since Marianne 1.1
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'marianne-thumbnails', absint( $marianne_page_width ) );
add_image_size( 'marianne-thumbnails-retina', ( absint( $marianne_page_width ) * 2 ) );
// Add support for responsive oEmbed content.
add_theme_support( 'responsive-embeds' );
// HTML5 support.
add_theme_support(
'html5',
array(
'caption',
'comment-form',
'comment-list',
'gallery',
'navigation-widgets',
'script',
'search-form',
'style',
)
);
}
add_action( 'after_setup_theme', 'marianne_setup' );
}
if ( ! function_exists( 'marianne_environment_type' ) ) {
/**
* Get or set the environment type.
*
* @link https://developer.wordpress.org/reference/functions/wp_get_environment_type/
*
* @return string The environment type.
*/
function marianne_environment_type() {
if ( function_exists( 'wp_get_environment_type' ) ) {
$environment_type = wp_get_environment_type();
} else {
$environment_type = 'production';
}
return $environment_type;
}
}
if ( ! function_exists( 'marianne_minify' ) ) {
/**
* Displays ".min" if the environment is set to "production".
*
* @return string Returns ".min" or nothing.
*/
function marianne_minify() {
$environment_type = marianne_environment_type();
if ( 'production' === $environment_type ) {
$min = '.min';
} else {
$min = '';
}
return $min;
}
}
if ( ! function_exists( 'marianne_styles_scripts' ) ) {
/**
* Enqueues scripts and styles.
*
* On production, minified files are enqueued.
*
* @return void
*/
function marianne_styles_scripts() {
$theme_version = wp_get_theme()->get( 'Version' );
$min = marianne_minify();
/**
* Use Google Fonts stylesheet when a Google Font is selected.
*
* @since Marianne 1.8
*/
$marianne_font = marianne_font();
if ( $marianne_font['url'] && 'none' !== $marianne_font['url'] ) {
wp_enqueue_style( 'marianne-fonts-google', $marianne_font['url'] . '&display=swap', array(), $theme_version );
}
// The main stylesheet.
wp_enqueue_style( 'marianne-stylesheet', get_template_directory_uri() . "/style$min.css", array(), $theme_version );
/**
* The main menu navigation script.
*
* @since Marianne 1.2
*/
wp_enqueue_script( 'marianne-navigation', get_template_directory_uri() . "/assets/js/navigation$min.js", array( 'jquery' ), $theme_version, true );
// Threaded comment reply styles.
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'marianne_styles_scripts' );
}
if ( ! function_exists( 'marianne_head_meta' ) ) {
/**
* Adds meta in head.
*
* @return void
*/
function marianne_head_meta() {
?>
__( 'Widgets', 'marianne' ),
'id' => 'widgets',
'before_widget' => '',
'before_title' => '
',
)
);
}
add_action( 'widgets_init', 'marianne_widgets' );
}
if ( ! function_exists( 'marianne_add_sub_menu_toggle' ) ) {
/**
* Adds a button to top-level menu items that has sub-menus.
* An icon is added using CSS depending on the value of aria-expanded.
*
* Based on the work of the WordPress team in the Twenty Twenty-One Theme.
*
* @param string $output Nav menu item start element.
* @param object $item Nav menu item.
* @param int $depth Depth.
* @param object $args Nav menu args.
*
* @return string Nav menu item start element.
*/
function marianne_add_sub_menu_toggle( $output, $item, $depth, $args ) {
if ( 0 === $depth && in_array( 'menu-item-has-children', $item->classes, true ) && 'primary' === $args->theme_location ) {
// Adds toggle button.
$output .= '';
}
return $output;
}
add_filter( 'walker_nav_menu_start_el', 'marianne_add_sub_menu_toggle', 10, 4 );
}
if ( ! function_exists( 'marianne_add_class' ) ) {
/**
* Adds class attribute.
*
* @param string $classes Classes to add.
* @param bool $space_before If true, adds a space before the attribute.
*
* @return void
*
* @since Marianne 1.3
*/
function marianne_add_class( $classes = '', $space_before = true ) {
if ( true === $space_before ) {
echo ' ';
}
echo 'class="' . esc_attr( $classes ) . '"';
}
}
if ( ! function_exists( 'marianne_svg_icons' ) ) {
/**
* SVG shapes for social icons.
*
* @param string $name The id of the icon.
*
* @return array $svg_data The SVG image data.
*
* @since Marianne 1.3
*/
function marianne_svg_icons( $name = '' ) {
$svg_data = array(
'name' => '',
'shapes' => '',
'viewbox' => '0 0 24 24',
);
switch ( $name ) {
case '500px':
$svg_data['name'] = _x( '500px', 'The name of the photography site.', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'apple_podcasts':
$svg_data['name'] = __( 'Apple Podcasts', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'chevron-up':
$svg_data['name'] = 'chevron-up';
$svg_data['shapes'] = '';
break;
case 'chevron-down':
$svg_data['name'] = 'chevron-down';
$svg_data['shapes'] = '';
break;
case 'diaspora':
$svg_data['name'] = __( 'Diaspora', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'email':
$svg_data['name'] = __( 'Email', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'facebook':
$svg_data['name'] = __( 'Facebook', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'flickr':
$svg_data['name'] = __( 'Flickr', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'github':
$svg_data['name'] = __( 'GitHub', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'gitlab':
$svg_data['name'] = __( 'GitLab', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'instagram':
$svg_data['name'] = __( 'Instagram', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'link':
$svg_data['name'] = __( 'Link', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'linkedin':
$svg_data['name'] = __( 'LinkedIn', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'mastodon':
$svg_data['name'] = __( 'Mastodon', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'medium':
$svg_data['name'] = __( 'Medium', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'phone':
$svg_data['name'] = __( 'Phone', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'reddit':
$svg_data['name'] = __( 'Reddit', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'rss':
$svg_data['name'] = __( 'RSS Feed', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'signal':
$svg_data['name'] = __( 'Signal', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'soundcloud':
$svg_data['name'] = __( 'SoundCloud', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'spotify':
$svg_data['name'] = __( 'Spotify', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'tiktok':
$svg_data['name'] = __( 'TikTok', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'telegram':
$svg_data['name'] = __( 'Telegram', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'twitch':
$svg_data['name'] = __( 'Twitch', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'twitter':
$svg_data['name'] = __( 'Twitter', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'vimeo':
$svg_data['name'] = __( 'Vimeo', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'vk':
$svg_data['name'] = __( 'VK', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'whatsapp':
$svg_data['name'] = __( 'WhatsApp', 'marianne' );
$svg_data['shapes'] = '';
break;
case 'youtube':
$svg_data['name'] = __( 'YouTube', 'marianne' );
$svg_data['shapes'] = '';
break;
}
return $svg_data;
}
}
if ( ! function_exists( 'marianne_esc_svg' ) ) {
/**
* Escapes shapes for SVG image.
*
* Returns allowed SVG path attributes only and remove others.
*
* @link https://www.w3.org/TR/SVG2/shapes.html
*
* @param string $input SVG HTML to escape.
*
* @return string $output Escaped SVG.
*
* @since Marianne 1.3
*/
function marianne_esc_svg( $input = '' ) {
$allowed_html = array(
'svg' => array(
'xmlns' => array(),
'role' => array(),
'class' => array(),
'id' => array(),
'viewbox' => array(),
'width' => array(),
'height' => array(),
'aria-label' => array(),
),
'title' => array(),
'circle' => array(
'cx' => array(),
'cy' => array(),
'r' => array(),
),
'line' => array(
'x1' => array(),
'y1' => array(),
'x2' => array(),
'y2' => array(),
),
'path' => array(
'd' => array(),
'fill' => array(),
),
'polygon' => array(
'points' => array(),
),
'polyline' => array(
'points' => array(),
),
'rect' => array(
'x' => array(),
'y' => array(),
'width' => array(),
'height' => array(),
'rx' => array(),
'ry' => array(),
),
);
$output = wp_kses( $input, $allowed_html );
return $output;
}
}
if ( ! function_exists( 'marianne_svg' ) ) {
/**
* Converts a Twitter username into a Twitter URL.
*
* @param string $shapes SVG shapes to displays.
* @param array $args Parameters to set.
* $args = array(
* 'class' => 'string' The class of the SVG image.
* Default: 'simple-icons'.
* 'size' => (array) The size of the image (width, height).
* Default: array( 18, 18 ).
* 'viewbox' => (string) The viewBox attribute to add to the image.
* Default: '0 0 24 24'.
* 'echo' => (bool) Whether to return or echo the SVG image.
* Default: true.
* 'aria_label' => (string) Label the image.
* Default: ''.
*
* @return string|void $svg The SVG HTML.
*
* @since Marianne 1.3
*/
function marianne_svg( $shapes = '', $args = array() ) {
if ( is_array( $args ) && ! empty( $args ) ) {
$class = isset( $args['class'] ) ? $args['class'] : 'simple-icons';
$size = isset( $args['size'] ) ? $args['size'] : array( 18, 18 );
$viewbox = isset( $args['viewbox'] ) ? $args['viewbox'] : '0 0 24 24';
if ( isset( $args['echo'] ) && is_bool( $args['echo'] ) ) {
$echo = $args['echo'];
} else {
$echo = true;
}
$aria_label = isset( $args['aria-label'] ) ? $args['aria-label'] : '';
}
$svg = '';
return $svg;
}
}
// Loads required files.
require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/customizer.php';
require get_template_directory() . '/inc/custom-styles.php';
require get_template_directory() . '/inc/marianne-theme-page.php';
require get_template_directory() . '/inc/classes/class-marianne-customizer-control-slider.php';
require get_template_directory() . '/inc/classes/class-marianne-customizer-section-about.php';