WordPress


Cannot remove the ‘sticky’ option from a post

Recently, we were trying to remove the sticky flag from a post on a self-hosted installation. We were removing the sticky option both from the posts menu and the post editor and after a page refresh, it would reappear as active.

After some troubleshooting, it appeared that the problem was with the WPML plugin. After we disabled that one, we could change the option for the sticky status. Unfortunately, when we activated the plugin again, the option returned to its previous state.

The “fix” that worked was the following:

  1. We visited the WPML plugin settings page: https://example.com/wp-admin/admin.php?page=sitepress-multilingual-cms%2Fmenu%2Ftranslation-options.php
  2. Then in the category Posts and pages synchronization, we removed the tick from the option Synchronize sticky flag and the clicked the Save button.
  1. Following that, we edited our post again and removed the sticky option.
  2. Afterwards, we checked the homepage that the post had been removed and then we went back to the settings page of WPML https://example.com/wp-admin/admin.php?page=sitepress-multilingual-cms%2Fmenu%2Ftranslation-options.php
  3. From there, we enabled again the Synchronize sticky flag option, pressed the Save button to revert the change to the settings hoping the problem will be fixed eventually.

Technical Info

  • WPML Multilingual CMS version 4.2.6
  • WordPress version 5.8.1

Gravity Forms: How to Restrict a DatePicker Date Range and Datepicker 1 becomes minDate for datepicker 2

Create an html block in your form and add the following code:

<script type="text/javascript">
gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
    if ( formId == 10 && (fieldId == 30 || fieldId == 32) ) {
        var ranges = [
            { start: new Date('10/01/2021'), end: new Date('10/11/2021') }
        ];
        optionsObj.beforeShowDay = function(date) {
            for ( var i=0; i<ranges.length; i++ ) {
                if ( date >= ranges[i].start && date <= ranges[i].end ) return [true, ''];
            }
            return [false, ''];
        };
        optionsObj.minDate = ranges[0].start;
        optionsObj.maxDate = ranges[ranges.length -1].end;
    }
    if ( formId == 10 && fieldId == 30 ) {
        optionsObj.onClose = function (dateText, inst) {
            jQuery('#input_10_32').datepicker('option', 'minDate', dateText).datepicker('setDate', dateText);
        };
    }
    return optionsObj;
});
</script>

Be sure to change the dates, the form ID and field ID for the two fields.


Images, that are not visible initially, don’t show with Customizr Pro theme

Recently we were investigating an issue on a live website at which some images were not loading. After some testing we saw that only pictures that were visible while loading the page were being loaded as well. Checking the console we found the following JS error:

Uncaught TypeError: a.browser is undefined    jQuery 2
jquery.fancybox-1.3.4.min.js:1:205
NOK => browserDetect::addBrowserClassToBody => TypeError: t.browser is undefined tc-scripts.min.js:1:81903

We did not want to waste time on debugging this so we disabled the Load images on scroll option to get the site live asap. To do so, first we clicked on the Customize button on the admin bar:

Once the menu loaded, we clicked on the Advanced Options button:

From there, we clicked on Website Performances :

And got the following options

As seen in the image below, we disabled (among other changes) the option Load images on scroll

After pressing the Publish button, we reloaded the site, the JavaScript error was still there but the images were loading as expected.


“Cookies & Consents Banner (Jetpack)” not available!

We got prompted by the Jetpack plugin to add their Cookies & Consents Banner (Jetpack) to our website to comply with the rules and regulations for privacy issues but when we visited the Widgets tab we could not find it there to add it.

It appears that the module for Extra Sidebar Widgets of Jetpack was disabled. To enable it, we visited this page https://bytefreaks.net/wp-admin/admin.php?page=jetpack_modules and activated it from the list.

After that, we refreshed the Widgets page and a list of new widgets, including the Cookies & Consents Banner (Jetpack).

When adding it, it created a new page with some basic information and got our plugin up and running!