This repository has been archived by the owner on Aug 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
104 lines (88 loc) · 2.47 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Theme functions.
*
* @package %Theme_Name%
* @author %Author%
*/
require_once dirname( __FILE__ ) . '/includes/admin.php';
require_once dirname( __FILE__ ) . '/includes/utility.php';
/** Enable additional theme features */
add_post_type_support( 'page', 'excerpt' );
add_theme_support( 'post-thumbnails' );
/**
* Custom "Read More" links.
*
* @global $post
*
* @param string $more Won't be used.
* @return string A "continue reading" link to the post.
*/
function themename_excerpt_more( $more ) {
global $post;
return sprintf(
'<a href="%s" title="%s" class="read-more">%s</a>',
esc_url( get_permalink( $post->ID ) ),
esc_attr( sprintf( __( 'Continue reading "%s"', '%Text_Domain%' ), get_the_title( $post->ID ) ) ),
esc_html__( 'Continue reading…', '%Text_Domain%' )
);
}
add_filter( 'excerpt_more', 'themename_excerpt_more' );
/**
* Register dynamic sidebars.
*/
function themename_register_dynamic_sidebars() {
$sidebars = array(
array(
'id' => 'primary-sidebar',
'name' => __( 'Primary sidebar', '%Text_Domain%' ),
),
);
foreach ( $sidebars as $sidebar ) {
register_sidebar( $sidebar );
}
}
add_action( 'widgets_init', 'themename_register_dynamic_sidebars' );
/**
* Register site navigation menus.
*/
function themename_register_nav_menus() {
register_nav_menus(
array(
'primary-nav' => __( 'Primary Navigation', '%Text_Domain%' ),
),
);
}
add_action( 'init', 'themename_register_nav_menus' );
/**
* Register and enqueue theme styles and scripts.
*/
function themename_register_styles_scripts() {
/* Stylesheets */
wp_register_style( 'styles', get_stylesheet_directory_uri() . '/assets/css/styles.css', null, null, 'all' );
// Editor stylesheets.
add_editor_style( 'assets/css/editor.css' );
/* Scripts */
wp_register_script( 'scripts', get_stylesheet_directory_uri() . '/assets/js/scripts.js', array( 'jquery' ), null, true );
if ( ! is_admin() && ! is_login_page() ) {
wp_enqueue_style( 'styles' );
wp_enqueue_script( 'scripts' );
}
}
add_action( 'init', 'themename_register_styles_scripts' );
/**
* Generates and outputs the theme's #site-logo.
*
* The front page will be a <h1> tag while interior pages will be links to the homepage.
*/
function themename_site_logo() {
if ( is_front_page() ) {
printf( '<h1 id="site-logo">%s</h1>', esc_html( get_bloginfo( 'name' ) ) );
} else {
printf(
'<a href="%s" id="site-logo">%s</a>',
esc_attr( site_url( '/' ) ),
esc_html( get_bloginfo( 'name' ) )
);
}
}