body_class REST field in WP-API

get_body_class() relies on $wp_query to do its thing, which is apparently a no-go for the JSON API. I considered creating a global object to hold the body class, and just using that to keep the body_class up to date…but that wouldn’t work without page reloads, and there would be no assurance that the object was … Read more

Set Title from Custom Template

Use global variables to pass values from the template to the header. // in the template file global $my_page_title; $my_page_title=”field value”; global $my_meta_description; $my_meta_description = ‘field value’; get_header(); // in the header file global $my_page_title; global $my_meta_description; echo $my_page_title; echo $my_meta_description;

How to disable search as you type plugin suggestions?

Dirty fix will be to remove/change $pluginInstallSearch.on to trigger only on submit. The changed function looks like this. Remember this is not recommended. $pluginInstallSearchOnlyonSubmit = $(“.plugin-install-php .search-form.search-plugins”); $pluginInstallSearchOnlyonSubmit.on( ‘submit’, _.debounce( function( event, eventtype ) { var $searchTab = $( ‘.plugin-install-search’ ), data, searchLocation; data = { _ajax_nonce: wp.updates.ajaxNonce, s: $pluginInstallSearchOnlyonSubmit.find(‘.wp-filter-search’).val(),//Set the search input value tab: … Read more