Sindbad~EG File Manager
<?php
/*------------------------------------*\
Includes / Requires
\*------------------------------------*/
require_once(get_template_directory().'/model/index.php');
/*------------------------------------*\
Functions
\*------------------------------------*/
function myfavicon() {
echo '<link rel="Shortcut Icon" href="'.get_template_directory_uri().'/public/assets/images/favicon.png" />';
}
add_action('wp_head', 'myfavicon');
// Paginação
function pagination()
{
global $wp_query;
$big = 999999999;
echo paginate_links(array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages
));
}
function images_path()
{
return get_template_directory_uri(). '/public/assets/images';
}
// Substitui o texto "Read More" de the_excerpt por um link
function new_excerpt_more($more)
{
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Continue lendo...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
function dd($dump)
{
echo "<pre>";
var_dump($dump);
echo "</pre>";
}
function get_years($range = 5)
{
$years = [];
for ($year=1; $year < ($range - 1); $year++) {
if($year === 1) {
$years[date('Y', strtotime('+'.$year.' year'))] = '+'.$year.' year';
$years[date('Y', strtotime('Y'))] = 'Y';
$years[date('Y', strtotime('-'.$year.' year'))] = '-'.$year.' year';
}
$years[date('Y', strtotime('-'.$year.' year'))] = '-'.$year.' year';
}
return $years;
}
// Localization Support
load_theme_textdomain('itt', get_template_directory() . '/languages');
/*------------------------------------*\
Actions + Filters + ShortCodes
\*------------------------------------*/
//Add Actions
// Add Theme suports
add_theme_support('post-thumbnails'); // Adiciona a imagem de descricao no post
add_theme_support('menus');
add_image_size('large', 700, '', true);
add_image_size('medium', 250, '', true);
add_image_size('small', 120, '', true);
add_image_size('custom-size', 700, 200, true);
// disable admin bar for all users
show_admin_bar(false);
function splitText($text, $maxLength)
{
/* Make sure that the string will not be longer
than $maxLength.
*/
if(strlen($text) > $maxLength)
{
/* Trim the text to $maxLength characters */
$text = substr($text, 0, $maxLength - 1);
/* Split words only at boundaries. This will be
accomplished by moving back each character from
the end of the split string until a space is found.
*/
while(substr($text,-1) != ' ')
{
$text = substr($text, 0, -1);
}
/* Remove the whitespace at the end. */
$text = rtrim($text);
}
return $text;
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists