mirror of
https://github.com/KevinMidboe/rohnenedre.git
synced 2026-02-14 13:29:20 +00:00
Initial commit. State 04.2021.
This commit is contained in:
126
wp-content/themes/professional/inc/custom-header.php
Normal file
126
wp-content/themes/professional/inc/custom-header.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* Sample implementation of the Custom Header feature
|
||||
* http://codex.wordpress.org/Custom_Headers
|
||||
*
|
||||
* You can add an optional custom header image to header.php like so ...
|
||||
|
||||
<?php if ( get_header_image() ) : ?>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
|
||||
<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
|
||||
</a>
|
||||
<?php endif; // End header image check. ?>
|
||||
|
||||
*
|
||||
* @package Professional
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup the WordPress core custom header feature.
|
||||
*
|
||||
* @uses professional_header_style()
|
||||
* @uses professional_admin_header_style()
|
||||
* @uses professional_admin_header_image()
|
||||
*/
|
||||
function professional_custom_header_setup() {
|
||||
add_theme_support( 'custom-header', apply_filters( 'professional_custom_header_args', array(
|
||||
'default-image' => '',
|
||||
'default-text-color' => '000000',
|
||||
'width' => 1000,
|
||||
'height' => 250,
|
||||
'flex-height' => true,
|
||||
'wp-head-callback' => 'professional_header_style',
|
||||
'admin-head-callback' => 'professional_admin_header_style',
|
||||
'admin-preview-callback' => 'professional_admin_header_image',
|
||||
) ) );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'professional_custom_header_setup' );
|
||||
|
||||
if ( ! function_exists( 'professional_header_style' ) ) :
|
||||
/**
|
||||
* Styles the header image and text displayed on the blog
|
||||
*
|
||||
* @see professional_custom_header_setup().
|
||||
*/
|
||||
function professional_header_style() {
|
||||
$header_text_color = get_header_textcolor();
|
||||
|
||||
// If no custom options for text are set, let's bail
|
||||
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
|
||||
if ( HEADER_TEXTCOLOR == $header_text_color ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we get this far, we have custom styles. Let's do this.
|
||||
?>
|
||||
<style type="text/css">
|
||||
<?php
|
||||
// Has the text been hidden?
|
||||
if ( 'blank' == $header_text_color ) :
|
||||
?>
|
||||
.site-title,
|
||||
.site-description {
|
||||
position: absolute;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
}
|
||||
<?php
|
||||
// If the user has set a custom color for the text use that
|
||||
else :
|
||||
?>
|
||||
.site-title a,
|
||||
.site-description {
|
||||
color: #<?php echo $header_text_color; ?>;
|
||||
}
|
||||
<?php endif; ?>
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
endif; // professional_header_style
|
||||
|
||||
if ( ! function_exists( 'professional_admin_header_style' ) ) :
|
||||
/**
|
||||
* Styles the header image displayed on the Appearance > Header admin panel.
|
||||
*
|
||||
* @see professional_custom_header_setup().
|
||||
*/
|
||||
function professional_admin_header_style() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
.appearance_page_custom-header #headimg {
|
||||
border: none;
|
||||
}
|
||||
#headimg h1,
|
||||
#desc {
|
||||
}
|
||||
#headimg h1 {
|
||||
}
|
||||
#headimg h1 a {
|
||||
}
|
||||
#desc {
|
||||
}
|
||||
#headimg img {
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
endif; // professional_admin_header_style
|
||||
|
||||
if ( ! function_exists( 'professional_admin_header_image' ) ) :
|
||||
/**
|
||||
* Custom header image markup displayed on the Appearance > Header admin panel.
|
||||
*
|
||||
* @see professional_custom_header_setup().
|
||||
*/
|
||||
function professional_admin_header_image() {
|
||||
$style = sprintf( ' style="color:#%s;"', get_header_textcolor() );
|
||||
?>
|
||||
<div id="headimg">
|
||||
<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<div class="displaying-header-text" id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
|
||||
<?php if ( get_header_image() ) : ?>
|
||||
<img src="<?php header_image(); ?>" alt="">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
endif; // professional_admin_header_image
|
||||
26
wp-content/themes/professional/inc/customizer.php
Normal file
26
wp-content/themes/professional/inc/customizer.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Professional Theme Customizer
|
||||
*
|
||||
* @package Professional
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add postMessage support for site title and description for the Theme Customizer.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
|
||||
*/
|
||||
function professional_customize_register( $wp_customize ) {
|
||||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
|
||||
}
|
||||
add_action( 'customize_register', 'professional_customize_register' );
|
||||
|
||||
/**
|
||||
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
function professional_customize_preview_js() {
|
||||
wp_enqueue_script( 'professional_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
|
||||
}
|
||||
add_action( 'customize_preview_init', 'professional_customize_preview_js' );
|
||||
89
wp-content/themes/professional/inc/extras.php
Normal file
89
wp-content/themes/professional/inc/extras.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Custom functions that act independently of the theme templates
|
||||
*
|
||||
* Eventually, some of the functionality here could be replaced by core features
|
||||
*
|
||||
* @package Professional
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
|
||||
*
|
||||
* @param array $args Configuration arguments.
|
||||
* @return array
|
||||
*/
|
||||
function professional_page_menu_args( $args ) {
|
||||
$args['show_home'] = true;
|
||||
return $args;
|
||||
}
|
||||
add_filter( 'wp_page_menu_args', 'professional_page_menu_args' );
|
||||
|
||||
/**
|
||||
* Adds custom classes to the array of body classes.
|
||||
*
|
||||
* @param array $classes Classes for the body element.
|
||||
* @return array
|
||||
*/
|
||||
function professional_body_classes( $classes ) {
|
||||
// Adds a class of group-blog to blogs with more than 1 published author.
|
||||
if ( is_multi_author() ) {
|
||||
$classes[] = 'group-blog';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
add_filter( 'body_class', 'professional_body_classes' );
|
||||
|
||||
/**
|
||||
* Filters wp_title to print a neat <title> tag based on what is being viewed.
|
||||
*
|
||||
* @param string $title Default title text for current view.
|
||||
* @param string $sep Optional separator.
|
||||
* @return string The filtered title.
|
||||
*/
|
||||
function professional_wp_title( $title, $sep ) {
|
||||
if ( is_feed() ) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
global $page, $paged;
|
||||
|
||||
// Add the blog name
|
||||
$title .= get_bloginfo( 'name', 'display' );
|
||||
|
||||
// Add the blog description for the home/front page.
|
||||
$site_description = get_bloginfo( 'description', 'display' );
|
||||
if ( $site_description && ( is_home() || is_front_page() ) ) {
|
||||
$title .= " $sep $site_description";
|
||||
}
|
||||
|
||||
// Add a page number if necessary:
|
||||
if ( $paged >= 2 || $page >= 2 ) {
|
||||
$title .= " $sep " . sprintf( __( 'Page %s', 'professional' ), max( $paged, $page ) );
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
add_filter( 'wp_title', 'professional_wp_title', 10, 2 );
|
||||
|
||||
/**
|
||||
* Sets the authordata global when viewing an author archive.
|
||||
*
|
||||
* This provides backwards compatibility with
|
||||
* http://core.trac.wordpress.org/changeset/25574
|
||||
*
|
||||
* It removes the need to call the_post() and rewind_posts() in an author
|
||||
* template to print information about the author.
|
||||
*
|
||||
* @global WP_Query $wp_query WordPress Query object.
|
||||
* @return void
|
||||
*/
|
||||
function professional_setup_author() {
|
||||
global $wp_query;
|
||||
|
||||
if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
|
||||
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
|
||||
}
|
||||
}
|
||||
add_action( 'wp', 'professional_setup_author' );
|
||||
19
wp-content/themes/professional/inc/jetpack.php
Normal file
19
wp-content/themes/professional/inc/jetpack.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Jetpack Compatibility File
|
||||
* See: http://jetpack.me/
|
||||
*
|
||||
* @package Professional
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add theme support for Infinite Scroll.
|
||||
* See: http://jetpack.me/support/infinite-scroll/
|
||||
*/
|
||||
function professional_jetpack_setup() {
|
||||
add_theme_support( 'infinite-scroll', array(
|
||||
'container' => 'main',
|
||||
'footer' => 'page',
|
||||
) );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'professional_jetpack_setup' );
|
||||
190
wp-content/themes/professional/inc/template-tags.php
Normal file
190
wp-content/themes/professional/inc/template-tags.php
Normal file
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
* Custom template tags for this theme.
|
||||
*
|
||||
* Eventually, some of the functionality here could be replaced by core features.
|
||||
*
|
||||
* @package Professional
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'professional_paging_nav' ) ) :
|
||||
/**
|
||||
* Display navigation to next/previous set of posts when applicable.
|
||||
*/
|
||||
function professional_paging_nav() {
|
||||
// Don't print empty markup if there's only one page.
|
||||
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<nav class="navigation paging-navigation" role="navigation">
|
||||
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'professional' ); ?></h1>
|
||||
<div class="nav-links">
|
||||
|
||||
<?php if ( get_next_posts_link() ) : ?>
|
||||
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'professional' ) ); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_previous_posts_link() ) : ?>
|
||||
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'professional' ) ); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div><!-- .nav-links -->
|
||||
</nav><!-- .navigation -->
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'professional_post_nav' ) ) :
|
||||
/**
|
||||
* Display navigation to next/previous post when applicable.
|
||||
*/
|
||||
function professional_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="navigation post-navigation" role="navigation">
|
||||
<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'professional' ); ?></h1>
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
previous_post_link( '<div class="nav-previous">%link</div>', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'professional' ) );
|
||||
next_post_link( '<div class="nav-next">%link</div>', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'professional' ) );
|
||||
?>
|
||||
</div><!-- .nav-links -->
|
||||
</nav><!-- .navigation -->
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'professional_posted_on' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the current post-date/time and author.
|
||||
*/
|
||||
function professional_posted_on() {
|
||||
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
|
||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||
$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
|
||||
}
|
||||
|
||||
$time_string = sprintf( $time_string,
|
||||
esc_attr( get_the_date( 'c' ) ),
|
||||
esc_html( get_the_date() ),
|
||||
esc_attr( get_the_modified_date( 'c' ) ),
|
||||
esc_html( get_the_modified_date() )
|
||||
);
|
||||
|
||||
printf( __( '<span class="posted-on"><i class="fa fa-calendar"></i> %1$s</span><span class="byline"> <i class="fa fa-user"></i> %2$s</span>', 'professional' ),
|
||||
sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
|
||||
esc_url( get_permalink() ),
|
||||
$time_string
|
||||
),
|
||||
sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
|
||||
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
|
||||
esc_html( get_the_author() )
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Returns true if a blog has more than 1 category.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function professional_categorized_blog() {
|
||||
if ( false === ( $all_the_cool_cats = get_transient( 'professional_categories' ) ) ) {
|
||||
// Create an array of all the categories that are attached to posts.
|
||||
$all_the_cool_cats = get_categories( array(
|
||||
'fields' => 'ids',
|
||||
'hide_empty' => 1,
|
||||
|
||||
// We only need to know if there is more than one category.
|
||||
'number' => 2,
|
||||
) );
|
||||
|
||||
// Count the number of categories that are attached to the posts.
|
||||
$all_the_cool_cats = count( $all_the_cool_cats );
|
||||
|
||||
set_transient( 'professional_categories', $all_the_cool_cats );
|
||||
}
|
||||
|
||||
if ( $all_the_cool_cats > 1 ) {
|
||||
// This blog has more than 1 category so professional_categorized_blog should return true.
|
||||
return true;
|
||||
} else {
|
||||
// This blog has only 1 category so professional_categorized_blog should return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ( ! function_exists( 'professional_comment' ) ) :
|
||||
/**
|
||||
* Template for comments and pingbacks.
|
||||
*
|
||||
* Used as a callback by wp_list_comments() for displaying the comments.
|
||||
*/
|
||||
function professional_comment( $comment, $args, $depth ) {
|
||||
$GLOBALS['comment'] = $comment;
|
||||
|
||||
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
|
||||
<div class="comment-body">
|
||||
<?php _e( 'Pingback:', 'professional' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'professional' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
|
||||
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body row">
|
||||
<footer class="comment-meta">
|
||||
<div class="comment-author vcard col-md-2 col-sm-2 hidden-xs">
|
||||
<?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, array(150,150) ); ?>
|
||||
</div><!-- .comment-author -->
|
||||
<div class="comment-metadata col-md-10 col-sm-10 col-xs-12">
|
||||
<?php printf( '%s', sprintf( '<cite class="fn">%s</cite> on ', get_comment_author_link() ) ); ?>
|
||||
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
|
||||
<time datetime="<?php comment_time( 'c' ); ?>">
|
||||
<?php printf( _x( '%1$s', '1: date', 'professional' ), get_comment_date() ); ?>
|
||||
</time>
|
||||
</a>
|
||||
<?php edit_comment_link( __( 'Edit', 'professional' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
</div><!-- .comment-metadata -->
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'professional' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</footer><!-- .comment-meta -->
|
||||
|
||||
<div class="comment-content col-md-10 col-sm-10 col-xs-12">
|
||||
<?php comment_text(); ?>
|
||||
<?php
|
||||
comment_reply_link( array_merge( $args, array(
|
||||
'add_below' => 'div-comment',
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth'],
|
||||
'before' => '<div class="reply">',
|
||||
'after' => '</div>',
|
||||
) ) );
|
||||
?>
|
||||
</div><!-- .comment-content -->
|
||||
</article><!-- .comment-body -->
|
||||
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
endif; // ends check for professional_comment()
|
||||
|
||||
/**
|
||||
* Flush out the transients used in professional_categorized_blog.
|
||||
*/
|
||||
function professional_category_transient_flusher() {
|
||||
// Like, beat it. Dig?
|
||||
delete_transient( 'professional_categories' );
|
||||
}
|
||||
add_action( 'edit_category', 'professional_category_transient_flusher' );
|
||||
add_action( 'save_post', 'professional_category_transient_flusher' );
|
||||
Reference in New Issue
Block a user