-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfunctions.php
More file actions
138 lines (119 loc) · 4.62 KB
/
functions.php
File metadata and controls
138 lines (119 loc) · 4.62 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/**
* Get Plugin Update Checker script - thanks to @author YahnisElsts for this.
* Get the latest version from @link https://github.com/YahnisElsts/plugin-update-checker
* As of @version 5.0, this script MUST be called before any other function
*/
require_once STYLESHEETPATH . '/inc/functions/puc/plugin-update-checker.php';
use YahnisElsts\PluginUpdateChecker\v5p0\PucFactory;
/**
* Get base theme information, as defined in style.css.
* You can then call them using @var $mytheme->get()
*/
$mytheme = wp_get_theme();
/**
* Checks if you are currently in the wp-admin area
*/
if ( is_admin() ){
/**
* Runs the plugin-update-checker script called earlier
* Only runs when logged in to wp-admin
*/
$checkTheme = PucFactory::buildUpdateChecker(
$mytheme->get('ThemeURI'), // This can be any public repo on GitHub, or any file on your own server. Defaults to the Theme URI value in style.css
__FILE__, // Full path to the main plugin file or functions.php.
$mytheme->get('TextDomain'), // Uses the 'Text Domain' string as defined in style.css
);
// Enables releases via GitHub
// $checkTheme->getVcsApi()->enableReleaseAssets();
/**
* Call TGM Plugin Activation script - thanks to the TGMPA team for this
* Get the latest version from @link https://github.com/TGMPA/TGM-Plugin-Activation
* Only runs when logged in to wp-admin
*/
require_once STYLESHEETPATH . '/inc/functions/tgmpa/tgmpa.php';
/**
* Call the notification script and display a notification - thanks to Askupa Software for this
* Get the latest verison from @link https://github.com/askupasoftware/wp-admin-notification
* Only runs when logged in to wp-admin
*/
require_once STYLESHEETPATH . '/inc/functions/wpan/bootstrap.php';
/**
* Display notification for theme, using wp-admin-notification
*/
wp_admin_notification(
'notification-id', // Set your unique notification ID
__('<strong>Thanks for using <em>Project Zero from Cocode Designs</em> as your base theme.</strong><br /> You can use this to create your own custom theme, whether it is a free theme, or you wish to use it commercially. We have included a number of plugins for you, including <strong>WP Admin Notification</strong> from Askupa Software, <strong>TGM Plugin Activation</strong>, and <strong>Plugin Update Checker</strong> from YahnisElsts.','zero-theme'),
'info', // Notification type - acceptable values are 'success', 'error', 'info' or 'warning'
true // Makes your notification dismissable via a link. Change to false if your want to make your notification persistant
);
}
/**
* Contains functions to register and enqueue scripts for @filter wp_enqueue_scripts and
*/
require_once STYLESHEETPATH . '/inc/header.php';
/**
* Contains functions to manipulate the wp-json API
*/
require_once STYLESHEETPATH . '/inc/wp-json.php';
/**
* Adds theme customisation options
*/
include_once STYLESHEETPATH . '/inc/functions/customiser.php';
/**
* Get blog pagination script - calls the blog_archive_pagination() function
*/
include_once STYLESHEETPATH . '/inc/functions/page-nav.php';
/**
* Get blog pagination script - calls the blog_archive_pagination() function
*/
include_once STYLESHEETPATH . '/inc/options/options-subpage.php';
/**
* Load sidebars, including footer sidebars
*/
include_once STYLESHEETPATH . '/inc/functions/sidebars.php';
/**
* Set a default avatar for the theme
*
* @param string $myavatar The URL of the avatar, as saved in the theme
* @param string $avatar_defaults[$myavatar] Descriptive name of the avatar
* @return array $avatar_defaults
*/
function myTheme_defaultAvatar($avatar_defaults) {
$myavatar = get_stylesheet_directory_uri() . '/images/default-avatar.png';
$avatar_defaults[$myavatar] = "Default Avatar";
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'myTheme_defaultAvatar' );
/**
* Enable Custom Logo and Post Thumbnails (Featured Images)
*/
if ( function_exists('add_theme_support') ) {
add_theme_support( 'post-thumbnails' );
}
/**
* Ensures page <title> is displayed on pages and posts.
*/
add_filter( 'wp_title', 'myTheme_homeTitle' );
/**
* Customize the title for the home page, if one is not set.
*
* @param string $title The original title.
* @return string The title to use.
*/
function myTheme_homeTitle( $title ){
if ( empty( $title ) && ( is_home() || is_front_page() ) ) {
$title = __( 'Home', 'textdomain' ) . ' | ' . get_bloginfo( 'blogname' );
}
return $title;
}
/**
* Add navigation menu support
*/
if(function_exists('register_nav_menus')) {
register_nav_menus(
array(
'header_menu' => __('Header Menu'),
)
);
}