Disable Content Editor for Specific Pages

Your if condition is wrong and generates a syntax error. You need an logical operator to check for multiple conditions. Therefore your code should look like the following: if ( $template_file === ‘page-custom-one.php’ || $template_file === ‘page-custom-two.php’ ) { remove_post_type_support( ‘page’, ‘editor’ ); } You could also check for multiple values with the in_array function … Read more

How to use AJAX in WordPress in MYSQL query?

In WordPress it little bit complicated then default way to handle ajax form data. odify your js code like this. function ajaxSubmit(e){ // prevent the default action. e.preventDefault(); var myform= jQuery(this).serialize(); jQuery.ajax({ type:”POST”, // Get the admin ajax url which we have passed through wp_localize_script(). url: ajax_object.ajax_url, action: “submitAjaxForm”, data: myform, success:function(data){ jQuery(“.records”).html(data); } }); … Read more

Profile / benchmark wordpress on apache?

It is impossible to just guess what the performance issue is, it might not be related to a web server at all. Your options with WordPress are (scope ascending): PHP runtime profiler / debug code for basic timing of WP load. PHP engine profiler (binary extension), such as Blackfire. Full stack profiler (server software, etc), … Read more

How to modify mobile nav menu text in theme

You can leverage the use of the gettext filter to change the text. Add this code to your child theme’s functions.php or to a plugin: add_filter(‘gettext’, ‘wpse248225_change_text’, 20, 3 ); function wpse248225_change_text( $translated_text, $untranslated_text, $domain ) { if ( NECTAR_THEME_NAME !== $domain ) { return $translated_text; } // Make the changes to the text switch( … Read more

PHP error with a shortcode: “no suitable wrapper” for file_get_contents

Use the HTTP API: $http = wp_remote_get( ‘https://en.wikipedia.org/w/api.php?action=query&titles=Test_article&prop=revisions&rvlimit=1&format=json’ ); if ( ! $body = wp_remote_retrieve_body( $http ) ) return; if ( ! $data = json_decode( $body, true ) ) return; $date = new DateTime( $data[‘query’][‘pages’][‘746140638’][‘revisions’][0][‘timestamp’] ); return $date->format( ‘m-d-Y’ );

Multidimensional Array

The multidimensional array in this case is a multi-dimensional associative array, or a key-value pair. The key being ‘status’ and the value being your array of strings. In the conditional check you have attempted to access values by a numerical index, which in this case do not exist as nothing has been set to use … Read more

Loading Posts & Category with Ajax

Sure, the get_template_part() function can be called multiple times referencing to different files, so if you have a file in the partials/-folder, all you have to do is add a second function call here. function load_cat_posts () { $cat_id = absint($_REQUEST[‘cat’]); $args = array ( ‘cat’ => $cat_id, ‘posts_per_page’ => 10, ‘order’ => ‘DESC’ ); … Read more

How to exclude a widget from W3 Total Cache Plugin

You need to use fragment caching so enable PHP in the widget and then use the following tags: <!– mfunc –> The following links should help: https://wordpress.org/support/topic/using-shortcodes-with-fragment-caching/ https://www.justinsilver.com/technology/wordpress/w3-total-cache-fragment-caching-wordpress/