Sindbad~EG File Manager
<?php
/* -----------------------------------------------------------------------------------
Here we have all the custom functions for the theme
Please be extremely cautious editing this file,
When things go wrong, they tend to go wrong in a big way.
You have been warned!
----------------------------------------------------------------------------------- */
/*
* When using a child theme you can override certain functions (those wrapped
* in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before
* the parent theme's file, so the child theme functions would be used.
*
* @link http://codex.wordpress.org/Theme_Development
* @link http://codex.wordpress.org/Child_Themes
----------------------------------------------------------------------------------- */
$theme_info = wp_get_theme();
define('ADORE_INC_PATH', get_template_directory() . '/framework');
define('ADORE_FILEPATH', get_template_directory());
define('IMIC_THEME_PATH', get_template_directory_uri());
define('IMIC_FILEPATH', get_template_directory());
//Remove slider revolution Admin Notice
add_action('admin_init', 'adore_remove_revslider_notice');
function adore_remove_revslider_notice()
{
update_option('revslider-valid-notice', false);
update_option('revslider-valid', true);
}
/* THEME INCLUDES
================================================== */
include_once (ADORE_INC_PATH . '/includes.php');
/* -------------------------------------------------------------------------------------
Load Translation Text Domain
----------------------------------------------------------------------------------- */
add_action('after_setup_theme', 'imic_theme_setup');
function imic_theme_setup()
{
load_theme_textdomain('framework', IMIC_FILEPATH . '/language');
}
/* -------------------------------------------------------------------------------------
Menu option
----------------------------------------------------------------------------------- */
function register_menu()
{
register_nav_menu('primary-menu', __('Primary Menu', 'framework'));
register_nav_menu('top-menu', __('Top Menu', 'framework'));
register_nav_menu('footer-menu', __('Footer Menu', 'framework'));
}
add_action('init', 'register_menu');
/* -------------------------------------------------------------------------------------
Set Max Content Width (use in conjuction with ".entry-content img" css)
----------------------------------------------------------------------------------- */
if (!isset($content_width)) $content_width = 680;
/* -------------------------------------------------------------------------------------
Configure WP2.9+ Thumbnails & gets the current post type in the WordPress Admin
----------------------------------------------------------------------------------- */
if (function_exists('add_theme_support'))
{
add_theme_support('post-formats', array(
'video',
'image',
'gallery',
'link',
'audio'
));
add_theme_support('title-tag');
add_theme_support('post-thumbnails');
add_theme_support('automatic-feed-links');
set_post_thumbnail_size(958, 9999);
//Mandatory
add_image_size('100x100', '100', '100', true);
add_image_size('600x400', '600', '400', true);
add_image_size('400x400', '400', '400', true);
add_image_size('330x206', '330', '206', true);
add_image_size('1000x800', '1000', '800', true);
add_image_size('200x125', '200', '125', true);
add_image_size('210x210', '210', '210', true);
add_image_size('800x500', '800', '500', true);
add_theme_support('woocommerce');
add_theme_support('wc-product-gallery-zoom');
add_theme_support('wc-product-gallery-lightbox');
add_theme_support('wc-product-gallery-slider');
}
/* -------------------------------------------------------------------------------------
Custom Gravatar Support
----------------------------------------------------------------------------------- */
if (!function_exists('imic_custom_gravatar'))
{
function imic_custom_gravatar($avatar_defaults)
{
$imic_avatar = get_template_directory_uri() . '/assets/images/img_avatar.png';
$avatar_defaults[$imic_avatar] = 'Custom Gravatar (/assets/images/img_avatar.png)';
return $avatar_defaults;
}
add_filter('avatar_defaults', 'imic_custom_gravatar');
}
/* -------------------------------------------------------------------------------------
For Paginate
----------------------------------------------------------------------------------- */
if (!function_exists('imic_pagination'))
{
function imic_pagination($pages = '', $range = 4, $pagination = '', $status = 'future')
{
$showitems = ($range * 2) + 1;
global $paged;
if (empty($paged)) $paged = 1;
if ($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if (!$pages)
{
$pages = 1;
}
}
$first = ($status == 'past') ? '<li class="pull-right"><a href="' . get_pagenum_link($paged + 1) . '">' . __('Newer', 'framework') . ' → </a></li>' : '<li class="pull-left"><a href="' . get_pagenum_link($paged - 1) . '">← ' . __('Older', 'framework') . '</a></li>';
$second = ($status != 'past') ? '<li class="pull-right"><a href="' . get_pagenum_link($paged + 1) . '">' . __('Newer', 'framework') . ' →</a></li>' : '<li class="pull-left"><a href="' . get_pagenum_link($paged - 1) . '">← ' . __('Older', 'framework') . '</a></li>';
if (1 != $pages)
{
if ($pagination == 'Default')
{
echo '<ul class="pager">';
if (($paged != '') && ($paged != 1))
{
echo '' . $second;
}
if ($pages != $paged)
{
echo '' . $first;
}
echo '</ul>';
}
else
{
echo '<ul class="pagination">';
if(2 < $paged) {
echo '<li><a href="' . get_pagenum_link(1) . '" title="' . __('First', 'framework') . '"><i class="fa fa-chevron-left"></i><i class="fa fa-chevron-left"></i></a></li>';
}
if(1 != $paged) {
echo '<li><a href="' . get_pagenum_link($paged - 1) . '" title="' . __('Prev', 'framework') . '"><i class="fa fa-chevron-left"></i></a></li>';
}
for ($i = 1;$i <= $pages;$i++)
{
if (1 != $pages && (!($i >= $paged + $range + 3 || $i <= $paged - $range - 3) || $pages <= $showitems))
{
if ($paged == $i)
{
echo '<li class="active"><span> ' . $i . ' </span></li>';
}
else
{
echo '<li><a href=" ' . get_pagenum_link($i) . '" class=""> ' . $i . ' </a></li>';
}
}
}
if($paged != $pages) {
echo '<li><a href="' . get_pagenum_link($paged + 1) . '" title="' . __('Next', 'framework') . '"><i class="fa fa-chevron-right"></i></a></li>';
}
if('' != $paged && $paged != $pages) {
echo '<li><a href="' . get_pagenum_link($pages) . '" title="' . __('Last', 'framework') . '"><i class="fa fa-chevron-right"></i><i class="fa fa-chevron-right"></i></a></li>';
}
echo '</ul>';
}
}
}
}
/* -------------------------------------------------------------------------------------
For Remove Dimensions from thumbnail image
----------------------------------------------------------------------------------- */
add_filter('post_thumbnail_html', 'remove_thumbnail_dimensions', 10);
add_filter('image_send_to_editor', 'remove_thumbnail_dimensions', 10);
function remove_thumbnail_dimensions($html)
{
if (!strpos($html, 'attachment-shop_single'))
{
$html = preg_replace('/(width|height)=\"\d*\"\s/', '', $html);
}
return $html;
}
/* -------------------------------------------------------------------------------------
Excerpt More and length
----------------------------------------------------------------------------------- */
if (!function_exists('imic_custom_read_more'))
{
function imic_custom_read_more()
{
return '';
}
}
if (!function_exists('imic_excerpt'))
{
function imic_excerpt($limit = 50)
{
return '<p>' . wp_trim_words(get_the_excerpt() , $limit, imic_custom_read_more()) . '</p>';
}
}
/* Comment Styling
/*----------------------------------------------------------------------------------- */
if (!function_exists('imic_comment'))
{
function imic_comment($comment, $args, $depth)
{
$isByAuthor = false;
if ($comment->comment_author_email == get_the_author_meta('email'))
{
$isByAuthor = true;
}
$GLOBALS['comment'] = $comment;
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div class="post-comment-block">
<div id="comment-<?php comment_ID(); ?>">
<div class="img-thumbnail"><?php echo get_avatar($comment, $size = '40'); ?></div>
<?php
echo preg_replace('/comment-reply-link/', 'comment-reply-link pull-right', get_comment_reply_link(array_merge($args, array(
'depth' => $depth,
'max_depth' => $args['max_depth'],
'reply_text' => '<i class="fa fa-reply"></i>'
))) , 1);
echo '<h5>' . get_comment_author() . __(' says', 'framework') . '</h5>';
?>
<span class="meta-data">
<?php
echo get_comment_date();
_e(' at ', 'framework');
echo get_comment_time();
?>
</span>
<?php if ($comment->comment_approved == '0'): ?>
<em class="moderation"><?php _e('Your comment is awaiting moderation.', 'framework') ?></em>
<br />
<?php
endif; ?>
<div class="comment-text">
<?php comment_text() ?>
</div>
</div>
</div>
<?php
}
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists