What is a Javascript callback?
MDN says that a callback is a function that is passed as an argument to another function. As far as I understand, it means callback is included within parentheses. This is the link. But, I once came across an article…
MDN says that a callback is a function that is passed as an argument to another function. As far as I understand, it means callback is included within parentheses. This is the link. But, I once came across an article…
I have this fake wordle game I think that the problem is with fetching the api and returning the functions for validation. I get an error that "getData(...).isCorrect is not a function" whenever I press submit and when I try…
I want to create a shortcode function that returns: 2021 - 2022 And then it would update next year automatically. This is the (broken) code I have so far: function current_class_year(){ return date('Y'); // current year return date('Y', strtotime('+1 year'));…
I made it possible to delete the post from the front end with this code (https://wordpress.stackexchange.com/questions/132196/get-delete-post-link-redirect): <a class="button-iv" onclick="return confirm('are you sure...?');" href="<?php echo get_delete_post_link( $post->ID ); ?>" title="delete doc">Delete doc</a> In functions.php i have this code for redirect after…
I am fluent in HTML and CSS but not so much in PHP. Any help would be appreciated. I have a custom function in Wordpress as seen below: function prefix_calculation_global_calculation_vars( $vars ) { return array( 'setup_cost' => 200, ); }…
I'm trying to get post id of image and then get specific size of image. If I give hardcode single image url then it works fine but if I give url through variable then it returns 0. It is strange…
I need to let users only post once for custom post 'projects'. The code below counts the number of the post: $userid = get_current_user_id(); function count_user_posts_by_type($userid, $post_type = 'projects', $post_status = 'publish') { global $wpdb; $query = "SELECT COUNT(*) FROM…
Below is my JavaScript function, it needs to run only once. It means that when the user visits the website for the first time the code must be run. When the page reloads it doesn't need to run. I am…
So I am renaming my "Posts" in WordPress backend to "News" and was able to use the code (thanks to Chris Perryman) added to my functions.php file but I would also like to change the default dashicon as well to:…
I'm using Astra theme on WordPress and I'm trying to replace the site logo with an ACF field entry. Having really big difficulties setting the logo at all using Astra's astra_replace_header_logo filter. Trying to start with baby steps and replace…