-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
139 lines (127 loc) · 4.88 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
<?php
if ( ! function_exists( 'ceblog_setup' ) ) :
function ceblog_setup() {
load_theme_textdomain( 'ceblog' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 300, 200, true );
register_nav_menus( array(
'siteheadermenu' => __( 'Site Header Menü','ceblog' ),
'sitesocialmenu' => __( 'Site Social Menu','ceblog' ),
'sitefootermenu' => __( 'Site Footer Menu','ceblog' ),
) );
register_sidebar( array(
'name' => __( 'Sidebar', 'ceblog' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar.', 'ceblog' ),
'before_widget' => '<div id="%1$s" class="card-body p-0 widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="card-header col-sm-12"><h3>',
'after_title' => '</h3></div>',
) );
register_sidebar( array(
'name' => __( 'Sidebar Single', 'ceblog' ),
'id' => 'sidebar-2',
'description' => __( 'Add widgets here to appear in your sidebar.', 'ceblog' ),
'before_widget' => '<div id="%1$s" class="card-body p-0 widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="card-header col-sm-12"><h3>',
'after_title' => '</h3></div>',
) );
register_sidebar( array(
'name' => __( 'Footer-1', 'ceblog' ),
'id' => 'footer-1',
'description' => __( 'Add widgets here to appear in your sidebar.', 'ceblog' ),
'before_widget' => '<div id="%1$s" class="card-body p-0 widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="card-header col-sm-12"><h3>',
'after_title' => '</h3></div>',
) );
register_sidebar( array(
'name' => __( 'Footer-2', 'ceblog' ),
'id' => 'footer-2',
'description' => __( 'Add widgets here to appear in your sidebar.', 'ceblog' ),
'before_widget' => '<div id="%1$s" class="card-body p-0 widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="card-header col-sm-12"><h3>',
'after_title' => '</h3></div>',
) );
register_sidebar( array(
'name' => __( 'Footer-3', 'ceblog' ),
'id' => 'footer-3',
'description' => __( 'Add widgets here to appear in your sidebar.', 'ceblog' ),
'before_widget' => '<div id="%1$s" class="card-body p-0 widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="card-header col-sm-12"><h3>',
'after_title' => '</h3></div>',
) );
register_sidebar( array(
'name' => __( 'Reklamlar', 'ceblog' ),
'id' => 'reklamlar',
'description' => __( 'Add widgets here to appear in your sidebar.', 'ceblog' ),
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<span>',
'after_title' => '</span>',
) );
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
) );
add_theme_support( 'customize-selective-refresh-widgets' );
}
endif;
add_action( 'after_setup_theme', 'ceblog_setup' );
function wpdocs_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 );
if ( !function_exists('lgr_auto_excerpt_more') ) {
// Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis
function lgr_auto_excerpt_more( $more ) {
return '↪';
}
add_filter('excerpt_more', 'lgr_auto_excerpt_more');
}
function remove_thumbnail_width_height( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
add_filter( 'post_thumbnail_html', 'remove_thumbnail_width_height', 10, 5 );
// Add Shortcode Bilgik
function bilgi_kutu_shortcode( $atts , $content = null ) {
// Attributes
$atts = shortcode_atts(
array(
'renk' => '',
'genis' => '93',
'yuksek' => '10',
'hiza' => 'none',
),
$atts,
'bilgik'
);
// Return custom embed code
return '
<div class="alert alert-' . $atts['renk'] . '" role="alert" style="min-height:' . $atts['yuksek'] . 'px;width:' . $atts['genis'] . '%;text-align:'. $atts['hiza'] .'">'. $content .'</div>
';
}
add_shortcode( 'bilgik', 'bilgi_kutu_shortcode' );
// title ayarı
add_filter( 'wp_title', 'wpdocs_hack_wp_title_for_home' );
/**
* 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 wpdocs_hack_wp_title_for_home( $title )
{
if ( empty( $title ) && ( is_home() || is_front_page() ) ) {
$title = __( 'Home', 'textdomain' ) . ' | ' . get_bloginfo( 'description' );
}
return $title;
}