Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter shqipe420

    (@shqipe420)

    As a matter of fact with the new update this issue does not occur anymore.

    Again thanks for your help @bsfaradhy

    Thread Starter shqipe420

    (@shqipe420)

    Hey @bsfaradhy

    Thanks for the info. I thought you may have a code snippet or something, but if not I can also just wait for the new update.

    Until that I will just leave this thread open in case I have some additional questions.

    Thank you very much again!

    Thread Starter shqipe420

    (@shqipe420)

    Hi @bsfaradhy

    Thanks for the heads up!

    Alright then in case you are already aware of this issue and are working on this then it is fine. As I said it is only a matter of Lighthouse results issue and therefore not crucial, but nice if it would be fixed in the future.

    If you think it’s gonna take some time to be fixed I would appreciate it if you have any idea how to use custom php/ JS Code to prevent this from causing the console error log.

    Best Regards

    Thread Starter shqipe420

    (@shqipe420)

    In case this helps the console gives me this error

    “Uncaught ReferenceError: jQuery is not defined
    at frontend.min.js?ver=4.11.6:1:24929″

    which is basically the following code at the end of the script:

    jQuery(document).on("click", ".main-header-bar-navigation a", function() {
    jQuery("body").hasClass("ast-main-header-nav-open") && (jQuery(".main-header-menu-toggle.toggled").removeClass("toggled"),
    jQuery(".main-header-bar-navigation.toggle-on").removeClass("toggle-on").css("display", ""),
    jQuery("body").removeClass("ast-main-header-nav-open"))
    });
    Thread Starter shqipe420

    (@shqipe420)

    Hey Jay,

    Thanks for your reply.

    Yeah thats exactly the issue I tried to tell you about, sorry in case it was not clear enough.

    Meanwhile I also used a work around, where I insert a button in my WP admin backend Page, that clears the cache, when clicked on. Looks something like this:

    // Create a button field for your submenu in your admin page
    <form method="post" action="">
    
    <?php
     wp_nonce_field('clear_cache_action', 'clear_cache_nonce');
    ?>
    
       <button type="submit" name="clear_job_cache_button" class="button">Empty Job Cache</button>
    </form>
    
    // Clear Cache
    if (isset($_POST['clear_job_cache_button']) && check_admin_referer('clear_cache_action', 'clear_cache_nonce')) {
    
    WP_Job_Manager_Cache_Helper::get_transient_version('get_job_listings', true);
    wp_redirect(admin_url('YOUR_ADMIN_SUBMENU'));
    exit;}

    Looking forward to the update and thank you very much for your help again.

    Thread Starter shqipe420

    (@shqipe420)

    Hey Jay,

    Sorry for the late reply as I had to work on some other things.

    Just wanted to tell you that it worked perfectly for my custom code, thank you very much for that I appreciate it a lot.

    The only problem that I couldn’t solve is how to delete the cache when bulk actions in the admin backend ‘mark_jobs_filled’ and ‘mark_jobs_not_filled’ are applied as I didn’t find a proper place to hook in. The only function which would be suitable is ‘do_bulk_actions’ in the class-wp-job-manager-cpt.php file, but it doesn’t have an action hook.

    Do you have an idea here?

    Again thanks in advance and Happy New Year.

    Thread Starter shqipe420

    (@shqipe420)

    Hey Jay,

    Regarding my initial issue I have found the cause: The Problem was the caching in the function get_job_listings() in wp_job_manager_functions.

    As you mentioned, I tried to reproduce the error by deactivating all plugins except for WPJM and I used the theme twenty twenty one. You can reproduce the error by taking the following steps:

    1. Enable the Option: Hide filled Positions
    2. Create a Job and use the Backend option (not the Frontend or the edit-job in Backend as these update the whole post and clear the cache for job_listings) to fill the position by ticking the box next to the job and mark it as filled.
    3. On the job page you will still see the job, although its design (contrast) is different from the other jobs (just as if the “hide filled positions” is disabled)
    4. If you work on a localhost you can change the time settings of your computer and set it to a day after the currrent day. Now the job is not visible, as cached data is only used for 24 hours.

    Btw. this also goes both ways: In case you set a job from not filled to filled by using this technique, the job is not going to be displayed.

    In order to solve this issue I used the following code which disables caching:

    function delete_cache_job_listings( $should_cache) {
    
    	$should_cache = false;
    	return $should_cache;
    
    }
    add_action( 'get_job_listings_cache_results', 'delete_cache_job_listings', 10, 1 )

    However, as caching is important for the performance I would appreciate it if you could patch this or maybe show me another solution.

    Thank you very much again!

    Thread Starter shqipe420

    (@shqipe420)

    Thanks for your quick answer. Yeah it seemed like I activated the validation, but forgot to save it for some reason.

    Thread Starter shqipe420

    (@shqipe420)

    Hey, thanks for your answer. Yes, I also use some custom code from my functions.php file. Yet for some reason when using my code to check if the job is filled, the job still shows up on the frontend, although the settings were set just like you mentioned. As I said it also worked, if you set the job to filled on the front or backend, but if you use a function which updates the database value for the meta key ‘_filled’ from 0 to 1 it doesn´t work.

    Anyway, for anyone who is facing the same issue, here is a solution that worked for me: I modified the template “content-job-listing” with a conditional block which checks whether the job ID is filled or not. So you basically just add this code right before the template:

    if(is_position_filled($post->ID) === false){
    // The Rest of your template
    }

    I still didn’t figure out why it didn’t work without this code, but this works fine for me and I didn’t encounter any issues until now.

Viewing 9 replies - 1 through 9 (of 9 total)