-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
116 lines (97 loc) · 3.84 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
105
106
107
108
109
110
111
112
113
114
115
116
<?php
function toastmasterspl_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 100,
'flex-height' => false,
'flex-width' => true,
) );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1000, 9999 );
register_nav_menus( array(
'page-navigation' => __( 'Primary Page Navigation Menu', 'toastmasterspl' ),
'organization-breadcrumb' => __( 'Organization Breadcrumb Menu', 'toastmasterspl' ),
'social-links' => __( 'Social Links Menu', 'toastmasterspl' ),
) );
add_editor_style( array( 'css/editor-style.css' ) );
}
add_action( 'after_setup_theme', 'toastmasterspl_setup' );
function toastmasterspl_scripts() {
wp_enqueue_style(
'toastmasterspl-fontawesome',
'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
array(),
null
);
wp_enqueue_style(
'toastmasterspl-roboto',
'https://fonts.googleapis.com/css?family=Roboto:400,400italic,700,700italic&subset=latin,latin-ext',
array(),
null
);
wp_enqueue_style( 'toastmasterspl-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'toastmasterspl_scripts' );
function toastmasterspl_widgets_init() {
require get_template_directory() . '/inc/Toastmasterspl_Fact_Widget.php';
register_widget( 'Toastmasterspl_Fact_Widget' );
register_sidebar( array(
'name' => __( 'Sidebar', 'toastmasterspl' ),
'id' => 'sidebar-page-content',
'description' => __( 'Add widgets here to appear in the right-hand column.', 'toastmasterspl' ),
'before_widget' => '<aside id="%1$s" class="page-content__widget sidebar-widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="sidebar-widget__title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'toastmasterspl_widgets_init' );
function toastmasterspl_customize_register( $wp_customize ) {
$wp_customize->add_section( 'toastmasterspl_options', array(
'title' => __( 'Toastmasters.pl Options', 'toastmasterspl' ),
'capability' => 'edit_theme_options',
) );
$wp_customize->add_setting( 'copyright_text', array(
'default' => '',
'type' => 'theme_mod',
) );
$wp_customize->add_control( 'copyright_text_entry', array(
'settings' => 'copyright_text',
'section' => 'toastmasterspl_options',
'label' => __( 'Copyright Text:', 'toastmasterspl' ),
'description' => __( 'Shows up in the footer. HTML is allowed.', 'toastmasterspl'),
'type' => 'textarea',
) );
}
add_action( 'customize_register', 'toastmasterspl_customize_register' );
function toastmasterspl_the_custom_logo( $class = 'custom-logo' ) {
$html = '';
$custom_logo_id = get_theme_mod( 'custom_logo' );
// We have a logo. Logo is go.
if ( $custom_logo_id ) {
$html = wp_get_attachment_image( $custom_logo_id, 'full', false, array(
'class' => $class,
'itemprop' => 'logo',
)
);
}
echo $html;
}
/**
* Allows for getting the excerpt outside of The Loop.
*/
function toastmasterspl_get_excerpt( $post_id = 0, $length = 35 ) {
$post = get_post( $post_id );
$the_excerpt = $post->post_content;
$the_excerpt = strip_tags( strip_shortcodes( $the_excerpt ) );
$words = explode( ' ', $the_excerpt, $length + 1 );
if ( count( $words ) > $length ) {
array_pop( $words );
array_push( $words, '...' );
$the_excerpt = implode( ' ', $words );
}
return htmlspecialchars( $the_excerpt );
}
require get_template_directory() . '/inc/Customizable_Walker_Nav_Menu.php';
require get_template_directory() . '/inc/Social_Walker_Nav_Menu.php';