-
Notifications
You must be signed in to change notification settings - Fork 3
/
functions.php
125 lines (106 loc) · 3.43 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
<?php
// get active theme directory name
$theme_name = next(explode('/themes/', get_template_directory()));
include_once('lib/metabox/custom-post-types.php');
include_once('includes/dkk-activation.php');
include_once('includes/dkk-admin.php');
require_once ('includes/theme-options.php');
include_once('includes/dkk-cleanup.php');
include_once('includes/dkk-htaccess.php');
if ( ! isset( $content_width ) )
$content_width = 890;
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
add_image_size( 'blog-thumb', 620, 300, true );
}
add_editor_style('editor-style.css');
load_theme_textdomain( 'paramount', TEMPLATEPATH . '/languages' );
$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
add_theme_support( 'automatic-feed-links' );
add_theme_support('menus');
register_nav_menus(
array(
'primary_navigation' => 'Primary Navigation',
'footer_navigation' => 'Footer Navigation'
)
);
// remove container from menus
function dkk_nav_menu_args($args = ''){
$args['container'] = false;
return $args;
}
add_filter('wp_nav_menu_args', 'dkk_nav_menu_args');
// Register Widgetized Sidebar Areas
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Search',
'before_widget' => '<div class="search-box">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'contact',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
function dkk_analytics() {
global $dkk_options;
$settings = get_option( 'dkk_options', $dkk_options );
if( $settings['analytics_id'] ) : ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<?php echo $settings['analytics_id'] ?>']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php endif;
}
add_action( 'wp_head', 'dkk_analytics' );
// add to robots.txt
// http://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization
add_action('do_robots', 'roots_robots');
function roots_robots() {
echo "Disallow: /cgi-bin\n";
echo "Disallow: /wp-admin\n";
echo "Disallow: /wp-includes\n";
echo "Disallow: /wp-content/plugins\n";
echo "Disallow: /plugins\n";
echo "Disallow: /wp-content/cache\n";
echo "Disallow: /wp-content/themes\n";
echo "Disallow: /trackback\n";
echo "Disallow: /feed\n";
echo "Disallow: /comments\n";
echo "Disallow: /category/*/*\n";
echo "Disallow: */trackback\n";
echo "Disallow: */feed\n";
echo "Disallow: */comments\n";
echo "Disallow: /*?*\n";
echo "Disallow: /*?\n";
echo "Allow: /wp-content/uploads\n";
echo "Allow: /assets";
}
/**
* Force 'Insert into Post' button
*/
add_filter( 'get_media_item_args', 'force_send_to_post' );
function force_send_to_post( $args ) {
global $post;
$post_type = get_post_type( $post->post_parent );
if ( $post_type == 'movies' || $post_type == 'coming-soon' ){
$args['send'] = true;
}
return $args;
}
?>