1 | <?php |
---|
2 | /*-----------------------------------------------------------------------------------*/ |
---|
3 | /* SEO Functions */ |
---|
4 | /*-----------------------------------------------------------------------------------*/ |
---|
5 | |
---|
6 | |
---|
7 | /*----------------------------------*/ |
---|
8 | /* Title */ |
---|
9 | /*----------------------------------*/ |
---|
10 | |
---|
11 | function wpzoom_titles() { |
---|
12 | global $shortname; |
---|
13 | |
---|
14 | #if the title is being displayed on the homepage |
---|
15 | if (is_front_page()) { echo "home"; |
---|
16 | /* |
---|
17 | if (get_option('wpzoom_seo_home_title') == 'Site Title - Site Description') echo get_bloginfo('name').get_option('wpzoom_title_separator').get_bloginfo('description'); |
---|
18 | if ( get_option('wpzoom_seo_home_title') == 'Site Description - Site Title') echo get_bloginfo('description').get_option('wpzoom_title_separator').get_bloginfo('name'); |
---|
19 | if ( get_option('wpzoom_seo_home_title') == 'Site Title') echo get_bloginfo('name'); |
---|
20 | } */ |
---|
21 | #if the title is being displayed on single posts/pages |
---|
22 | elseif (is_single() || is_page()) { |
---|
23 | |
---|
24 | if (get_option('wpzoom_seo_posts_title') == 'Site Title - Page Title') echo get_bloginfo('name').get_option('wpzoom_title_separator').wp_title('',false,''); |
---|
25 | if ( get_option('wpzoom_seo_posts_title') == 'Page Title - Site Title') echo wp_title('',false,'').get_option('wpzoom_title_separator').get_bloginfo('name'); |
---|
26 | if ( get_option('wpzoom_seo_posts_title') == 'Page Title') echo wp_title('',false,''); |
---|
27 | |
---|
28 | } |
---|
29 | #if the title is being displayed on index pages (categories/archives/search results) |
---|
30 | elseif (is_category() || is_archive() || is_search()) { |
---|
31 | if (get_option('wpzoom_seo_pages_title') == 'Site Title - Page Title') echo get_bloginfo('name').get_option('wpzoom_title_separator').wp_title('',false,''); |
---|
32 | if ( get_option('wpzoom_seo_pages_title') == 'Page Title - Site Title') echo wp_title('',false,'').get_option('wpzoom_title_separator').get_bloginfo('name'); |
---|
33 | if ( get_option('wpzoom_seo_pages_title') == 'Page Title') echo wp_title('',false,''); |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | /*----------------------------------*/ |
---|
40 | /* Indexing Settings */ |
---|
41 | /*----------------------------------*/ |
---|
42 | |
---|
43 | function wpzoom_index(){ |
---|
44 | global $post; |
---|
45 | global $wpdb; |
---|
46 | if(!empty($post)){ |
---|
47 | $post_id = $post->ID; |
---|
48 | } |
---|
49 | |
---|
50 | /* Robots */ |
---|
51 | $index = 'index'; |
---|
52 | $follow = 'follow'; |
---|
53 | |
---|
54 | if ( is_tag() && get_option('wpzoom_index_tag') != 'index') { $index = 'noindex'; } |
---|
55 | elseif ( is_search() && get_option('wpzoom_index_search') != 'index' ) { $index = 'noindex'; } |
---|
56 | elseif ( is_author() && get_option('wpzoom_index_author') != 'index') { $index = 'noindex'; } |
---|
57 | elseif ( is_date() && get_option('wpzoom_index_date') != 'index') { $index = 'noindex'; } |
---|
58 | elseif ( is_category() && get_option('wpzoom_index_category') != 'index' ) { $index = 'noindex'; } |
---|
59 | echo '<meta name="robots" content="'. $index .', '. $follow .'" />' . "\n"; |
---|
60 | |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | /*----------------------------------*/ |
---|
65 | /* Keywords */ |
---|
66 | /*----------------------------------*/ |
---|
67 | |
---|
68 | function meta_post_keywords() { |
---|
69 | $posttags = get_the_tags(); |
---|
70 | foreach((array)$posttags as $tag) { |
---|
71 | $meta_post_keywords .= $tag->name . ','; |
---|
72 | } |
---|
73 | echo '<meta name="keywords" content="'.$meta_post_keywords.'" />'; |
---|
74 | } |
---|
75 | |
---|
76 | function meta_home_keywords() { |
---|
77 | global $wpzoom_meta_key; |
---|
78 | |
---|
79 | if (strlen($wpzoom_meta_key) > 1 ) { |
---|
80 | |
---|
81 | echo '<meta name="keywords" content="'.get_option('wpzoom_meta_key').'" />'; |
---|
82 | |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | |
---|
87 | /*----------------------------------*/ |
---|
88 | /* Canonical URLS */ |
---|
89 | /*----------------------------------*/ |
---|
90 | |
---|
91 | function wpzoom_canonical() { |
---|
92 | |
---|
93 | if(get_option('wpzoom_canonical') == 'Yes' ) { |
---|
94 | |
---|
95 | #homepage urls |
---|
96 | if (is_home() )echo '<link rel="canonical" href="'.get_bloginfo('url').'" />'; |
---|
97 | |
---|
98 | #single page urls |
---|
99 | global $wp_query; |
---|
100 | $postid = $wp_query->post->ID; |
---|
101 | |
---|
102 | if (is_single() || is_page()) echo '<link rel="canonical" href="'.get_permalink().'" />'; |
---|
103 | |
---|
104 | |
---|
105 | #index page urls |
---|
106 | |
---|
107 | if (is_archive() || is_category() || is_search()) echo '<link rel="canonical" href="'.get_permalink().'" />'; |
---|
108 | } |
---|
109 | } |
---|
110 | |
---|
111 | ?> |
---|