|
Server IP : 10.131.40.8 / Your IP : 216.73.216.15 Web Server : Apache System : Linux webd008.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : ludmqhh ( 137773) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/ludmqhh/www/provence-plomberie/../guillaume/wp-content/themes/flexblog/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* ----------------------------------------------------------------------------------------
* Define
* ----------------------------------------------------------------------------------------
*/
define( 'INFINITY_THEMEROOT', get_template_directory_uri() );
define( 'INFINITY_SCRIPTS', INFINITY_THEMEROOT . '/js' );
/**
* ----------------------------------------------------------------------------------------
* Load the custom scripts
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_scripts' ) ) {
function infinity_scripts() {
// Enqueue the stylesheets
wp_enqueue_style( 'infinity-main-style', get_stylesheet_uri() );
wp_enqueue_style( 'owl-carousel', INFINITY_THEMEROOT . '/css/owl.carousel.css' );
wp_enqueue_style( 'magnific-popup', INFINITY_THEMEROOT . '/css/magnific-popup.css' );
wp_enqueue_style( 'infinity-mediaquery', INFINITY_THEMEROOT . '/css/mediaquery.css' );
wp_enqueue_style( 'font-awesome', INFINITY_THEMEROOT . '/css/font-awesome.min.css' );
wp_enqueue_style( 'fontello', INFINITY_THEMEROOT . '/css/fontello.css' );
wp_enqueue_style( 'animsition', INFINITY_THEMEROOT . '/css/animsition.min.css' );
wp_enqueue_style( 'perfect-scrollbar', INFINITY_THEMEROOT . '/css/perfect-scrollbar.css' );
// Adds support for pages with threaded comments
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Enqueue the custom scripts
wp_enqueue_script( 'infinity-plugins', INFINITY_SCRIPTS.'/infinity-plugins.min.js', array( 'jquery' ), false, true );
wp_enqueue_script( 'infinity-custom-scripts', INFINITY_SCRIPTS . '/custom-scripts.min.js', array( 'jquery' ), false, true );
}
add_action( 'wp_enqueue_scripts', 'infinity_scripts' );
}
/**
* ----------------------------------------------------------------------------------------
* Require File
* ----------------------------------------------------------------------------------------
*/
// Customizer
require_once( get_template_directory() .'/framework/customizer/infinity-customizer.php');
// Dynamic Css
require_once( get_template_directory() .'/framework/customizer/css/dynamic-css.php');
// Google Analytics
require_once( get_template_directory() .'/framework/customizer/google-analytics.php');
// Tgm Plugin Activation
require_once ( get_template_directory() .'/framework/plugins/tgm-plugin-activation/class-tgm-plugin-activation.php');
// Post Like
require get_template_directory() . '/framework/plugins/post-likes/post-likes.php';
// Load Metaboxes
require get_template_directory() . '/framework/metaboxes/infinity-metaboxs.php';
// Custom Ads Widget
require get_template_directory() . '/framework/widgets/custom-ads.php';
// Social Widget
require get_template_directory() . '/framework/widgets/social-widget.php';
// Featured Posts Widget
require get_template_directory() . '/framework/widgets/featured-posts-widget.php';
// Author Widget
require get_template_directory() . '/framework/widgets/author-widget.php';
/**
* ----------------------------------------------------------------------------------------
* theme activation
* ----------------------------------------------------------------------------------------
*/
add_action('after_switch_theme', 'infinity_setup_options');
function infinity_setup_options () {
require_once( get_template_directory() . '/framework/customizer/theme-activation.php' );
}
/**
* ----------------------------------------------------------------------------------------
* Register Fonts
* ----------------------------------------------------------------------------------------
*/
function infinity_playfair_font_url() {
$font_url = '';
if ( 'off' !== _x( 'on', 'Google font: on or off', 'flexblog' ) ) {
$font_url = add_query_arg( 'family', urlencode( 'Playfair Display:400,700&subset=latin,latin-ext' ), "//fonts.googleapis.com/css" );
}
return $font_url;
}
function infinity_opensans_font_url() {
$font_url = '';
if ( 'off' !== _x( 'on', 'Google font: on or off', 'flexblog' ) ) {
$font_url = add_query_arg( 'family', urlencode( 'Open Sans:400italic,400,600italic,600,700italic,700&subset=latin,latin-ext' ), "//fonts.googleapis.com/css" );
}
return $font_url;
}
/*
Enqueue scripts and styles.
*/
function infinity_gfonts_scripts() {
wp_enqueue_style( 'infinity-playfair-font', infinity_playfair_font_url(), array(), '1.0.0' );
wp_enqueue_style( 'infinity-opensans-font', infinity_opensans_font_url(), array(), '1.0.0' );
}
add_action( 'wp_enqueue_scripts', 'infinity_gfonts_scripts' );
/**
* ----------------------------------------------------------------------------------------
* Custom Tgm Activation
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_tgm_activation' ) ) {
function infinity_tgm_activation() {
$plugins = array(
// Flexblog Core
array(
'name' => 'Flexblog Core ',
'slug' => 'flexblog-core',
'source' => INFINITY_THEMEROOT . '/framework/plugins/flexblog-core.zip',
'version' => '1.0',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
),
// AJAX Thumbnail Rebuild
array(
'name' => 'AJAX Thumbnail Rebuild',
'slug' => 'ajax-thumbnail-rebuild',
'required' => true
),
// WP Instagram Widget
array(
'name' => 'Instagram Slider Widget',
'slug' => 'instagram-slider-widget',
'required' => false,
),
// Facebook Widget
array(
'name' => 'Facebook Widget',
'slug' => 'facebook-pagelike-widget',
'required' => false,
),
// Contact Form 7
array(
'name' => 'Contact Form 7',
'slug' => 'contact-form-7',
'required' => false,
),
// Royal Backend Gallery
array(
'name' => 'Royal Backend Gallery',
'slug' => 'royal-backend-gallery',
'source' => INFINITY_THEMEROOT . '/framework/plugins/royal-backend-gallery.zip',
'required' => true,
'version' => '1.0',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
),
// Envato Wordpress Toolkit
array(
'name' => 'Envato Wordpress Toolkit Master',
'slug' => 'envato-wordpress-toolkit-master',
'source' => INFINITY_THEMEROOT . '/framework/plugins/envato-wordpress-toolkit-master.zip',
'version' => '1.0',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
),
);
tgmpa( $plugins );
}
}
add_action( 'tgmpa_register', 'infinity_tgm_activation' );
/**
* ----------------------------------------------------------------------------------------
* Set up theme default / supported features
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_setup' ) ) {
function infinity_setup() {
// Title Support
add_theme_support('title-tag');
// Add support for post formats
add_theme_support( 'post-formats',
array(
'gallery',
'link',
'image',
'quote',
'video',
'audio'
)
);
// Register nav menus
register_nav_menus(
array(
'top-menu' => esc_html__( 'Top Menu', 'flexblog' ),
'main-menu' => esc_html__( 'Main Menu', 'flexblog' )
)
);
// Content Width
if ( ! isset( $content_width ) ) {
$content_width = 960;
}
}
add_action( 'after_setup_theme', 'infinity_setup' );
}
// Load Language File For Translation
load_theme_textdomain( 'flexblog', INFINITY_THEMEROOT .'/languages' );
// Add support for automatic feed links
add_theme_support( 'automatic-feed-links' );
// Add support for post thumbnails
add_theme_support( 'post-thumbnails' );
// Get Carousel Data
$general_options = get_option( 'infinity_general' );
$carousel_options = get_option( 'infinity_carousel' );
$content_options = get_option( 'infinity_content' );
// Image Size
add_image_size( 'infinity-carousel-thumbnail', $carousel_options['width'], $carousel_options['height'], true );
add_image_size( 'infinity-full-thumbnail', $general_options['width'], 0, true );
add_image_size( 'infinity-grid-thumbnail', $content_options['grid_thumb_width'], $content_options['grid_thumb_height'], true );
add_image_size( 'infinity-list-thumbnail', $content_options['list_thumb_width'], $content_options['list_thumb_height'], true );
/**
* ----------------------------------------------------------------------------------------
* Register the widgets
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_widget_init' ) ) {
function infinity_widget_init() {
if ( function_exists( 'register_sidebar' ) ) {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Widget Area', 'flexblog' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Page Sidebar widgetized area.', 'flexblog' ),
'before_widget' => '<div id="%1$s" class="infinity-widget %2$s">',
'after_widget' => '</div> <!-- end widget -->',
'before_title' => '<div class="widget-title"><h3>',
'after_title' => '</h3></div>'
)
);
register_sidebar(
array(
'name' => esc_html__( 'Fixed Sidebar Widget Area', 'flexblog' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Page Fixed Sidebar widgetized area.', 'flexblog' ),
'before_widget' => '<div id="%1$s" class="infinity-widget %2$s">',
'after_widget' => '</div> <!-- end widget -->',
'before_title' => '<div class="widget-title"><h3>',
'after_title' => '</h3> </div>'
)
);
register_sidebar(
array(
'name' => esc_html__( 'Instagram Widget Area', 'flexblog' ),
'id' => 'sidebar-3',
'description' => esc_html__( 'Page Instagram widgetized area.', 'flexblog' ),
'before_widget' => '<div id="%1$s" class="instagram-widget %2$s">',
'after_widget' => '<div class="clear"></div></div> <!-- end widget -->',
'before_title' => '<div class="instagram-title"><h3>',
'after_title' => '</h3> </div>'
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Widget Area 1', 'flexblog' ),
'id' => 'sidebar-4',
'description' => esc_html__( 'Page Footer widgetized area.', 'flexblog' ),
'before_widget' => '<div id="%1$s" class="infinity-widget %2$s">',
'after_widget' => '</div> <!-- end widget -->',
'before_title' => '<div class="widget-title"><h3>',
'after_title' => '</h3> </div>'
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Widget Area 2', 'flexblog' ),
'id' => 'sidebar-5',
'description' => esc_html__( 'Page Footer widgetized area.', 'flexblog' ),
'before_widget' => '<div id="%1$s" class="infinity-widget %2$s">',
'after_widget' => '</div> <!-- end widget -->',
'before_title' => '<div class="widget-title"><h3>',
'after_title' => '</h3> </div>'
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Widget Area 3', 'flexblog' ),
'id' => 'sidebar-6',
'description' => esc_html__( 'Page Footer widgetized area.', 'flexblog' ),
'before_widget' => '<div id="%1$s" class="infinity-widget %2$s">',
'after_widget' => '</div> <!-- end widget -->',
'before_title' => '<div class="widget-title"><h3>',
'after_title' => '</h3> </div>'
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Widget Area 4', 'flexblog' ),
'id' => 'sidebar-7',
'description' => esc_html__( 'Page Footer widgetized area.', 'flexblog' ),
'before_widget' => '<div id="%1$s" class="infinity-widget %2$s">',
'after_widget' => '</div> <!-- end widget -->',
'before_title' => '<div class="widget-title"><h3>',
'after_title' => '</h3> </div>'
)
);
}
}
add_action( 'widgets_init', 'infinity_widget_init' );
}
/**
* ----------------------------------------------------------------------------------------
* Custom Excerpt Length
* ----------------------------------------------------------------------------------------
*/
function infinity_excerpt_length() {
return 2000;
}
add_filter( 'excerpt_length', 'infinity_excerpt_length', 999 );
function infinity_new_excerpt( $more ) {
return '...';
}
add_filter( 'excerpt_more', 'infinity_new_excerpt' );
if ( ! function_exists( 'infinity_excerpt' ) ) {
function infinity_excerpt($limit) {
return '<p>'.wp_trim_words(get_the_excerpt(), $limit).'</p>';
}
}
/**
* ----------------------------------------------------------------------------------------
* Get Excerpt By Id
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'get_excerpt_by_id' ) ) {
function get_excerpt_by_id($post_id){
$the_post = get_post($post_id);
if (!$the_post) {
return;
}
$the_excerpt = $the_post->post_content;
$excerpt_length = 45;
$the_excerpt = strip_tags(strip_shortcodes($the_excerpt));
$words = explode(' ', $the_excerpt, $excerpt_length + 1);
if(count($words) > $excerpt_length) :
array_pop($words);
array_push($words, '');
$the_excerpt = implode(' ', $words);
endif;
return $the_excerpt;
}
}
/**
* ----------------------------------------------------------------------------------------
* Adding Post & Page Classes
* ----------------------------------------------------------------------------------------
*/
function infinity_post_classes( $classes, $class, $post_id ) {
if( is_single() ) {
$classes[] .= 'infinity-single-post';
} else if ( is_page() ) {
$classes[] .= 'infinity-page main-post';
} else {
$classes[] .= 'main-post';
}
return $classes;
}
add_filter( 'post_class', 'infinity_post_classes', 10, 3 );
/**
* ----------------------------------------------------------------------------------------
* Adding Body Classes
* ----------------------------------------------------------------------------------------
*/
function infinity_body_classes( $classes ) {
$general_options = get_option( 'infinity_general' );
$classes[] = ($general_options['effect'])?'animsition':'';
return $classes;
}
add_filter( 'body_class','infinity_body_classes' );
/**
* ----------------------------------------------------------------------------------------
* Custom Search Form
* ----------------------------------------------------------------------------------------
*/
function infinity_search_form( $value = false ) {
$placeholder = esc_html__( 'Search...', 'flexblog');
if ( $value === true ) {
$placeholder = esc_html__('Type and hit Enter...', 'flexblog');
}
$form = '<form method="get" action="'. esc_url( home_url( '/' ) ) .'" class="infinity-search" >';
$form .= '<input id="s" class="search_input" type="text" name="s" placeholder="'. $placeholder .'">';
$form .= '<button type="submit" class="submit button" name="submit" ><i class="fa fa-search" ></i></button>';
$form .= '</form>';
return $form;
}
add_filter( 'get_search_form', 'infinity_search_form' );
/**
* ----------------------------------------------------------------------------------------
* Infinity Kses function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_kses' ) ) {
function infinity_kses( $value ) {
echo wp_kses( $value, array(
'a' => array(
'href' => array(),
'target'=> array(),
'title' => array()
),
'i' => array(
'class' => array(),
),
'em' => array(),
'strong' => array(),
) );
}
}
/**
* ----------------------------------------------------------------------------------------
* Info Area
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_info_area' ) ) {
function infinity_info_area() {
// Get Data
$carousel_options = get_option( 'infinity_carousel' ); ?>
<?php if ( $carousel_options['info_title'] || $carousel_options['info_text'] ) { ?>
<div class="info-area">
<?php
if ( $carousel_options['info_title'] ) {
echo '<h4>';
infinity_kses( $carousel_options['info_title'] );
echo '</h4>';
}
if ( $carousel_options['info_text'] ) {
echo '<p>';
infinity_kses( $carousel_options['info_text'] );
echo '</p>';
} ?>
</div>
<?php }
}
}
/**
* ----------------------------------------------------------------------------------------
* Random button Function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_random_btn' ) ) {
function infinity_random_btn() {
$args = array(
'orderby' => 'rand',
'posts_per_page' => 1
);
$rand_posts = new WP_Query( $args );
while ( $rand_posts->have_posts() ) : $rand_posts->the_post();?>
<a class="random-btn" href="<?php the_permalink(); ?>">
<span class="btn-info"><?php esc_html_e( 'Random Post', 'flexblog' ); ?></span>
<i class="fa fa-retweet"></i>
</a>
<?php endwhile;
wp_reset_postdata();
}
}
/**
* ----------------------------------------------------------------------------------------
* Nav Menu Function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_nav_menu' ) ) {
function infinity_nav_menu( $infinity_nav_class = '', $infinity_theme_location = '', $infinity_depth = 0 ) {
if ( has_nav_menu( $infinity_theme_location ) ) {
wp_nav_menu( array(
'theme_location' => $infinity_theme_location,
'container' => 'nav',
'container_class' => $infinity_nav_class,
'menu_class' => '',
'depth' => $infinity_depth
));
} else {
echo '<nav class="'. esc_attr( $infinity_nav_class ) .'">';
echo '<ul>';
echo '<li>';
echo '<a class="set-up" href="'. esc_url(home_url('/') .'wp-admin/nav-menus.php') .'">'. esc_html__( 'Set Up Menu', 'flexblog' ) .'</a>';
echo '</li>';
echo '</ul>';
echo '</nav>';
}
}
}
/**
* ----------------------------------------------------------------------------------------
* Header Bottom Function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_header_bottom' ) ) {
function infinity_header_bottom( $header_bottom_class = 'header-bottom' ) {
// Get Data
$header_options = get_option( 'infinity_header' );
?>
<div class="<?php echo esc_attr( $header_bottom_class ); ?>">
<div class="center-width">
<!-- Random Button -->
<?php
if ( $header_bottom_class==='header-bottom' ) {
infinity_random_btn();
} else { ?>
<div class="mini-logo">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr( bloginfo('name') ); ?>" >
<img src="<?php echo esc_url( $header_options['mini_logo'] ); ?>" alt="<?php esc_attr( bloginfo('name') ); ?>">
</a>
</div>
<?php } ?>
<div class="nav-btn">
<i class="fa fa-bars"></i>
</div>
<!-- Display Navigation -->
<?php
infinity_nav_menu('nav', 'main-menu');
?>
<!-- Display Mobile Navigation -->
<?php
$merge_menu = wp_nav_menu( array(
'theme_location' => 'top-menu',
'fallback_cb' => false,
'container' => '',
'items_wrap' => '%3$s',
'echo' => false
) );
if ( has_nav_menu( 'main-menu' ) ) {
wp_nav_menu( array(
'theme_location' => 'main-menu',
'container' => 'nav',
'container_class' => 'nav-mobile',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s ' . $merge_menu . '</ul>',
) );
} ?>
<!-- Search Button -->
<div class="search-btn">
<span class="btn-info"><?php esc_html_e( 'Search', 'flexblog' ); ?></span>
<i class="fa fa-search"></i>
</div>
<div class="clear"></div>
</div>
</div>
<?php
}
}
/**
* ----------------------------------------------------------------------------------------
* Infinity Pagination
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_pagination' ) ) {
function infinity_pagination( $pages = '', $range = 2 ) {
// Get Data
$content_options = get_option( 'infinity_content' );
$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;
}
}
if( $pages == 1 ) {
return;
}
echo '<div class="infinity-pagination">';
if ( 1 != $pages && $content_options['pagination'] === 'numbered' ) {
echo '<div class="numbered-list">';
if ( $paged > 2 && $paged > $range+1 && $showitems < $pages ) {
echo "<a href='".esc_url( get_pagenum_link(1) )."'><i class='fa fa-angle-double-left'></i></a>";
}
if ( $paged > 1 ) {
echo "<a href='".esc_url( get_pagenum_link( $paged - 1 ) )."'><i class='fa fa-angle-left'></i></a>";
}
for ( $i=1; $i <= $pages; $i++ ) {
if (1 != $pages &&( !( $i >= $paged+$range+1 || $i <= $paged-$range-1 ) || $pages <= $showitems ) ) {
echo ( $paged == $i )? "<span class='numbered-current'>".$i."</span>":"<a href='".esc_url( get_pagenum_link( $i ) )."' class='numbered-inactive' >".$i."</a>";
}
}
if ( $paged < $pages ) {
echo "<a href='". esc_url( get_pagenum_link( $paged + 1 ) )."'><i class='fa fa-angle-right'></i></a>";
}
if ( $paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages ) {
echo "<a href='". esc_url( get_pagenum_link($pages) )."'><i class='fa fa-angle-double-right'></i></a>";
}
echo '</div>';
} else if ( $content_options['pagination'] === 'default' ) { ?>
<?php if ( get_next_posts_link() ) : ?>
<div class="default-previous">
<?php next_posts_link( '<i class="fa fa-long-arrow-left" ></i> '. esc_html__( 'Older', 'flexblog' ) ); ?>
</div>
<?php endif; ?>
<?php if ( get_previous_posts_link() ) : ?>
<div class="default-next">
<?php previous_posts_link( esc_html__( 'Newer', 'flexblog' ). ' <i class="fa fa-long-arrow-right" ></i>' ); ?>
</div>
<?php endif; ?>
<div class="clear"></div>
<?php } else {
if ( get_next_posts_link() ) : ?>
<div class="default-next">
<?php next_posts_link( esc_html__( 'Older', 'flexblog' ). ' <i class="fa fa-long-arrow-right" ></i>' ); ?>
</div>
<?php endif; ?>
<div class="numbered-list">
<?php
for ( $i=1; $i <= $pages; $i++ ) {
if (1 != $pages &&( !( $i >= $paged+$range+1 || $i <= $paged-$range-1 ) || $pages <= $showitems ) ) {
echo ( $paged == $i )? "<span class='numbered-current'>".$i."</span>":"<a href='".esc_url( get_pagenum_link( $i ) )."' class='numbered-inactive' >".$i."</a>";
}
}
?>
</div>
<?php if ( get_previous_posts_link() ) : ?>
<div class="default-previous">
<?php previous_posts_link( '<i class="fa fa-long-arrow-left" ></i> '. esc_html__( 'Newer', 'flexblog' ) ); ?>
</div>
<?php endif;
echo '<div class="clear"></div>';
}
echo '</div>';
}
}
/**
* ----------------------------------------------------------------------------------------
* Infinity Carousel
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_carousel' ) ) {
function infinity_carousel( $carousel_class = '' ) {
$carousel_options = get_option( 'infinity_carousel' );
$carousel_class .= ( $carousel_options['style'] === 'boxed' ) ? 'center-width' : ''; ?>
<!-- Carousel Wrap -->
<div class="infinity-carousel-wrap <?php echo esc_attr( $carousel_class ); ?>"
data-columns="<?php echo esc_attr( $carousel_options['columns'] ); ?>"
data-width="<?php echo esc_attr( $carousel_options['width'] ); ?>"
data-height="<?php echo esc_attr( $carousel_options['height'] ); ?>"
data-margin="<?php echo esc_attr( $carousel_options['margin'] ); ?>"
data-stagepadding="<?php echo esc_attr( $carousel_options['stage_padding'] ); ?>"
data-autoplay="<?php echo esc_attr( $carousel_options['autoplay'] ); ?>"
data-loop="<?php echo esc_attr( $carousel_options['loop'] ); ?>"
data-navigation="<?php echo esc_attr( $carousel_options['navigation'] ); ?>"
data-pagination="<?php echo esc_attr( $carousel_options['pagination'] ); ?>"
data-slideby="<?php echo esc_attr( $carousel_options['slideby'] ); ?>"
>
<!-- Owl Carousel Main -->
<div class="infinity-carousel owl-carousel">
<?php
$carousel_orderby = $carousel_options['orderby'];
$carousel_posts_amount = (empty($carousel_options['posts_amount']))?'-1':$carousel_options['posts_amount'];
$carusel_meta_array = array(
array(
'key' => 'carousel-post',
'value' => 'true'
)
);
if ( $carousel_orderby === 'like' ) {
$carousel_orderby = 'meta_value_num';
$carusel_meta_array = array(
'relation' => 'AND',
array(
'key' => '_post_like_count'
),
array(
'key' => 'carousel-post',
'value' => 'true'
)
);
}
// Query Args
$args = array(
'post_type' => array( 'post', 'page' ),
'meta_query' => $carusel_meta_array,
'orderby' => $carousel_orderby,
'order' => 'DESC',
'posts_per_page' => $carousel_posts_amount,
'ignore_sticky_posts' => 1
);
$latestPosts = new WP_Query();
$latestPosts->query( $args );
while( $latestPosts->have_posts() ) : $latestPosts->the_post();
if( get_post_format()==='video' && get_post_meta( get_the_ID(), 'video_embed', true ) !=='' ){ ?>
<div class="carousel-video-item">
<?php
preg_match( '@src="([^"]+)"@' ,get_post_meta( get_the_ID(), 'video_embed', true ), $video_src );
echo '<a class="owl-video" href="'.array_pop($video_src).'" ></a>';
?>
</div>
<?php } else if( has_post_thumbnail() ) : ?>
<div class="carousel-item" >
<!-- Get Post Thumbnail -->
<img src="<?php the_post_thumbnail_url('infinity-carousel-thumbnail'); ?>" alt="">
<!-- Main Container -->
<div class="container">
<div class="outer">
<div class="inner">
<!-- Carousel Info -->
<?php if( $carousel_options['category'] || $carousel_options['title'] || $carousel_options['date'] || $carousel_options['comment'] || $carousel_options['like'] ) : ?>
<div class="carousel-item-info">
<!-- The categories -->
<?php $category_list = get_the_category_list( ', ' ); ?>
<?php if ( $category_list && $carousel_options['category'] ) : ?>
<div class="carousel-category">
<?php echo '' . $category_list; ?>
</div>
<?php endif; ?>
<!-- Get The Title -->
<?php if( $carousel_options['title'] ) : ?>
<h2 class="carousel-title">
<a href="<?php esc_url( the_permalink() ); ?>" target="<?php echo ($carousel_options['post_window'])?'_blank':'_self'; ?>" ><?php the_title(); ?></a>
</h2>
<?php endif; ?>
<!-- Carousel Post Content -->
<?php if( $carousel_options['content'] > 0 ) : ?>
<div class="carousel-content">
<?php
echo infinity_excerpt( $carousel_options['content'] );
?>
</div>
<?php endif; ?>
<!-- Carousel Read More -->
<?php if( $carousel_options['read_more'] ) : ?>
<div class="carousel-read-more">
<a href="<?php echo esc_url( get_the_permalink() ); ?>"><?php esc_html_e( 'read more','flexblog' ); ?></a>
</div>
<?php endif; ?>
<!-- Get the Date -->
<?php if( $carousel_options['date'] ) : ?>
<div class="carousel-date">
<?php the_time( get_option('date_format') ); ?>
</div>
<?php endif; ?>
<!-- Comments and Likes -->
<div class="carousel-like-comm">
<!-- Get Like And Comment -->
<?php
if ( $carousel_options['like'] ) {
echo getPostLikeLink( get_the_ID(), false );
}
if ( $carousel_options['comment'] && comments_open() && !post_password_required() ) {
comments_popup_link('<i class="fa fa-comment-o"></i>0', '<i class="fa fa-comment-o"></i>1', '<i class="fa fa-comment-o"></i>%', 'carousel-post-comment');
} ?>
</div>
</div><!-- // End Carousel Info -->
<?php endif; ?>
</div> <!-- // End Inner -->
</div> <!-- // End Outer -->
</div> <!-- // End Container -->
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</div>
</div>
<?php
}
}
/**
* ----------------------------------------------------------------------------------------
* Main Post
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_post' ) ) {
function infinity_post( $current_layout = 'gird' ) {
// Get Data
$general_options = get_option( 'infinity_general' );
$content_options = get_option( 'infinity_content' );
if ( $current_layout === 'col2' || $current_layout === 'col3' ) {
$current_layout = 'grid';
} ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- Post Media -->
<?php
if ( $content_options['post_header'] === 'below-media' ) {
if ( $content_options['post_thumbnail'] ) {
if ( has_post_thumbnail() ) {
get_template_part( 'post-formats/'.$current_layout.'/content' );
}
} else {
get_template_part( 'post-formats/'.$current_layout.'/content', get_post_format() );
}
} ?>
<!-- Post Header -->
<header class="entry-header">
<?php
// The Categories
$category_list = get_the_category_list( ', ' );
if ( $category_list && $content_options['post_categories'] ) {
echo '<div class="meta-categories"><span class="category-prefix">'. esc_html__( 'In', 'flexblog' ) .'</span>' . $category_list . ' </div>';
} ?>
<!-- Post Title -->
<h2 class="post-title">
<a href="<?php esc_url( the_permalink() ); ?>" target="<?php echo ($content_options['post_window'])?'_blank':'_self'; ?>"><?php the_title(); ?></a>
</h2>
<!-- Post Author and Date -->
<div class="meta-author-date">
<?php
// Post Date
if ( $content_options['post_date'] ) {
// Get the date
echo '<span class="meta-date">';
echo get_the_time( get_option('date_format') );
echo '</span>';
}
// Post Author
if ( $content_options['post_author'] ) {
echo '<span class="author-prefix">'. esc_html__( 'By', 'flexblog' ) .'</span>';
printf(
'<a href="%1$s" rel="author">%2$s</a>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
} ?>
</div>
</header>
<!-- Post Media -->
<?php
if ( $content_options['post_header'] === 'above-media' ) {
if ( $content_options['post_thumbnail'] ) {
if ( has_post_thumbnail() ) {
get_template_part( 'post-formats/'.$current_layout.'/content' );
}
} else {
get_template_part( 'post-formats/'.$current_layout.'/content', get_post_format() );
}
} ?>
<!-- Post Content -->
<div class="entry-content">
<?php
if ( $content_options['post_description'] === 'the-excerpt' ) {
if( $current_layout === 'full' ){
echo infinity_excerpt( 3 * (int)$content_options['post_excerpt_length'] );
} else {
echo infinity_excerpt($content_options['post_excerpt_length']);
}
if ( $content_options['post_read_more'] || $current_layout === 'full' ) { ?>
<div class="read-more">
<a href="<?php echo esc_url( get_the_permalink() ); ?>"><?php esc_html_e( 'read more','flexblog' ); ?></a>
</div>
<?php
}
} else {
the_content('');
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', 'flexblog' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
}
?>
</div>
<!-- Article footer -->
<footer class="entry-footer">
<?php
// Post share
infinity_sharing();
?>
<div class="clear"></div>
</footer>
</article>
<?php
}
}
/**
* ----------------------------------------------------------------------------------------
* Posts Loop
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_loop' ) ) {
function infinity_loop( $current_layout = 'col2' ) {
// Get Data
global $wp_query;
$content_options = get_option( 'infinity_content' );
$general_options = get_option( 'infinity_general' );
if ( have_posts() ) {
$post_class_wrap = 'list';
if ( $current_layout === 'col2' || $current_layout === 'col3' ) {
$post_class_wrap = 'grid';
}
// Full Post Layout
if ( $current_layout === 'full' ) {
while ( have_posts() ) {
the_post();
infinity_post( $current_layout );
}
} else {
echo '<ul class="infinity-'.$post_class_wrap.'">';
$post_column = (int)(substr($current_layout, -1));
while ( have_posts() ) {
the_post();
if ( $general_options['full_post'] && is_home() && !is_paged() && $wp_query->current_post == 0 ) {
infinity_post( 'full' );
} else {
echo '<li class="'. esc_attr($current_layout) .'" >';
infinity_post( $current_layout );
echo '</li>';
}
}
echo '</ul>';
}
// Get Pagination
if ( !$content_options['sticky_sidebar'] ) {
infinity_pagination();
}
} else { ?>
<div class="no-search-result">
<h3><?php esc_html_e( 'Nothing Found', 'flexblog' ); ?></h3>
<p><?php esc_html_e( 'It seems we can\'t find what you\'re looking for. Perhaps searching can help or go back to ', 'flexblog' ); ?><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php esc_html_e( 'Homepage', 'flexblog' ); ?></a></p>
<?php echo infinity_search_form(); ?>
</div>
<?php
}
}
}
/**
* ----------------------------------------------------------------------------------------
* Full Post Layout Post Per Page
* ----------------------------------------------------------------------------------------
*/
function set_posts_per_page( $query ) {
// Get Data
global $wp_the_query;
$general_options = get_option( 'infinity_general' );
$home_layout = substr( $general_options['home_layout'], 0, 4 );
if ( $home_layout!=='full' && $general_options['full_post'] && is_home() && !is_paged() ) {
$default_posts_per_page = get_option( 'posts_per_page' );
$default_posts_per_page++;
$query->set( 'posts_per_page', $default_posts_per_page );
return $query;
}
}
add_action( 'pre_get_posts', 'set_posts_per_page' );
/**
* ----------------------------------------------------------------------------------------
* Social Function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_social' ) ) {
function infinity_social( $social_class = '' ) {
// Get Data
$social_options = get_option( 'infinity_social' );
$html = '<div class="' . esc_attr( $social_class ) . '">';
if ( trim( $social_options['facebook'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['facebook'] ) .'" target="_blank"><i class="fa fa-facebook"></i></a>';
}
if ( trim( $social_options['twitter'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['twitter'] ) .'" target="_blank"><i class="fa fa-twitter"></i></a>';
}
if ( trim( $social_options['instagram'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['instagram'] ) .'" target="_blank"><i class="fa fa-instagram"></i></a>';
}
if ( trim( $social_options['pinterest'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['pinterest'] ) .'" target="_blank"><i class="fa fa-pinterest"></i></a>';
}
if ( trim( $social_options['bloglovin'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['bloglovin'] ) .'" target="_blank"><i class="fa fa-heart"></i></a>';
}
if ( trim( $social_options['google_plus'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['google_plus'] ) .'" target="_blank"><i class="fa fa-google-plus"></i></a>';
}
if ( trim( $social_options['tumblr'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['tumblr'] ) .'" target="_blank"><i class="fa fa-tumblr"></i></a>';
}
if ( trim( $social_options['youtube'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['youtube'] ) .'" target="_blank"><i class="fa fa-youtube-play"></i></a>';
}
if ( trim( $social_options['vine'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['vine'] ) .'" target="_blank"><i class="fa fa-vine"></i></a>';
}
if ( trim( $social_options['flickr'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['flickr'] ) .'" target="_blank"><i class="fa fa-flickr"></i></a>';
}
if ( trim( $social_options['linkedin'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['linkedin'] ) .'" target="_blank"><i class="fa fa-linkedin"></i></a>';
}
if ( trim( $social_options['behance'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['behance'] ) .'" target="_blank"><i class="fa fa-behance"></i></a>';
}
if ( trim( $social_options['soundcloud'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['soundcloud'] ) .'" target="_blank"><i class="fa fa-soundcloud"></i></a>';
}
if ( trim( $social_options['vimeo'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['vimeo'] ) .'" target="_blank"><i class="fa fa-vimeo-square"></i></a>';
}
if ( trim( $social_options['rss'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['rss'] ) .'" target="_blank"><i class="fa fa-rss"></i></a>';
}
if ( trim( $social_options['dribbble'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['dribbble'] ) .'" target="_blank"><i class="fa fa-dribbble"></i></a>';
}
if ( trim( $social_options['envelope'] ) !== '' ) {
$html .= '<a href="'. esc_url( $social_options['envelope'] ) .'" target="_blank"><i class="fa fa-envelope-o"></i></a>';
}
$html .= '</div>';
echo '' . $html;
}
}
/**
* ----------------------------------------------------------------------------------------
* Breadcrumb Section
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_breadcrumb' ) ) {
function infinity_breadcrumb () {
// Get Data
$content_options = get_option( 'infinity_content' );
if ( $content_options['breadcrumb'] ) {
// Settings
$separator = '<i class="fa fa-angle-right"></i>';
$parents = '';
// Get the query & post information
global $post,$wp_query;
$category = get_the_category();
// Do not display on the homepage
if ( !is_front_page() && !is_404() ) {
// Build the breadcrums
echo '<div class="infinity-breadcrumbs">';
echo '<div class="center-width">';
echo '<ul>';
// Home page
echo '<li><a href="' . esc_url( get_home_url( '/' ) ) . '" title="' . esc_html__( 'Home', 'flexblog' ) . '">' . esc_html__( 'Home', 'flexblog' ) . '</a></li>';
echo '<li class="_separator"> ' . $separator . ' </li>';
if ( is_single() && !is_attachment() ) {
// Single post (Only display the first category)
echo '<li><a href="' . esc_url( get_category_link($category[0]->term_id ) ) . '" title="' . esc_attr( $category[0]->cat_name ) . '">' . $category[0]->cat_name . '</a></li>';
echo '<li class="_separator"> ' . $separator . ' </li>';
echo '<li><strong title="' .esc_attr( get_the_title() ) . '">' . get_the_title() . '</strong></li>';
} else if ( is_category() ) {
// Category page
echo '<li><strong>' . esc_html__( 'Category Archives: ', 'flexblog' ) . $category[0]->cat_name . '</strong></li>';
} else if ( is_page() || is_attachment() ) {
// Standard page
if( $post->post_parent ) {
// If child page, get parents
$anc = get_post_ancestors( $post->ID );
// Get parents in the right order
$anc = array_reverse($anc);
// Parent page loop
foreach ( $anc as $ancestor ) {
$parents .= '<li><a href="' . esc_url( get_permalink($ancestor) ) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
$parents .= '<li class="_separator">' . $separator . '</li>';
}
// Display parent pages
echo '' . $parents;
// Current page
echo '<li><strong title="' . esc_attr( get_the_title() ) . '">' . get_the_title() . '</strong></li>';
} else {
// Just display current page if not parents
echo '<li><strong> ' . get_the_title() . '</strong></li>';
}
} else if ( is_tag() ) {
// Tag page
// Get tag information
$term_id = get_query_var('tag_id');
$taxonomy = 'post_tag';
$args ='include=' . $term_id;
$terms = get_terms( $taxonomy, $args );
// Display the tag name
echo '<li><strong>'.esc_html__( 'Tag Archives: ','flexblog' ) .' '. $terms[0]->name . '</strong></li>';
} elseif ( is_day() ) {
// Day archive
// Year link
echo '<li><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . esc_url( get_year_link( get_the_time('Y') ) ) . '" title="' . esc_attr( get_the_time('Y') ) . '">' . get_the_time('Y') . esc_html__(' Year', 'flexblog' ) .'</a></li>';
echo '<li>' . $separator . '</li>';
// Month link
echo '<li><a href="' . esc_url( get_month_link( get_the_time('Y'), get_the_time('m') ) ) . '" title="' . esc_attr( get_the_time('F') ) . '">' . get_the_time('F') .'</a></li>';
echo '<li class="_separator"> ' . $separator . ' </li>';
// Day display
echo '<li><strong> ' . get_the_time('jS') . esc_html__(' Archives:', 'flexblog' ) .'</strong></li>';
} else if ( is_month() ) {
// Month Archive
// Year link
echo '<li><a class="bread-year bread-year-' .esc_attr( get_the_time('Y') ) . '" href="' . esc_url( get_year_link( get_the_time('Y') ) ). '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . esc_html__(' Year', 'flexblog' ) .'</a></li>';
echo '<li class="_separator"> ' . $separator . ' </li>';
// Month display
echo '<li><strong title="' . esc_attr( get_the_time('F') ) . '">' . get_the_time('F') .'</strong></li>';
} else if ( is_year() ) {
// Display year archive
echo '<li><strong title="' . esc_attr( get_the_time('Y') ) . '">' . get_the_time('Y') . esc_html__(' Year', 'flexblog' ) .'</strong></li>';
} else if ( is_author() ) {
// Auhor archive
// Get the author information
global $author;
$userdata = get_userdata( $author );
// Display author name
echo '<li><strong title="' . esc_attr( $userdata->display_name ) . '">' . esc_html__( 'Author:', 'flexblog' ) . ' ' . $userdata->display_name . '</strong></li>';
} else if ( is_search() ) {
// Search results page
echo '<li><strong title="' . esc_attr( get_search_query() ) . '">' . esc_html__( 'Search results for:', 'flexblog' ). ' ' . get_search_query() . '</strong></li>';
} else if ( get_query_var('paged') ) {
// Paginated archives
echo '<li><strong title="' . esc_attr( get_query_var('paged') ) . '">'.esc_html__( 'Page:', 'flexblog' ) . ' ' . get_query_var('paged') . '</strong></li>';
}
echo '</ul>';
echo '</div>';
echo '</div>';
}
}
}
}
/**
* ----------------------------------------------------------------------------------------
* Sharing Functions Section
* ----------------------------------------------------------------------------------------
*/
// Meta Sharing
function infinity_meta_sharing() {
global $post;
$header_options = get_option( 'infinity_header' );
$my_postid = get_the_ID();
$content = get_excerpt_by_id($my_postid);
$fb_image = wp_get_attachment_image_src( get_post_thumbnail_id( $my_postid ), 'large' );
if ( is_home() ) {
echo '<meta property="og:image" content="'. $header_options['logo'].'"/>';
echo '<meta property="og:title" content="'.get_bloginfo('name').'"/>';
echo '<meta property="og:description" content="'.get_bloginfo('description').'" />';
echo '<meta property="og:url" content="'.get_site_url().'/" />';
} else if( isset( $fb_image ) && has_post_thumbnail( $my_postid ) ) {
echo '<meta property="og:image" content="'. $fb_image[0] .'"/>';
echo '<meta property="og:image:width" content="'. $fb_image[1] .'"/>';
echo '<meta property="og:image:height" content="'. $fb_image[2] .'"/>';
echo '<meta property="og:title" content="'. get_the_title() .'"/>';
echo '<meta property="og:description" content="'.$content.'" />';
echo '<meta property="og:url" content="'. esc_url(get_permalink()) .'"/>';
} else {
echo '<meta property="og:image" content="'. INFINITY_THEMEROOT .'/img/blank.png"/>';
echo '<meta property="og:image:width" content="1"/>';
echo '<meta property="og:image:height" content="1"/>';
echo '<meta property="og:title" content="'. get_the_title() .'"/>';
echo '<meta property="og:description" content="'.$content.'" />';
echo '<meta property="og:url" content="'. esc_url(get_permalink()) .'"/>';
}
echo '<meta property="og:locale" content="'. strtolower( str_replace( '-', '_', get_bloginfo('language') ) ) .'" />';
echo '<meta property="og:site_name" content="'. get_bloginfo('name') .'"/>';
}
add_action( 'wp_head', 'infinity_meta_sharing' );
// Post Share Function
if ( ! function_exists( 'infinity_sharing' ) ) {
function infinity_sharing() {
// Get Data
$content_options = get_option( 'infinity_content' );
global $post;
// Post share
if ( $content_options['facebook_share'] || $content_options['twitter_share'] || $content_options['pinterest_share'] || $content_options['googleplus_share'] || $content_options['linkedin_share'] || $content_options['tumblr_share'] || $content_options['reddit_share'] || $content_options['post_like'] || $content_options['post_comment'] ) : ?>
<div class="meta-share">
<?php
// Post Like
if ( $content_options['post_like'] ) {
echo getPostLikeLink( get_the_ID() );
} ?>
<?php if ( $content_options['facebook_share'] ) :
$facebook_src = 'https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_the_permalink() ); ?>
<a class="facebook-share" target="_blank" href="<?php echo esc_url ( $facebook_src ); ?>">
<i class="fa fa-facebook"></i>
<span class="btn-info"><?php esc_html_e( 'Facebook', 'flexblog' ); ?></span>
</a>
<?php endif; ?>
<?php if ( $content_options['twitter_share'] ) :
$twitter_src = 'https://twitter.com/home?status=Check%20out%20this%20article:%20'.get_the_title().'%20-%20'.esc_url( get_the_permalink() ); ?>
<a class="twitter-share" target="_blank" href="<?php echo esc_url ( $twitter_src ); ?>">
<i class="fa fa-twitter"></i>
<span class="btn-info"><?php esc_html_e( 'Twitter', 'flexblog' ); ?></span>
</a>
<?php endif; ?>
<?php if ( $content_options['pinterest_share'] ) :
$pinterest_src = 'https://pinterest.com/pin/create/button/?url='.esc_url( get_the_permalink() ).'&media='.esc_url( wp_get_attachment_url( get_post_thumbnail_id($post->ID)) ).'&description='.get_the_title(); ?>
<a class="pinterest-share" target="_blank" href="<?php echo esc_url ( $pinterest_src ); ?>">
<i class="fa fa-pinterest"></i>
<span class="btn-info"><?php esc_html_e( 'Pinterest', 'flexblog' ); ?></span>
</a>
<?php endif; ?>
<?php if ( $content_options['googleplus_share'] ) :
$google_src = 'https://plus.google.com/share?url='. esc_url( get_the_permalink() ); ?>
<a class="googleplus-share" target="_blank" href="<?php echo esc_url ( $google_src ); ?>">
<i class="fa fa-google-plus"></i>
<span class="btn-info"><?php esc_html_e( 'Google +', 'flexblog' ); ?></span>
</a>
<?php endif; ?>
<?php if ( $content_options['linkedin_share'] ) :
$linkedin_src = 'http://www.linkedin.com/shareArticle?url='.esc_url( get_the_permalink() ).'&title='.get_the_title(); ?>
<a class="linkedin-share" target="_blank" href="<?php echo esc_url( $linkedin_src ); ?>">
<i class="fa fa-linkedin"></i>
<span class="btn-info"><?php esc_html_e( 'Linkedin', 'flexblog' ); ?></span>
</a>
<?php endif; ?>
<?php if ( $content_options['tumblr_share'] ) :
$tumblr_src = 'http://www.tumblr.com/share/link?url='. urlencode( esc_url(get_permalink()) ) .'&name='.urlencode( get_the_title() ).'&description='.urlencode( get_the_excerpt() ); ?>
<a class="tumblr-share" target="_blank" href="<?php echo esc_url( $tumblr_src ); ?>">
<i class="fa fa-tumblr"></i>
<span class="btn-info"><?php esc_html_e( 'Tumblr', 'flexblog' ); ?></span>
</a>
<?php endif; ?>
<?php if ( $content_options['reddit_share'] ) :
$reddit_src = 'http://reddit.com/submit?url='. esc_url( get_the_permalink() ) .'&title='.get_the_title(); ?>
<a class="reddit-share" target="_blank" href="<?php echo esc_url( $reddit_src ); ?>">
<i class="fa fa-reddit"></i>
<span class="btn-info"><?php esc_html_e( 'Reddit', 'flexblog' ); ?></span>
</a>
<?php endif; ?>
<?php
// Comments link
if ( comments_open() && $content_options['post_comment'] && !post_password_required() ) {
comments_popup_link('<i class="fa fa-comment-o"></i><span class="btn-info">0</span>', '<i class="fa fa-comment-o"></i><span class="btn-info">1</span>', '<i class="fa fa-comment-o"></i><span class="btn-info">%</span>', 'infinity-post-comment');
} ?>
</div>
<?php endif;
}
}
/**
* ----------------------------------------------------------------------------------------
* Comments Form Section
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'infinity_comments' ) ) {
function infinity_comments ( $comment, $args, $depth ) {
$_GLOBAL['comment'] = $comment;
if(get_comment_type() == 'pingback' || get_comment_type() == 'trackback' ) : ?>
<li class="pingback" id="comment-<?php comment_ID(); ?>">
<article <?php comment_class('entry-comments'); ?> >
<div class="comment-content">
<h3 class="comment-author">
<?php esc_html_e( 'Pingback:', 'flexblog' ); ?>
</h3>
<span class="comment-date" >
<a href=" <?php echo esc_url( get_comment_link() ); ?> " class="comment-date" >
<?php
comment_date( get_option('date_format') );
esc_html_e( ' at ', 'flexblog' );
comment_time( get_option('time_format') );
?>
</a>
<?php
echo edit_comment_link( esc_html__(' [Edit]', 'flexblog' ) );
?>
</span>
<div class="clear"></div>
<div class="comment-text">
<?php comment_author_link(); ?>
</div>
</div>
</article>
</li>
<?php elseif (get_comment_type() == 'comment') : ?>
<li id="comment-<?php comment_ID(); ?>">
<article <?php comment_class('entry-comments'); ?> >
<figure class="comment-avatar">
<?php
$avatar_size = 60;
if( $comment->comment_parent != 0 ) {
$avatar_size = 55;
}
echo get_avatar( $comment, $avatar_size );
?>
</figure>
<div class="comment-content">
<h3 class="comment-author">
<?php comment_author_link(); ?>
</h3>
<span class="comment-date" >
<a href=" <?php echo esc_url( get_comment_link() ); ?> ">
<?php
comment_date( get_option('date_format') );
esc_html_e( ' at ', 'flexblog' );
comment_time( get_option('time_format') );
?>
</a>
<?php
echo edit_comment_link( esc_html__(' [Edit]', 'flexblog' ) );
?>
</span>
<div class="clear"></div>
<div class="comment-text">
<?php if($comment->comment_approved == '0') : ?>
<p class="awaiting-moderation"><?php esc_html_e('Your comment is awaiting moderation.', 'flexblog'); ?></p>
<?php endif; ?>
<?php comment_text(); ?>
</div>
</div>
<span class="reply">
<?php comment_reply_link(array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth']) ) ); ?>
</span>
</article>
<?php endif;
}
}
/**
* ----------------------------------------------------------------------------------------
* Comments Fields Section
* ----------------------------------------------------------------------------------------
*/
function infinity_comment_form( $defaults ) {
$defaults['comment_notes_before'] = '';
$defaults['id_form'] = 'comment-form';
$defaults['comment_field'] = '<p class="custom-textarea"><label for="comment">'. esc_html__( 'Comment', 'flexblog' ) .'</label><textarea name="comment" id="comment" cols="30" rows="10"></textarea></p>';
return $defaults;
}
add_filter('comment_form_defaults', 'infinity_comment_form');
function infinity_comment_fields() {
$commenter = wp_get_current_commenter();
$req = get_option('require_name_email');
$aria_req = ($req ?"aria-required = 'true'" : ' ' );
$fields = array(
'author' => '<p>' .
'<label for="author">'.esc_html__('Name', 'flexblog') . ' '.($req ? '*' : ' ' ) .'</label>'.
'<input type="text" name="author" id="author" value="'. esc_attr($commenter['comment_author']).'" '.$aria_req.'/>'.
'</p>',
'email' => '<p>' .
'<label for="email">'.esc_html__('Email', 'flexblog') . ' '.($req ? '*' : ' ' ) .'</label>'.
'<input type="text" name="email" id="email" value="'. esc_attr($commenter['comment_author_email']).'" '.$aria_req.'/>'.
'</p>',
'url' => '<p>' .
'<label for="url">'.esc_html__('Website', 'flexblog') .'</label>'.
'<input type="text" name="url" id="url" value="'. esc_attr($commenter['comment_author_url']).'"/>'.
'</p>',
);
return $fields;
}
add_filter('comment_form_default_fields', 'infinity_comment_fields');
/**
* ----------------------------------------------------------------------------------------
* Add title back to images
* ----------------------------------------------------------------------------------------
*/
function pexeto_add_title_to_attachment( $markup, $id ){
$att = get_post( $id );
return str_replace('<a ', '<a title="'.$att->post_title.'" ', $markup);
}
add_filter('wp_get_attachment_link', 'pexeto_add_title_to_attachment', 10, 5);