author | ymh <ymh.work@gmail.com> |
Tue, 22 Oct 2019 16:11:46 +0200 | |
changeset 15 | 3d4e9c994f10 |
parent 7 | cf61fcea0001 |
child 16 | a86126ab1dd4 |
permissions | -rwxr-xr-x |
0 | 1 |
<?php |
2 |
/* to remove notifications for upgrade wordpress */ |
|
3 |
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) ); |
|
4 |
||
5 |
load_theme_textdomain('pego_tr',get_template_directory() . '/languages'); |
|
6 |
||
7 |
$themedir = get_template_directory_uri(); |
|
8 |
||
9 |
function my_scripts() { |
|
10 |
global $themedir; |
|
11 |
wp_enqueue_script('slides-min-jquery', $themedir . '/js/slides.min.jquery.js','','',true); |
|
15
3d4e9c994f10
Upgrade jquery-ui in in-motion theme version from 1.8.14 to 1.8.22 to avoid 'a.curCSS is not a function' errors in console that caused problems with circles and navigation.
ymh <ymh.work@gmail.com>
parents:
7
diff
changeset
|
12 |
wp_enqueue_script('jquery-ui-min', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.min.js','','',true); |
0 | 13 |
wp_enqueue_script('jquery-easing', $themedir . '/js/jquery.easing.1.3.js','','',true); |
14 |
wp_enqueue_script('jquery-iconmenu', $themedir . '/js/jquery.iconmenu.js','','',true); |
|
15 |
wp_enqueue_script('jquery-nav-min', $themedir . '/js/jquery.nav.min.js','','',true); |
|
16 |
wp_enqueue_script('jquery-nav', $themedir . '/js/jquery.nav.js','','',true); |
|
17 |
wp_enqueue_script('plugins', $themedir . '/js/plugins.js','','',true); |
|
18 |
wp_enqueue_script('jquery-quicksand', $themedir . '/js/jquery.quicksand.js','','',true); |
|
19 |
wp_enqueue_script('main', $themedir . '/js/main.js','','',true); |
|
20 |
wp_enqueue_script('script', $themedir . '/js/script.js','','',true); |
|
21 |
wp_enqueue_script('jquery-tipsy', $themedir . '/js/jquery.tipsy.js','','',true); |
|
22 |
wp_enqueue_script('jquery-validate-pack', $themedir . '/js/jquery.validate.pack.js','','',true); |
|
23 |
wp_enqueue_script('jquery-mousewheel', $themedir . '/fancybox/jquery.mousewheel-3.0.4.pack.js','','',true); |
|
24 |
wp_enqueue_script('jquery-fancybox-pack', $themedir . '/fancybox/jquery.fancybox-1.3.4.pack.js','','',true); |
|
25 |
} |
|
26 |
add_action('init', 'my_scripts'); |
|
27 |
||
28 |
||
29 |
/* specify content width */ |
|
30 |
if ( ! isset( $content_width ) ) $content_width = 960; |
|
31 |
||
32 |
||
33 |
/* code for menus */ |
|
34 |
if (function_exists('register_nav_menus')) { |
|
35 |
register_nav_menus ( |
|
36 |
array ( |
|
37 |
'main_nav' => 'Main Navigation Menu' |
|
38 |
) |
|
39 |
); |
|
40 |
} |
|
41 |
||
42 |
// Declare sidebar widget zone |
|
43 |
if (function_exists('register_sidebar')) { |
|
44 |
register_sidebar(array( |
|
45 |
'name' => 'Sidebar-1 Widgets', |
|
46 |
'id' => 'sidebar-1-widgets', |
|
47 |
'description' => 'These are widgets for the sidebar.', |
|
48 |
'before_widget' => '<div id="%1$s" class="widget %2$s">', |
|
49 |
'after_widget' => '</div></div>', |
|
50 |
'before_title' => '<h3 class="sidebar-style">', |
|
51 |
'after_title' => '</h3><div class="lh15">' |
|
52 |
)); |
|
53 |
} |
|
54 |
||
55 |
/* start footer widgets */ |
|
56 |
function new_widgets_init() { |
|
57 |
register_sidebar(array( |
|
58 |
'name' => 'Footer First Column Sidebar', |
|
59 |
'id' => 'first-footer-column-sidebar', |
|
60 |
'before_widget' => '<div id="%1$s" class="widget %2$s">', |
|
61 |
'after_widget' => '</div>', |
|
62 |
'before_title' => '<h4 class="widget-title">', |
|
63 |
'after_title' => '</h4>', |
|
64 |
)); |
|
65 |
register_sidebar(array( |
|
66 |
'name' => 'Footer Second Column Sidebar', |
|
67 |
'id' => 'second-footer-column-sidebar', |
|
68 |
'before_widget' => '<div id="%1$s" class="widget %2$s">', |
|
69 |
'after_widget' => '</div>', |
|
70 |
'before_title' => '<h4 class="widget-title">', |
|
71 |
'after_title' => '</h4>', |
|
72 |
)); |
|
73 |
register_sidebar(array( |
|
74 |
'name' => 'Footer Third Column Sidebar', |
|
75 |
'id' => 'third-footer-column-sidebar', |
|
76 |
'before_widget' => '<div id="%1$s" class="widget %2$s">', |
|
77 |
'after_widget' => '</div>', |
|
78 |
'before_title' => '<h4 class="widget-title">', |
|
79 |
'after_title' => '</h4>', |
|
80 |
)); |
|
81 |
register_sidebar(array( |
|
82 |
'name' => 'Footer Fourth Column Sidebar', |
|
83 |
'id' => 'fourth-footer-column-sidebar', |
|
84 |
'before_widget' => '<div id="%1$s" class="widget %2$s">', |
|
85 |
'after_widget' => '</div>', |
|
86 |
'before_title' => '<h4 class="widget-title">', |
|
87 |
'after_title' => '</h4>', |
|
88 |
)); |
|
89 |
} |
|
90 |
add_action( 'init', 'new_widgets_init' ); |
|
91 |
/* end footer widgets */ |
|
92 |
||
93 |
||
94 |
add_theme_support('post-thumbnails'); |
|
95 |
||
96 |
||
97 |
||
98 |
if(!function_exists('getPageTitle')) |
|
99 |
{ |
|
100 |
function getPageTitle($pageId) |
|
101 |
{ |
|
102 |
if(!is_numeric($pageId)) |
|
103 |
{ |
|
104 |
return; |
|
105 |
} |
|
106 |
global $wpdb; |
|
107 |
$sql_query = 'SELECT DISTINCT * FROM ' . $wpdb->posts . |
|
108 |
' WHERE ' . $wpdb->posts . '.ID=' . $pageId; |
|
109 |
$posts = $wpdb->get_results($sql_query); |
|
110 |
if(!empty($posts)) |
|
111 |
{ |
|
112 |
foreach($posts as $post) |
|
113 |
{ |
|
114 |
return nl2br($post->post_title); |
|
115 |
} |
|
116 |
} |
|
117 |
} |
|
118 |
} |
|
119 |
||
120 |
||
121 |
function getPostViews($postID){ |
|
122 |
$count_key = 'post_views_count'; |
|
123 |
$count = get_post_meta($postID, $count_key, true); |
|
124 |
if($count==''){ |
|
125 |
delete_post_meta($postID, $count_key); |
|
126 |
add_post_meta($postID, $count_key, '0'); |
|
127 |
return "0 View"; |
|
128 |
} |
|
129 |
return $count; |
|
130 |
} |
|
131 |
function setPostViews($postID) { |
|
132 |
$count_key = 'post_views_count'; |
|
133 |
$count = get_post_meta($postID, $count_key, true); |
|
134 |
if($count==''){ |
|
135 |
$count = 0; |
|
136 |
delete_post_meta($postID, $count_key); |
|
137 |
add_post_meta($postID, $count_key, '0'); |
|
138 |
}else{ |
|
139 |
$count++; |
|
140 |
update_post_meta($postID, $count_key, $count); |
|
141 |
} |
|
142 |
} |
|
143 |
function SearchFilter($query) { |
|
144 |
if ($query->is_search) { |
|
145 |
$query->set('post_type', 'post'); |
|
146 |
} |
|
147 |
return $query; |
|
148 |
} |
|
149 |
||
150 |
add_filter('pre_get_posts','SearchFilter'); |
|
151 |
||
152 |
include("functions/widget-posts.php"); |
|
153 |
include("functions/widget-twitter.php"); |
|
154 |
include("functions/widget-Flickr.php"); |
|
155 |
include("functions/widget-video.php"); |
|
156 |
include("functions/custom-post.php"); |
|
157 |
include("functions/custom-portfolio.php"); |
|
158 |
include("functions/custom-page.php"); |
|
159 |
include("functions/shortcodes.php"); |
|
160 |
include("functions/contact.php"); |
|
161 |
||
162 |
||
163 |
function menu($page_number){ |
|
164 |
echo '<ul class="menu menu-inside">'; |
|
165 |
$page_args = array('sort_order' => 'ASC', 'sort_column' => 'menu_order'); |
|
166 |
$pages = get_pages($page_args); |
|
167 |
$menu_items=1; |
|
168 |
foreach ($pages as $single_page) { |
|
169 |
$trenutni=""; |
|
170 |
if ($page_number == $menu_items) { $trenutni="class='current'";} |
|
171 |
//if(($menu_items==1)&&(!is_single())){ $trenutni=" current";} |
|
172 |
||
173 |
$pageTemplate= get_post_meta($single_page->ID , 'page_template' , true); |
|
174 |
if((($pageTemplate=='Blog')&&(is_single()))||(($pageTemplate=='Blog')&&(is_search()))||(($pageTemplate=='Blog')&&(is_archive()))) |
|
175 |
{ |
|
176 |
$trenutni="class='current'"; |
|
177 |
} |
|
178 |
||
179 |
$pageInMenu= get_post_meta($single_page->ID, 'show_page_in_menu' , true); |
|
180 |
$url_tab = "#"; |
|
181 |
if (!is_front_page()){ |
|
182 |
$url_tab = get_option("siteurl")."#"; |
|
183 |
} |
|
184 |
$menu_items++; |
|
185 |
if ($pageInMenu == 'Yes') { |
|
186 |
echo '<li '.$trenutni.'><a class="boxes" href="' . $url_tab . $single_page->post_name . '">' . $single_page->post_title . '</a></li> '; |
|
187 |
} |
|
188 |
} |
|
189 |
echo '</ul>'; |
|
190 |
} |
|
191 |
||
192 |
function topHeaderDisplay() |
|
193 |
{ |
|
194 |
echo '<div id="top-header">'; |
|
195 |
echo '<div id="logo2">'; |
|
196 |
if ( function_exists( 'get_option_tree' ) ) { |
|
197 |
$logo = get_option_tree( 'logo' ); |
|
198 |
} |
|
199 |
if ( $logo ) { |
|
200 |
echo '<a href="'.home_url().'" title="Go Home"><img src="'. get_option_tree( 'logo' ) .'" /></a>'; |
|
201 |
} |
|
202 |
||
203 |
echo '</div>'; |
|
204 |
$socials2=''; |
|
205 |
if ( function_exists( 'get_option_tree' ) ) { |
|
206 |
if (get_option_tree( 'social_icons')) { |
|
207 |
$socials2= get_option_tree( 'social_icons', $option_tree, false, true, -1 ); |
|
208 |
$img_num = 1; |
|
209 |
if(!empty($socials2)){ |
|
210 |
echo '<div class="all-socials">'; |
|
211 |
echo '<ul class="tt-wrapper2">'; |
|
212 |
||
213 |
||
214 |
foreach( $socials2 as $social ) { |
|
215 |
echo '<li><a href="'.$social['link'].'" target="_blank" title="'.$social['title'].'" style="background: transparent url('.$social['image'].') no-repeat top left;"><span>'.$social['title'].'</span></a></li>'; |
|
216 |
} |
|
217 |
echo '</ul></div>'; |
|
218 |
} } } |
|
219 |
echo '</div>'; |
|
220 |
} |
|
221 |
||
222 |
||
1
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
223 |
function get_image_path($image) { |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
224 |
global $blog_id; |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
225 |
if (isset($blog_id) && $blog_id > 0) { |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
226 |
$wpcontentPos = strpos($image, '/wp-content/'); |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
227 |
if($wpcontentPos) { |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
228 |
$image = substr($image, $wpcontentPos); |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
229 |
} |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
230 |
} |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
231 |
return $image; |
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
232 |
} |
0 | 233 |
|
234 |
||
235 |
/* start for comments */ |
|
236 |
if ( ! function_exists( 'inmotion_comment' ) ) : |
|
237 |
function inmotion_comment( $comment, $args, $depth ) { |
|
238 |
$GLOBALS['comment'] = $comment; |
|
239 |
switch ( $comment->comment_type ) : |
|
240 |
case 'pingback' : |
|
241 |
case 'trackback' : |
|
242 |
?> |
|
243 |
<li class="post pingback"> |
|
244 |
<p><?php _e( 'Pingback:', 'twentyeleven' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?></p> |
|
245 |
<?php |
|
246 |
break; |
|
247 |
default : |
|
248 |
?> |
|
249 |
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> |
|
250 |
<article id="comment-<?php comment_ID(); ?>" class="comment"> |
|
251 |
<footer class="comment-meta"> |
|
252 |
<div class="comment-author vcard"> |
|
253 |
<?php |
|
254 |
$avatar_size = 39; |
|
255 |
if ( '0' != $comment->comment_parent ) |
|
256 |
$avatar_size = 39; |
|
257 |
||
258 |
echo get_avatar( $comment, $avatar_size ); |
|
259 |
||
260 |
/* translators: 1: comment author, 2: date and time */ |
|
261 |
printf( '%1$s <span class="date-and-time">%2$s</span>', |
|
262 |
sprintf( '<span class="fn">%s</span>', get_comment_author_link() ), |
|
263 |
sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>', |
|
264 |
esc_url( get_comment_link( $comment->comment_ID ) ), |
|
265 |
get_comment_time( 'c' ), |
|
266 |
/* translators: 1: date, 2: time */ |
|
267 |
sprintf( '%1$s at %2$s', get_comment_date(), get_comment_time() ) |
|
268 |
) |
|
269 |
); |
|
270 |
?> |
|
271 |
||
272 |
<?php edit_comment_link( __( 'Edit', 'pego_tr' ), '<span class="edit-link">', '</span>' ); ?> |
|
273 |
</div><!-- .comment-author .vcard --> |
|
274 |
||
275 |
<?php if ( $comment->comment_approved == '0' ) : ?> |
|
276 |
<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'pego_tr' ); ?></em> |
|
277 |
<br /> |
|
278 |
<?php endif; ?> |
|
279 |
||
280 |
</footer> |
|
281 |
||
282 |
<div class="comment-content"><?php comment_text(); ?></div> |
|
283 |
||
284 |
<div class="reply"> |
|
285 |
<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'pego_tr' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> |
|
286 |
</div><!-- .reply --> |
|
287 |
</article><!-- #comment-## --> |
|
288 |
||
289 |
<?php |
|
290 |
break; |
|
291 |
endswitch; |
|
292 |
} |
|
293 |
endif; // ends check for inmotion_comment() |
|
294 |
||
295 |
/* end for comments */ |
|
296 |
||
1
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
297 |
?> |