first commit
This commit is contained in:
79
functions.php
Normal file
79
functions.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php load_theme_textdomain('CreatorThemeRes-child', get_template_directory() . '-child/languages'); ?>
|
||||
<?php
|
||||
|
||||
/*
|
||||
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
|
||||
|
||||
function enqueue_parent_styles() {
|
||||
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
|
||||
}
|
||||
*/
|
||||
/**/
|
||||
function my_theme_enqueue_styles() {
|
||||
|
||||
//$parent_style = 'CreatorThemeRes-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
|
||||
$parent_style = 'parent_style';
|
||||
|
||||
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
|
||||
wp_enqueue_style( 'child-style',
|
||||
get_stylesheet_directory_uri() . '/style.css',
|
||||
array( $parent_style ),
|
||||
wp_get_theme()->get('Version')
|
||||
);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
|
||||
|
||||
|
||||
add_filter( 'body_class', 'custom_class' );
|
||||
function custom_class( $classes ) {
|
||||
/*
|
||||
if ( is_page_template( 'page-example.php' ) ) {
|
||||
$classes[] = 'example';
|
||||
}
|
||||
*/
|
||||
if (is_archive()) {
|
||||
$classes[] = 'page-template-tpl-blog';
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
|
||||
|
||||
function RelativeTime() {
|
||||
|
||||
$jour = get_the_date('U');
|
||||
$aujourdhui = date('U');
|
||||
$delta = round(($aujourdhui - $jour) / (3600 * 24));
|
||||
|
||||
if ($delta == 0) $text = "aujourd'hui";
|
||||
elseif ($delta == 1) $text = __("yesterday", 'CreatorThemeRes-child');
|
||||
elseif ($delta == 2) $text = __("the day before yesterday", 'CreatorThemeRes-child');
|
||||
elseif ($delta == 3) $text = __("two days ago", 'CreatorThemeRes-child');
|
||||
elseif (($delta > 3) and ($delta <= 7)) $text = sprintf( __('%1$s days ago', 'CreatorThemeRes-child'), $delta );
|
||||
elseif (($delta > 7) and ($delta <= 14)) {
|
||||
$nb = round ($delta / 7);
|
||||
if ($nb < 2) $text = sprintf( __('%1$s week ago', 'CreatorThemeRes-child'), $nb );
|
||||
else $text = sprintf( __('%1$s weeks ago', 'CreatorThemeRes-child'), $nb );
|
||||
}
|
||||
else $text = get_the_date();
|
||||
|
||||
/*
|
||||
printf( __( '%1$s', 'CreatorThemeRes-child' ),
|
||||
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">'.$text.'</a>',
|
||||
get_permalink(),
|
||||
esc_attr( get_the_date() . ' ' . get_the_time() )
|
||||
)
|
||||
);
|
||||
*/
|
||||
echo $text;
|
||||
}
|
||||
|
||||
|
||||
function preprint($s, $return=false) {
|
||||
$x = "<pre>";
|
||||
$x .= print_r($s, 1);
|
||||
$x .= "</pre>";
|
||||
if ($return) return $x;
|
||||
else print $x;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user