Answer the question
In order to leave comments, you need to log in
What is wrong theme functions in wordpress?
When adding functions.php to your theme, photos in the wp library are not loaded, when you save some settings, it switches to a white screen, everything is fine with the site, without functions everything is fine
wordpress version 4.9.6
functions code
<?php
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
function my_scripts_method(){
wp_enqueue_script( 'jj', get_template_directory_uri() . '/jj.js');
}
add_action( 'wp_enqueue_scripts', 'myajax_data', 99 );
function myajax_data(){
wp_localize_script('jj', 'myajax',
array(
'url' => admin_url('admin-ajax.php')
)
);
}
?>
<?php
add_action('wp_ajax_my_action', 'my_action_callback');
add_action('wp_ajax_nopriv_my_action', 'my_action_callback');
function my_action_callback() {
$whatever = $_POST['name'];
echo $whatever;
wp_die();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question