-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
138 lines (119 loc) · 3.92 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
<?php
add_action('widgets_init', 'portfolio_widgets_init');
add_action( 'after_setup_theme', 'portfolio_setup' );
add_action('init', 'create_post_type');
add_action( 'init', 'create_projets_taxonomies' );
add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
wp_deregister_style( 'wp-admin' );
}
function add_my_post_types_to_query( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', array( 'post', 'page', 'projets' ) );
return $query;
}
function portfolio_widgets_init(){
register_sidebar( array(
'name' => __( 'Main Sidebar', 'portfolio' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Secondary Sidebar', 'portfolio' ),
'id' => 'sidebar-2',
'description' => __( 'description', 'portfolio' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
function portfolio_setup(){
register_nav_menu( 'primary', __( 'Primary Menu', 'portfolio' ) );
}
function create_post_type(){
register_post_type( 'projets',
array(
'labels' => array(
'name' => __('Projets'),
'singular_name' => __('Projet')
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'excerpt'),
'rewrite' => array('slug' => 'projets')
)
);
register_post_type( 'socials',
array(
'labels' => array(
'name' => __('Socials'),
'singular_name' => __('Social')
),
'public' => true,
'has_archive' => true,
'supports' => array(),
)
);
register_post_type( 'interrests',
array(
'labels' => array(
'name' => __('Interrests'),
'singular_name' => __('Interrest')
),
'public' => true,
'has_archive' => true,
'supports' => array(),
)
);
}
function create_projets_taxonomies() {
$labels = array(
'name' => _x( 'Genres', 'taxonomy general name' ),
'singular_name' => _x( 'Genre', 'taxonomy singular name' ),
'search_items' => __( 'Search Genres' ),
'all_items' => __( 'All Genres' ),
'parent_item' => __( 'Parent Genre' ),
'parent_item_colon' => __( 'Parent Genre:' ),
'edit_item' => __( 'Edit Genre' ),
'update_item' => __( 'Update Genre' ),
'add_new_item' => __( 'Add New Genre' ),
'new_item_name' => __( 'New Genre Name' ),
'menu_name' => __( 'Genre' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'genre' ),
);
register_taxonomy( 'Genre', array( 'projets' ), $args );
$labels2 = array(
'name' => _x( 'Compétences', 'taxonomy general name' ),
'singular_name' => _x( 'Compétence', 'taxonomy singular name' ),
'search_items' => __( 'Search Compétences' ),
'all_items' => __( 'All Compétences' ),
'parent_item' => __( 'Parent Compétence' ),
'parent_item_colon' => __( 'Parent Compétence:' ),
'edit_item' => __( 'Edit Compétence' ),
'update_item' => __( 'Update Compétence' ),
'add_new_item' => __( 'Add New Compétence' ),
'new_item_name' => __( 'New Compétence Name' ),
'menu_name' => __( 'Compétence' ),
);
$args2 = array(
'hierarchical' => true,
'labels' => $labels2,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'competence' ),
);
register_taxonomy( 'Competence', array( 'projets' ), $args2 );
}