Beruflich Dokumente
Kultur Dokumente
php
/**
* argent functions and definitions
*
* @package Argent
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 780; /* pixels */
}
if ( ! function_exists( 'argent_content_width' ) ) :
function argent_content_width() {
global $content_width;
if ( is_singular( 'post' ) ) {
$content_width = 490;
}
}
add_action( 'template_redirect', 'argent_content_width' );
endif;
if ( ! function_exists( 'argent_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function argent_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on argent, use a find and replace
* to change 'argent' to the name of your theme in all the template file
s
*/
load_theme_textdomain( 'argent', get_template_directory() . '/languages'
);
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
add_editor_style( array( 'editor-style.css', argent_fonts_url() ) );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
'name'
=> esc_html__( 'Footer Two', 'argent' ),
'id'
=> 'sidebar-2',
'description' => esc_html__( 'Use this widget area to display
widgets in the second column of the footer.', 'argent' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar( array(
'name'
=> esc_html__( 'Footer Three', 'argent' ),
'id'
=> 'sidebar-3',
'description' => esc_html__( 'Use this widget area to display
widgets in the third column of the footer.', 'argent' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
}
add_action( 'widgets_init', 'argent_widgets_init' );
/**
* Register Google Fonts
*/
function argent_fonts_url() {
$fonts_url = '';
$fonts
= array();
$subsets = 'latin,latin-ext';
/*
* Translators: If there are characters in your language that are not su
pported
* by Noto Sans, translate this to 'off'. Do not translate into your own
language.
*/
if ( 'off' !== _x( 'on', 'Cabin
font: on or off', 'argent' ) ) {
$fonts[] = 'Cabin:500,700,500italic,700italic';
}
/*
* Translators: If there are characters in your language that are not su
pported
* by Noto Serif, translate this to 'off'. Do not translate into your ow
n language.
*/
if ( 'off' !== _x( 'on', 'Alegreya font: on or off', 'argent' ) ) {
$fonts[] = 'Alegreya:400,700,400italic,700italic';
}
/*
* Translators: To add an additional character subset specific to your l
anguage,
* translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'.
Do not translate into your own language.
*/
$subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari,
vietnamese)', 'argent' );
if ( 'cyrillic' == $subset ) {
$subsets .= ',cyrillic,cyrillic-ext';
} elseif ( 'greek' == $subset ) {
$subsets .= ',greek,greek-ext';
} elseif ( 'devanagari' == $subset ) {
$subsets .= ',devanagari';
} elseif ( 'vietnamese' == $subset ) {
$subsets .= ',vietnamese';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
/**
* Enqueue scripts and styles.
*/
function argent_scripts() {
wp_enqueue_style( 'argent-style', get_stylesheet_uri() );
wp_enqueue_style( 'argent-fonts', argent_fonts_url(), array(), null );
wp_enqueue_script( 'argent-js', get_template_directory_uri() . '/js/arge
nt.js', array( 'jquery' ), '20150326', true );
wp_enqueue_script( 'argent-navigation', get_template_directory_uri() . '
/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'argent-skip-link-focus-fix', get_template_directory_
uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( 'jetpack-portfolio' == get_post_type() && argent_get_gallery() ) {
wp_enqueue_style( 'argent-slick-css', get_template_directory_uri
() . '/js/slick/slick.css' );
wp_enqueue_script( 'argent-slick-js', get_template_directory_uri
() . '/js/slick/slick.js', array( 'jquery' ), '1.4.1', true );
}
if ( is_singular() && comments_open() && get_option( 'thread_comments' )
) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'argent_scripts' );
function argent_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'argent_excerpt_length', 999 );
/**
* Add 'Read more' link to excerpts
*/
function argent_excerpt_more( $excerpt ) {