-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
89 lines (70 loc) · 1.87 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
<?php
/**
*
* omer citak <@om3rcitak>
*
*/
function arkakapi_setup() {
load_theme_textdomain( 'arkakapi' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
'gallery',
'status',
'audio',
'chat',
) );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
) );
register_nav_menus( [
'navigation' => __( 'Navigation Menu', 'arkakapi' ),
'footer_social' => __( 'Footer Social Icons Menu', 'arkakapi' ),
] );
}
function arkakapi_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'arkakapi' ),
'id' => 'sidebar',
'description' => __( 'Add widgets here to appear in your sidebar.', 'arkakapi' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div></div>',
'before_title' => '<h5 class="widget-title font-alt">',
'after_title' => '</h5><div class="widget-body">',
) );
}
function get_current_url() {
global $wp;
return home_url( $wp->request );
}
function get_blogpage_url() {
return get_permalink( get_option( 'page_for_posts' ) );
}
function get_page_type() {
if ( isset( $_GET['s'] ) ) {
return 'search';
}
return get_home_url() == get_current_url() ? "home" : "page";
}
function get_nav_class() {
return get_page_type() == "home" ? "transparent stick-fixed" : "js-stick";
}
if ( ! function_exists( 'get_menu_by_location' ) ):
function get_menu_by_location( $theme_location, $args = [] ) {
$theme_locations = get_nav_menu_locations();
$menu_obj = get_term( $theme_locations[ $theme_location ], 'nav_menu' );
if ( $menu_obj ) {
return wp_get_nav_menu_items( $menu_obj->term_id, $args );
} else {
return $menu_obj;
}
}
endif;
add_action( 'after_setup_theme', 'arkakapi_setup' );
add_action( 'widgets_init', 'arkakapi_widgets_init' );