-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
57 lines (45 loc) · 1.82 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
<?php
// add theme support for menus:
add_theme_support( 'menus' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
// set custom image sizes
add_image_size( 'category-thumb', 500, 500, true );
add_image_size( 'sgl-image', 1000, 99999);
add_image_size( 'about-portrait-img', 700, 700);
// this function makes WP recognise our menu(s)
function register_theme_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
)
);
}
add_action( 'init', 'register_theme_menus' );
// shows categories box on media editing page, meaning that you can attach categories to images
function wptp_add_categories_to_attachments() {
register_taxonomy_for_object_type( 'category', 'attachment' );
}
add_action( 'init' , 'wptp_add_categories_to_attachments' );
function show_all_in_category($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_category()) {
$query->set('posts_per_page', -1);
}
}
}
add_action('pre_get_posts','show_all_in_category');
// this function loads the style (css) files
function em_theme_styles() {
wp_enqueue_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style( 'responsiveGrid_css', get_template_directory_uri() . '/responsive-grid.css');
wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'bloodlust-and-bonnets_css', get_template_directory_uri() . '/page-bloodlust-and-bonnets.css' );
wp_enqueue_style( 'shop_css', get_template_directory_uri() . '/shop.css' );
}
add_action( 'wp_enqueue_scripts', 'em_theme_styles' );
// this function loads the scripts (js)
function em_theme_js() {
wp_enqueue_script( 'main_js', get_template_directory_uri() . '/js/app.js', array('jquery'), '', true) ;
}
add_action( 'wp_enqueue_scripts', 'em_theme_js' );