HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/dooblo.cccinfotech.com/wp-content/themes/dooblo/functions-for-new-blog.php
<?php
/**
 * Dooblo functions and definitions.
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Dooblo
 */



if ( ! function_exists( 'dooblo_setup' ) ) :
/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support for post thumbnails.
 */
function dooblo_setup() {
	/*
	 * Make theme available for translation.
	 * Translations can be filed in the /languages/ directory.
	 * If you're building a theme based on Dooblo, use a find and replace
	 * to change 'dooblo' to the name of your theme in all the template files.
	 */
	load_theme_textdomain( 'dooblo', get_template_directory() . '/languages' );

	// Add default posts and comments RSS feed links to head.
	add_theme_support( 'automatic-feed-links' );

	/*
	 * Let WordPress manage the document title.
	 * By adding theme support, we declare that this theme does not use a
	 * hard-coded <title> tag in the document head, and expect WordPress to
	 * provide it for us.
	 */
	add_theme_support( 'title-tag' );

	/*
	 * Enable support for Post Thumbnails on posts and pages.
	 *
	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
	 */
	add_theme_support( 'post-thumbnails' );

	// This theme uses wp_nav_menu() in one location.
	register_nav_menus( array(
		'primary' => esc_html__( 'Primary Menu', 'dooblo' ),
	) );

	/*
	 * Switch default core markup for search form, comment form, and comments
	 * to output valid HTML5.
	 */
	add_theme_support( 'html5', array(
		'search-form',
		'comment-form',
		'comment-list',
		'gallery',
		'caption',
	) );

	/*
	 * Enable support for Post Formats.
	 * See https://developer.wordpress.org/themes/functionality/post-formats/
	 */
	add_theme_support( 'post-formats', array(
		'aside',
		'image',
		'video',
		'quote',
		'link',
	) );

	// Set up the WordPress core custom background feature.
	add_theme_support( 'custom-background', apply_filters( 'dooblo_custom_background_args', array(
		'default-color' => 'ffffff',
		'default-image' => '',
	) ) );
}
endif; // dooblo_setup
add_action( 'after_setup_theme', 'dooblo_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function dooblo_content_width() {
	$GLOBALS['content_width'] = apply_filters( 'dooblo_content_width', 640 );
}
add_action( 'after_setup_theme', 'dooblo_content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function dooblo_widgets_init() {
	register_sidebar( array(
		'name'          => esc_html__( 'Sidebar', 'dooblo' ),
		'id'            => 'sidebar-1',
		'description'   => '',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h2 class="widget-title">',
		'after_title'   => '</h2>',
	) );
}
add_action( 'widgets_init', 'dooblo_widgets_init' );

/**
 * Enqueue scripts and styles.
 */
function dooblo_scripts() {
	// Styles
	wp_enqueue_style( 'dooblo-style', get_stylesheet_uri() );
	wp_enqueue_style('dooblo-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
	wp_enqueue_style('dooblo-owl-carousel', get_template_directory_uri() . '/assets/modules/owl-carousel/owl.carousel.css');
	//wp_enqueue_style('dooblo-odometer', get_template_directory_uri() . '/assets/modules/odometer-theme-minimal.css');
	wp_enqueue_style('dooblo-icomoon', get_template_directory_uri() . '/assets/css/icomoon.css');

	// Scripts
	wp_enqueue_script('dooblo-owl-carousel', get_template_directory_uri() . '/assets/modules/owl-carousel/owl.carousel.min.js', array('jquery'), false, true);

	if(preg_match('/(?i)msie [5-9]/',$_SERVER['HTTP_USER_AGENT'])){

		//wp_enqueue_script('dooblo-EventHelpers', get_template_directory_uri() . '/assets/modules/sand/EventHelpers.js', array('jquery'), false, true);
		//wp_enqueue_script('dooblo-cssQuery', get_template_directory_uri() . '/assets/modules/sand/cssQuery-p.js', array('jquery'), false, true);
		//wp_enqueue_script('dooblo-sylvester', get_template_directory_uri() . '/assets/modules/sand/jcoglan.com/sylvester.js', array('jquery'), false, true);
		//wp_enqueue_script('dooblo-cssSandpaper', get_template_directory_uri() . '/assets/modules/sand/cssSandpaper.js', array('jquery'), false, true);	
	}else{

		wp_enqueue_script('dooblo-SmoothScroll', get_template_directory_uri() . '/assets/modules/SmoothScroll.js', array('jquery'), false, true);
		wp_enqueue_script('dooblo-TweenMax', get_template_directory_uri() . '/assets/modules/TweenMax.min.js', array('jquery'), false, true);
		wp_enqueue_script('dooblo-ScrollMagic', get_template_directory_uri() . '/assets/modules/ScrollMagic.min.js', array('jquery'), false, true);
		wp_enqueue_script('dooblo-gsap', get_template_directory_uri() . '/assets/modules/animation.gsap.min.js', array('jquery'), false, true);
		wp_enqueue_script('dooblo-jquery-ScrollMagic', get_template_directory_uri() . '/assets/modules/jquery.ScrollMagic.min.js', array('jquery'), false, true);

	}
	wp_enqueue_script('dooblo-isMobile', get_template_directory_uri() . '/assets/modules/isMobile.min.js', array('jquery'), false, true);
	wp_enqueue_script('dooblo-js', get_template_directory_uri() . '/assets/js/dooblo.js', array('jquery'), false, true);

	wp_register_script( 'dooblo-script', get_template_directory_uri() . '/assets/js/load-more.js');
	wp_enqueue_script( 'dooblo-script' );

	wp_localize_script( 'dooblo-script', 'ajax_posts', array(
		'ajaxurl' => get_stylesheet_directory_uri() . "/show-more-blog.php",
		'noposts' => __('No older posts found', 'dooblo')
	));
}
add_action( 'wp_enqueue_scripts', 'dooblo_scripts' );

function dooblo_admin_scripts() {
	wp_enqueue_style( 'dooblo-admin-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css' );
	wp_enqueue_style( 'dooblo-admin-icomoon', get_template_directory_uri() . '/assets/css/icomoon.css' );
}
add_action( 'admin_enqueue_scripts', 'dooblo_admin_scripts' );

/**
 * Disable admin bar on front end.
 */
add_filter('show_admin_bar', '__return_false');

/**
 * Contact form handling with AJAX
 */
/*
function custom_email_validation_filter($result,$tag)
{
	$type = $tag['type'];
	$name = $tag['name'];
	$result['valid'] = false;
}
add_filter('wpcf7_validate_email','custom_email_validation_filter', 10, 2); // Email field

function ajax_hpform_action_callback() {
	$error = '';
	$status = 'error';
	if (empty($_POST['fname']) || empty($_POST['lname']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['company'])) {
		$error = 'כל השדות חובה';
	} else {

		$fname = filter_var($_POST['fname'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
		$lname = filter_var($_POST['lname'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
		$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
		$phone = filter_var($_POST['phone'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
		$company = filter_var($_POST['company'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
		$subject = $_POST['subject'];

		$message = stripslashes($subject);
		$message .= PHP_EOL . "Sender's name: " . $fname . ' ' . $lname;
		$message .= PHP_EOL . 'Email: ' . $email;
		$message .= PHP_EOL . 'Phone: ' . $phone;
		$message .= PHP_EOL . 'Company: ' . $company;

		$to = 'ofer@dooblo.net';
		$header = 'From: ' . get_option('blogname') . ' <noreply@yourdomain.com>' . PHP_EOL;
		$header .= 'Reply-To: ' . $email . PHP_EOL;

		wp_mail($to, $subject, $message, $header);
		$status = 'success';
	}

	$resp = array('status' => $status, 'message' => $error);

	echo json_encode($resp);
	die();
}
add_action( 'wp_ajax_hpform_action', 'ajax_hpform_action_callback' );
add_action( 'wp_ajax_nopriv_hpform_action', 'ajax_hpform_action_callback' );
*/
/**
 * Implement the Custom Header feature.
 */
//require get_template_directory() . '/inc/custom-header.php';

if( function_exists('acf_add_options_page') ) {
	
	acf_add_options_page(array(
		'page_title' 	=> 'General Site Settings',
		'menu_title'	=> 'General Site Settings',
		'menu_slug' 	=> 'theme-general-settings',
		'capability'	=> 'edit_posts',
		'redirect'		=> false
	));
	
}

/* Custom ajax loader */
add_filter('wpcf7_ajax_loader', 'my_wpcf7_ajax_loader');
function my_wpcf7_ajax_loader () {
	return  get_bloginfo('stylesheet_directory') . '/assets/img/ripple.svg';
}

add_action('wpcf7_mail_sent', 'ip_wpcf7_mail_sent');
function ip_wpcf7_mail_sent($wpcf7)
{
	$on_sent_ok = $wpcf7->additional_setting('ip_on_sent_ok', false);

	if (is_array($on_sent_ok) && count($on_sent_ok) > 0)
	{
		wp_redirect(trim($on_sent_ok[0]));
		exit;
	}
}

add_action( 'widgets_init', 'themename_widgets_init' );
function themename_widgets_init() {
    register_sidebar( array(
        'name'          => __( 'Blog Header Logo', 'theme_name' ),
        'id'            => 'Blog-Header-Logo',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
 
    register_sidebar( array(
        'name'          => __( 'Blog Footer Logo', 'theme_name' ),
        'id'            => 'Blog-Footer-Logo',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
	   register_sidebar( array(
        'name'          => __( 'Blog Copyright', 'theme_name' ),
        'id'            => 'Blog-Copyright',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
	   register_sidebar( array(
        'name'          => __( 'Blog Social', 'theme_name' ),
        'id'            => 'Blog-Social',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
	
	   register_sidebar( array(
        'name'          => __( 'Blog SideBar', 'theme_name' ),
        'id'            => 'Blog-Sidebar',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
	
	 register_sidebar( array(
        'name'          => __( 'Blog Recent', 'theme_name' ),
        'id'            => 'Blog-Recent',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
	
	 register_sidebar( array(
        'name'          => __( 'Blog Popular', 'theme_name' ),
        'id'            => 'Blog-Popular',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
	
	 register_sidebar( array(
        'name'          => __( 'Blog Categories', 'theme_name' ),
        'id'            => 'Blog-Categories',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
    
	   register_sidebar( array(
        'name'          => __( 'View Release SideBar', 'theme_name' ),
        'id'            => 'View-Release-Sidebar',
        'before_widget' => '<ul><li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li></ul>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
}

if ( ! function_exists( 'pagination_blog' ) ) :
    function pagination_blog( $paged = '', $max_page = '' )
    {
        $big = 999999999; // need an unlikely integer
        if( ! $paged )
            $paged = get_query_var('paged');
        if( ! $max_page )
            $max_page = $wp_query->max_num_pages;

        echo paginate_links( array(
            'base'       => str_replace($big, '%#%', esc_url(get_pagenum_link( $big ))),
            'format'     => '?paged=%#%',
            'current'    => max( 1, $paged ),
            'total'      => $max_page,
            'end_size'           => 1,
            'prev_text'  => __('&laquo;'),
            'next_text'  => __('&raquo;'),
            'type'       => 'plain',
			'aria_current'       => 'page',
			'show_all'           => true,'after_page_number'  => '',

        ) );
    }
endif;

function wpdocs_custom_excerpt_length( $length ) {
    return 29;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 );

function new_excerpt_more($more) {
    return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');

function register_my_menu() {
  register_nav_menu('research-menu',__( 'Research-Menu' ));
}
add_action( 'init', 'register_my_menu' );

function dooblo_more_post_ajax(){

	$post_per_page = (isset($_POST["post_per_page"])) ? $_POST["post_per_page"] : 4;
	$paged = (isset($_POST['page_number'])) ? $_POST['page_number'] : 0;

	header("Content-Type: text/html");

	$args = array(
				'post_type'=> 'post',
				'post_status' => 'publish',
				'paged'           => $paged, 
				'posts_per_page'  => $post_per_page
			);

	$result = new WP_Query( $args );
	if ( $result-> have_posts() ) :
			while ( $result->have_posts() ) : $result->the_post();
				
				$postid = get_the_id();
				$post_categories = wp_get_post_categories( get_the_id() );
				$cats = array();

				foreach($post_categories as $c){
					$cat = get_category( $c );

					if($cat->name != "Uncategorized"):
						$cats[] = array( 'id' => $cat->term_id, 'name' => $cat->name, 'slug' => $cat->slug );
					endif;
				}
	?>

			<article class="col-md-6 elementor-post elementor-grid-item post-<?=get_the_ID()?> post type-post status-publish format-standard has-post-thumbnail hentry category-general entry has-media col-2-Columns">
				<div class="elementor-post__card" bis_skin_checked="1">
					<a class="elementor-post__thumbnail__link" href="<?=get_the_permalink()?>">
						<div class="elementor-post__thumbnail" bis_skin_checked="1">
							<picture class="attachment-full size-full">
								<source type="image/webp" srcset="<?=get_the_post_thumbnail_url( get_the_ID(),'full')?>" sizes="(max-width: 744px) 100vw, 744px">
								<img src="<?=get_the_post_thumbnail_url( get_the_ID(),'large')?>" alt="" sizes="(max-width: 744px) 100vw, 744px"  class="lazyloaded" data-ll-status="loaded" width="744" height="421">
							</picture>
						</div>
					</a>

					<div class="elementor-post__text cst-blog-title" bis_skin_checked="1">
						<h3 class="elementor-post__title">
							<a href="<?=get_the_permalink()?>"><?=get_the_title()?></a>
						</h3>
						<div class="elementor-post__excerpt" bis_skin_checked="1">
							<p><?=get_the_excerpt()?></p>
						</div>
						<a class="elementor-post__read-more" href="<?=get_the_permalink()?>">Read More »</a>
					</div>

					<div class="elementor-post__meta-data" bis_skin_checked="1">
						<?php
						if(!empty($cats)):
							foreach($cats as $key => $val):
								$postcathtml[$postid][]='<a href="'.get_category_link($val['id']).'">'.$val['name'].'</a>';
							endforeach;
						?>
							<div class="elementor-post__cat" bis_skin_checked="1">
								<?php echo implode(' , ',$postcathtml[$postid]); ?>
							</div>
						<?php endif; ?>
						<?php $date_enable = get_field('date_enable',$postid); ?>
						<?=((!empty($date_enable[0]) && strtolower($date_enable[0]) == "yes") ?'<span class="elementor-post-date">'.date('F d,Y',strtotime(get_the_date( 'd.m.Y' ))).'</span>':'')?>
					</div>
				</div>
			</article>
		<?php endwhile; ?>
	<?php endif;
	wp_reset_postdata();
    die();
}

//add_action('wp_ajax_nopriv_dooblo_more_post_ajax', 'dooblo_more_post_ajax');
//add_action('wp_ajax_dooblo_more_post_ajax', 'dooblo_more_post_ajax');