forked from pippinsplugins/EDD-Starter-Theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
101 lines (86 loc) · 2.67 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
<?php
$edds_options = get_option('edds_theme_settings');
if(!defined('EDDS_THEME_DIR')) {
define('EDDS_THEME_DIR', dirname(__FILE__));
}
if(!defined('EDDS_THEME_URL')) {
define('EDDS_THEME_URL', get_bloginfo('template_directory'));
}
// extra theme files
include(EDDS_THEME_DIR . '/includes/scripts.php');
include(EDDS_THEME_DIR . '/includes/edd-config.php');
if ( function_exists('register_sidebar') ) {
register_sidebars(1, array(
'name' => 'Sidebar Right',
'id' => 'sidebar_right',
'before_title' => '<h3 class="widget_title">',
'after_title' => '</h3>',
'before_widget' => '<li class="widget">',
'after_widget' => '</li>'
));
register_sidebars(1, array(
'name' => 'Footer One',
'id' => 'footer_one',
'before_title' => '<h3 class="widget_title">',
'after_title' => '</h3>',
'before_widget' => '<li class="widget">',
'after_widget' => '</li>'
));
register_sidebars(1, array(
'name' => 'Footer Two',
'id' => 'footer_two',
'before_title' => '<h3 class="widget_title">',
'after_title' => '</h3>',
'before_widget' => '<li class="widget">',
'after_widget' => '</li>'
));
register_sidebars(1, array(
'name' => 'Footer Three',
'id' => 'footer_three',
'before_title' => '<h3 class="widget_title">',
'after_title' => '</h3>',
'before_widget' => '<li class="widget">',
'after_widget' => '</li>'
));
register_sidebars(1, array(
'name' => 'Footer Four',
'id' => 'footer_four',
'before_title' => '<h3 class="widget_title">',
'after_title' => '</h3>',
'before_widget' => '<li class="widget">',
'after_widget' => '</li>'
));
}
// set up custom nav menus
if ( function_exists( 'register_nav_menus' ) ) {
register_nav_menus(
array(
'main_nav' => 'Main Nav',
'footer_nav' => 'Footer Nav'
)
);
}
//adds post thumbnail support - new in Wordpress 2.9
add_theme_support( 'post-thumbnails' );
if(!function_exists('edds_image_sizes')) {
function edds_image_sizes() {
set_post_thumbnail_size( 649, 245, true ); // default post thumbnail size
add_image_size( 'product-image', 199, 245, true ); // product thumbnail
add_image_size( 'product-image-large', 627, 400, true ); // main product image
}
}
add_action('init', 'edds_image_sizes');
/**
* Alter the main loop on front_page.php
*/
function edd_modify_main_loop( $query ) {
$downloads_per_page = 4;
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_home() ) {
$query->set( 'posts_per_page', $downloads_per_page ); // make this number come from theme options
$query->set( 'post_type', 'download' ); // set post type to download
return;
}
}
add_action( 'pre_get_posts', 'edd_modify_main_loop', 1 );