-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
247 lines (176 loc) · 5.68 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?php
remove_action ('wp_head', 'rsd_link');
remove_action( 'wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
define('DISALLOW_FILE_EDIT', TRUE);
add_theme_support( 'menus' );
register_nav_menus( array(
'ust_menu' => 'UstMenu',
'footer_menu' => 'FooterMenu'
) );
if (!current_user_can('manage_options')) {
add_filter('show_admin_bar', '__return_false');
}
register_sidebars(1, array('name'=>'Blog'));
function jquery() {
wp_enqueue_script('jquery');
}
add_action( 'wp_enqueue_scripts', 'jquery' );
function kayityonlendir()
{
return home_url( '/' );
}
add_filter( 'registration_redirect', 'kayityonlendir' );
function go_home(){
wp_redirect( home_url() );
exit();
}
add_action('wp_logout','go_home');
add_theme_support( 'post-thumbnails' );
add_image_size( 'size-270x180', 270, 180, true );
add_image_size( 'size-640x320', 640, 320, true );
the_post();
/*
*
* Abonelikler > Abonelik Süre + Başlangıç Tarih
*
* Kullanıcı > Süresi + Başlangıç Tarih
*
* user_id > 30 Gün + 10.10.2014
*
*/
yazitipi('Abonelik','abonelik');
taxonomy('Abonelik Süre','aboneliksure','abonelik');
taxonomy('Kullanıcı','kullanici','abonelik');
taxonomy_kat('Ödeme Durum','odemedurum','abonelik');
/*
*
* Eğitimler > Eğitim > Videolar
*
*/
// yazitipi('Konular','konular');
yazitipi('Eğitim','egitim');
//yazitipi('Video','video');
taxonomy_kat('Eğitimler','egitimler',array('egitim'));
taxonomy_kat('Abonelik','abonelik',array('egitim'));
taxonomy('Video ID','videoid',array('egitim'));
// taxonomy('Eğitim ID','egitimid',array('egitim'));
taxonomy('Süre','sure',array('egitim'));
/*
*
* Blog > Makaleler
*
*/
yazitipi('Blog','blog');
taxonomy('Kategori','kategori','blog'); // Blog Kategori
taxonomy('Eğitim Seviye','seviye',array('blog','egitimler')); // Blog Kategori
function taxonomy($taxonomyadi,$taxonomyslug,$baglipost){
register_taxonomy( $taxonomyslug, $baglipost, array( 'hierarchical' => false, 'label' => $taxonomyadi, 'query_var' => true, 'rewrite' => true, 'show_in_nav_menus' => false ) );
}
function taxonomy_kat($taxonomyadi,$taxonomyslug,$baglipost){
register_taxonomy( $taxonomyslug, $baglipost, array( 'hierarchical' => true, 'label' => $taxonomyadi, 'query_var' => true, 'rewrite' => true, 'show_in_nav_menus' => true ) );
}
function yazitipi($yazitipiadi,$yazitipislug){
register_post_type( $yazitipislug,
array(
'labels' => array(
'name' => __( $yazitipiadi ),
'singular_name' => __( $yazitipiadi )
),
'public' => true,
'has_archive' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => true,
'menu_position' => 16,
'supports' => array('title','editor','author','comments','thumbnail','page-attributes','revisions'),
'has_archive' => $yazitipislug,
'show_in_nav_menus' => false
)
);
}
function kullaniciadres() {
global $wp_rewrite;
$author_slug = 'uye'; // yeni belirleyeceğiniz adres biçimi
$wp_rewrite->author_base = $author_slug;
}
add_action('init', 'kullaniciadres');
function caption_shortcode( $atts, $content = null ) {
return '<p class="onemli">' . $content . '</p>';
}
add_shortcode( 'onemli', 'caption_shortcode' );
function caption_shortcode2( $atts, $content = null ) {
return '<p class="dikkat">' . $content . '</p>';
}
add_shortcode( 'dikkat', 'caption_shortcode2' );
function caption_shortcode3( $atts, $content = null ) {
return '<p class="duyuru">' . $content . '</p>';
}
add_shortcode( 'duyuru', 'caption_shortcode3' );
function caption_shortcode4( $atts, $content = null ) {
return '<p class="code">' . $content . '</p>';
}
add_shortcode( 'code', 'caption_shortcode4' );
/*
Üye Giriş Bir Kez Olabilir
*/
if( !class_exists( 'WPSingleUserLoggin' ) )
{
class WPSingleUserLoggin
{
private $session_id;
function __construct()
{
if ( ! session_id() )
session_start();
$this->session_id = session_id();
add_action( 'init', array( $this, 'init' ) );
add_action( 'wp_login', array( $this, 'wp_login' ), 10, 2 );
}
function init()
{
if( ! is_user_logged_in() )
return;
$stored_sess_id = get_user_meta( get_current_user_id(), '_wp_single_user_hash', true );
if( $stored_sess_id != $this->session_id )
{
wp_logout();
wp_redirect( wp_login_url() );
exit;
}
}
function wp_login( $user_login, $user )
{
update_user_meta( $user->ID, '_wp_single_user_hash', $this->session_id );
return;
}
}
new WPSingleUserLoggin();
}
function GetDays($sStartDate, $sEndDate){
// Firstly, format the provided dates.
// This function works best with YYYY-MM-DD
// but other date formats will work thanks
// to strtotime().
$sStartDate = gmdate("Y-m-d", strtotime($sStartDate));
$sEndDate = gmdate("Y-m-d", strtotime($sEndDate));
// Start the variable off with the start date
$aDays[] = $sStartDate;
// Set a 'temp' variable, sCurrentDate, with
// the start date - before beginning the loop
$sCurrentDate = $sStartDate;
// While the current date is less than the end date
while($sCurrentDate < $sEndDate){
// Add a day to the current date
$sCurrentDate = gmdate("Y-m-d", strtotime("+1 day", strtotime($sCurrentDate)));
// Add this new day to the aDays array
$aDays[] = $sCurrentDate;
}
// Once the loop has finished, return the
// array of days.
return $aDays;
}
?>