-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
49 lines (40 loc) · 1.31 KB
/
functions.php
File metadata and controls
49 lines (40 loc) · 1.31 KB
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
<?php
/*
|--------------------------------------------------------------------------
| Wordpress theme > functions.php
|--------------------------------------------------------------------------
*/
# suporte para thumbnails
add_theme_support('post-thumbnails', array('post', 'page'));
# sidebar
register_sidebar(array(
'name' => __('Sidebar - Geral', 'theme_sidebar_default'),
'id' => 'theme-sidebar-default',
'before_widget' => '<div id="%1$s" class="sidebar-box widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="sidebar-title">',
'after_title' => '</h2>'
));
# menus
register_nav_menus(array(
'primary' => __('Menu principal', 'produtividade'),
));
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');
function posts_link_attributes() {
return 'class="btn btn-primary"';
}
function post_featured_image($size)
{
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, $size, true);
return $thumb_url_array[0];
}
function post_category_name()
{
$category = get_the_category();
if ($category[0]->cat_name == 'Destaque') {
return $category[1]->cat_name;
}
return $category[0]->cat_name;;
}