'Top Navigation',
) );
}
}
endif;
/** show the homepage link in the default navigation function wp_page_menu()*/
function andoru_show_home_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'andoru_show_home_menu_args' );
/**
* Register the default widget placement
*/
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name'=>'sidebar',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
));
/**
* Change the date format into ...time ago
*
* @param $datefrom = date to convert
* @param $dateto = timenow , default param = -1 simply ignore this
*
* @return new date format (string)
*/
function timeago($datefromold,$dateto=-1)
{
if($datefromold==0) { return "A long time ago"; }
if($dateto==-1) { $dateto = time(); }
$datefrom = strtotime($datefromold);
$difference = $dateto - $datefrom;
switch(true)
{
case(strtotime('-1 min', $dateto) < $datefrom):
$datediff = $difference;
$res = ($datediff==1) ? $datediff.' second ago' : $datediff.' seconds ago';
break;
case(strtotime('-1 hour', $dateto) < $datefrom):
$datediff = floor($difference / 60);
$res = ($datediff==1) ? $datediff.' minute ago' : $datediff.' minutes ago';
break;
case(strtotime('-1 day', $dateto) < $datefrom):
$datediff = floor($difference / 60 / 60);
$res = ($datediff==1) ? $datediff.' hour ago' : $datediff.' hours ago';
break;
case(strtotime('-1 week', $dateto) < $datefrom):
$day_difference = floor($difference / 60 / 60 / 24);
$res = ($day_difference==1) ? '1 day ago' : $day_difference.' days ago';
break;
case(strtotime('-1 month', $dateto) < $datefrom):
$week_difference = 1;
while (strtotime('-'.$week_difference.' week', $dateto) >= $datefrom)
{
$week_difference++;
}
$datediff = $week_difference;
$res = ($datediff==1) ? 'last week' : $datediff.' weeks ago';
break;
case(strtotime('-2 month', $dateto) < $datefrom):
$months_difference = 2;
while (strtotime('-'.$months_difference.' month', $dateto) >= $datefrom)
{
$months_difference++;
}
$datediff = $months_difference;
$res = ($datediff==2) ? $datediff.' month ago' : $datediff.' months ago';
break;
case(strtotime('-2 month', $dateto) >= $datefrom):
$res = date('F d, Y', strtotime($datefromold) );
break;
}
return $res;
}
/*
remove all space/change space with underscore
*/
function removeAllwhiteSpace($string){
$sPattern = '/\s*/m';
$sReplace = '';
$string = str_replace(" ", "_", $string);
$output = preg_replace( $sPattern, $sReplace, $string );
return strtolower($output);
}
/**
* Manually create an excerpt, will use this in some cases :)
* @param $text = text to be cut,
* @param $limit = length limit
*
* @return string
*/
function limit_text( $text, $limit )
{
// figure out the total length of the string
if( strlen($text)>$limit )
{
# cut the text
$text = substr( $text,0,$limit );
# lose any incomplete word at the end
$text = substr( $text,0,-(strlen(strrchr($text,' '))) );
$text = $text . " ...";
}
// return the processed string
return $text;
}
function printcontent($beforemore = true){
global $post;
$morestring = '';
if( preg_match('//', $post->post_content ) ) {
if( $beforemore ){
$explodemore = explode($morestring, $post->post_content);
$content = apply_filters('the_content',$explodemore[0]);
} else {
$content = get_the_content();
}
} else {
$content = get_the_excerpt();
}
return $content;
}
/**
* Get the URL of thumbnail image
* @param $id = post id,
* @param $size = size of thumbnail (default = post-thumbnail)
*
* @return string (the image URL)
*/
function get_thumbOri($id, $size='post-thumbnail'){
$thumb = get_post_meta($id,'_thumbnail_id',false);
$thumb = wp_get_attachment_image_src($thumb[0], $size, false);
$thumb = $thumb[0];
return $thumb;
}
/* ==== COMMENTS AND PINGS ==== */
function pro_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment; ?>
id="li-comment-">
' . "\n";
$form .= '' . "\n";
$form .= "
" . "\n";
$form .= '' . "\n";
$form .= '
' . "\n";
$form .= '' . "\n";
return $form;
}
add_filter('get_search_form', 'anduro_search_form');
?>
comment_approved == '0') : ?>