/** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ /** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ /** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ /** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ /** * Theme functions and definitions. * * For additional information on potential customization options, * read the developers' documentation: * * https://developers.elementor.com/docs/hello-elementor-theme/ * * @package HelloElementorChild */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'HELLO_ELEMENTOR_CHILD_VERSION', '2.0.0' ); /** * Load child theme scripts & styles. * * @return void */ function hello_elementor_child_scripts_styles() { wp_enqueue_style( 'hello-elementor-child-style', get_stylesheet_directory_uri() . '/style.css', [ 'hello-elementor-theme-style', ], HELLO_ELEMENTOR_CHILD_VERSION ); } add_action( 'wp_enqueue_scripts', 'hello_elementor_child_scripts_styles', 20 ); ///////////////////////////////// SINGLE QUIZE ///////////////////////////////////////////////////// // Single Answer add_action( 'wp_ajax_my_ajax_request', 'user_calling_make' ); add_action( 'wp_ajax_nopriv_my_ajax_request', 'user_calling_make' ); function user_calling_make() { $qus_id = $_POST['qus_id']; $answer_type = trim($_POST['answer_type']); $answer_type_all = trim($_POST['answer_type_all']); if ( get_post_status( $qus_id ) ) { $rows = get_field('questions',$qus_id); $responses = array(); $c = 0; foreach($rows as $row) { if(trim(strtolower($row['answer'])) == trim(strtolower($answer_type))){ //echo strtolower($row['answer']).'->'.strtolower($answer_type);echo "
"; $responses[] = array('ans_id' => $c); } $c++; } if(count($responses)>0){ echo json_encode($responses); }else{ $responses[] = array('ans_id' => 'no'); echo json_encode($responses); } exit; } } // All Single Answer add_action( 'wp_ajax_my_ajax_request_all', 'user_calling_make_all' ); add_action( 'wp_ajax_nopriv_my_ajax_request_all', 'user_calling_make_all' ); function user_calling_make_all() { $qus_id = $_POST['qus_id']; if ( get_post_status( $qus_id ) ) { $rows = get_field('questions',$qus_id); $responses = array(); $c = 0; foreach($rows as $row) { $responses[] = array('ans_id' => $c,'ans_val' => $row['answer']); $c++; } if(count($responses)>0){ echo json_encode($responses); }else{ $responses[] = array('ans_id' => 'no'); echo json_encode($responses); } exit; } } ///////////////////////////////// SINGLE QUIZE ///////////////////////////////////////////////////// ///////////////////////////////// GROUP QUIZE ///////////////////////////////////////////////////// // GROUP Answer add_action( 'wp_ajax_my_ajax_request_group', 'user_calling_make_group' ); add_action( 'wp_ajax_nopriv_my_ajax_request_group', 'user_calling_make_group' ); function user_calling_make_group() { $qus_id = $_POST['qus_id']; $answer_type = trim($_POST['answer_type']); if ( get_post_status( $qus_id ) ) { $rows = get_field('group_questions',$qus_id); $responses = array(); /*echo "
";
		print_r($rows);
		die;*/
		$c = 0;
		foreach($rows as $row)
		{
			$ans_c = 0;
			foreach($row['answers'] as $ans){			
				if(trim(strtolower($ans['answer'])) == trim(strtolower($answer_type))){		
					$responses[] = array('ans_id' => $c.'_'.$ans_c);		
				}
				$ans_c++;
			}
			$c++;
		}
		/*echo "
";
		print_r($responses);
		die;*/
		if(count($responses)>0){
			echo json_encode($responses);
		}else{					
			$responses[] = array('ans_id' => 'no');
			echo json_encode($responses);
		}
		exit;
	}	
}

// All Group Answer
add_action( 'wp_ajax_my_ajax_request_group_all', 'user_calling_make_group_all' );
add_action( 'wp_ajax_nopriv_my_ajax_request_group_all', 'user_calling_make_group_all' );
function user_calling_make_group_all() {

	$qus_id = $_POST['qus_id'];	
	
	if ( get_post_status( $qus_id ) ) {
		
		$rows = get_field('group_questions',$qus_id);
		$responses   = array();
		/*echo "
";
		print_r($rows);
		die;*/
		$c = 0;
		foreach($rows as $row)
		{
			$ans_c = 0;
			foreach($row['answers'] as $ans){				
				$responses[] = array('ans_id' => $c.'_'.$ans_c,'ans_val' => $ans['answer']);				
				$ans_c++;
			}
			$c++;
		}
		/*echo "
";
		print_r($responses);
		die;*/
		if(count($responses)>0){
			echo json_encode($responses);
		}else{					
			$responses[] = array('ans_id' => 'no');
			echo json_encode($responses);
		}
		exit;		
	}	
}
///////////////////////////////// GROUP QUIZE /////////////////////////////////////////////////////



add_action( 'powerpack/query/allquiz', function( $query ) {
    // Here we set the query to fetch posts with
    // post type of 'custom-post-type1' and 'custom-post-type2'
    //$query->set( 'post_type', [ 'custom-post-type1', 'custom-post-type2' ] );
    //$query->set( 'post__not_in', array( 1838 ) );
} );


function my_query_by_different_order( $query ) {
	//$query->set( 'post__not_in', array( 1838 ) );
	$query->set( 'post_type', [ 'wp_quiz','acf-single-quizes' ] );
}
add_action( 'elementor/query/allquiz', 'my_query_by_different_order' );

Page not found – lfquiz  

It looks like nothing was found at this location.