-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
122 lines (101 loc) · 3.25 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
<?php
add_theme_support( 'custom-header' );
add_theme_support( 'post-thumbnails' );
function new_excerpt_more( $more ) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
function custom_excerpt_length( $length ) {
return 10;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function register_my_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
register_nav_menu('title-menu',__( 'Title Menu' ));
}
add_action( 'init', 'register_my_menu' );
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name'=> 'Sidebar',
'id' => 'sidebar_tab',
'before_widget' => '<div id="%1$s" class="sidebarItem %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name'=> 'Footer',
'id' => 'footer_tab',
'before_widget' => '<div id="%1$s" class="footer_tab">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3><hr>',
));
}
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name'=> 'Riconoscimenti',
'id' => 'credits_tab',
'before_widget' => '<div id="%1$s" class="creditsItem %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}
function ultimi_post() {
$list = "<ul>";
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
$riassunto = wp_trim_excerpt($recent["post_content"]);
$list .= '<li class="minipost"><figure><span class="img">'.get_the_post_thumbnail( $recent['ID'], array(50,50) ).'</span><figcaption><a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a><br>'.$riassunto.'</figcaption> </figure></li> ';
}
$list .= "</ul>";
return $list;
?>
<?php
}
add_shortcode("ultimi_post", "ultimi_post");
function authorship() {
$authorship = '
<small class="copyright">Template realizzato da <a href="http://danieleirsuti.com" rel="author">Daniele Irsuti</a> <i class="fa fa-copyright"></i> ';
$authorship .= '<a href="'.get_bloginfo("url").'">'.get_bloginfo("site").'</a>';
$authorship .='</small>';
return $authorship;
}
add_shortcode("authorship", "authorship");
function tagz($t) {
$tags = wp_get_post_tags($t);
if (!empty($tags)) {
$html = '<div class="post_tags">';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug} taglinks' rel='tag'>";
$html .= "{$tag->name}</a>";
}
$html .= '</div>';
echo $html;
}
else
echo '<p class="notag">Nessun tag!</p>';
}
function my_loginlogo() {
echo '<style type="text/css">
h1 a {
background-image: url(' . get_template_directory_uri() . '/img/IB.png) !important;
background-size: 300px !important;
-webkit-background-size: 300px !important;
width: 300px !important;
height: 300px !important;
}
</style>';
}
add_action('login_head', 'my_loginlogo');
function my_login_stylesheet() {
wp_enqueue_style( 'custom-login', get_template_directory_uri() . '/style.css' );
wp_enqueue_script( 'custom-login', get_template_directory_uri() . '/js/main.js' );
}
add_action( 'login_enqueue_scripts', 'my_login_stylesheet' );
?>