-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
159 lines (125 loc) · 5.05 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
add_theme_support( 'custom-header' );
add_theme_support( 'post-thumbnails' );
remove_filter('the_content', 'wpautop' );
// remove header links
add_action('init', 'tjnz_head_cleanup');
function tjnz_head_cleanup() {
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Category Feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Post and Comment Feeds
remove_action( 'wp_head', 'rsd_link' ); // EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Windows Live Writer
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // previous link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); // Links for Adjacent Posts
remove_action( 'wp_head', 'wp_generator' ); // WP version
if (!is_admin()) {
wp_deregister_script('jquery'); // De-Register jQuery
wp_register_script('jquery', '', '', '', true); // Register as 'empty', because we manually insert our script in header.php
}
}
// remove WP version from RSS
add_filter('the_generator', 'tjnz_rss_version');
function tjnz_rss_version() { return ''; }
function starter_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', false, NULL, true );
wp_enqueue_script( 'jquery' );
}
add_action( 'wp_enqueue_scripts', 'starter_scripts' );
remove_action('wp_head', 'wp_enqueue_scripts', 1);
add_action('wp_footer', 'wp_enqueue_scripts', 5);
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
function read_more(){
if (cml_get_current_language()->cml_locale === "it_IT") {
$readmore = "Leggi di più";
return $readmore;
}
else
$readmore = "Read More";
return $readmore;
}
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name'=> 'Company Retail',
'id' => 'retail_tab',
'before_widget' => '',
'after_widget' => '</div>',
'before_title' => '<!-- <div class="col-lg-6 resellQuote"><em>',
'after_title' => '</em></div> --> <div class="col-lg-12 resellDescr">',
));
}
function new_excerpt_more( $more ) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
function custom_excerpt_length( $length ) {
return 15;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function register_my_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
register_nav_menu('social-menu',__( 'Social Menu' ));
register_nav_menu('azienda-menu',__( 'Azienda Menu' ));
register_nav_menu('contatti-menu',__( 'Contatti Menu' ));
register_nav_menu('eshop',__( 'eshop Menu' ));
}
add_action( 'init', 'register_my_menu' );
function titolo_pagina($id) {
$current_id = CMLLanguage::get_current_id();
$convertito = CMLPost::get_translation($current_id, $id);
$post_x = get_post($convertito);
$title = $post_x->post_title;
echo $title;
}
function contenuto_pagina($id) {
$current_id = CMLLanguage::get_current_id();
$convertito = CMLPost::get_translation($current_id, $id);
$post_x = get_post($convertito);
$content = $post_x->post_content;
echo apply_filters( 'the_content', $post_x->post_content );
}
function riassunto_pagina($id) {
$current_id = CMLLanguage::get_current_id();
$convertito = CMLPost::get_translation($current_id, $id);
$post = get_post( $convertito );
setup_postdata( $post );
the_excerpt($convertito);
wp_reset_postdata();
}
function url_pagina($id) {
$current_id = CMLLanguage::get_current_id();
$convertito = CMLPost::get_translation($current_id, $id);
$post = get_permalink($convertito);
echo $post;
}
function wpse45700_get_menu_by_location( $location ) {
if( empty($location) ) return false;
$locations = get_nav_menu_locations();
if( ! isset( $locations[$location] ) ) return false;
$menu_obj = get_term( $locations[$location], 'nav_menu' );
return $menu_obj;
}
function copertina_pagina($id) {
$current_id = CMLLanguage::get_current_id();
$convertito = CMLPost::get_translation($current_id, $id);
$post_x = get_post($convertito);
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post_x->ID), array( 720,405 ), false, '' );
echo $src[0];
}
add_filter( 'wpcf7_form_class_attr', 'your_custom_form_class_attr' );
function your_custom_form_class_attr( $class ) {
$class .= ' foo bar';
return $class;
}
function my_wpcf7_ajax_loader () {
return get_stylesheet_directory_uri() .'/css/balls.svg';
}
add_filter('wpcf7_ajax_loader', 'my_wpcf7_ajax_loader');
function pure_post($id) {
$content = get_post($id)->post_content;
echo apply_filters( 'the_content', get_post($id)->post_content );
}
?>