PHP calling function within a class

You can merge this two json objects via array_merge. But you must decode before to a array. You have this inside your example, below as single source function. This should get the merged json object. A example function, usable for your mix_cat()method. function mergeToJSON( $obj1, $obj2 ) { $json1 = $this->test_cat(); $json2 = $this->test_cat1(); if … Read more

Get the name of the post type

My sleuthing methods go like this: Look for an XML sitemap. If the site uses a common plugin like Yoast SEO and generates sitemaps, often the URLs will give you enough clues to figure out what the post types are named. Unfortunately, it doesn’t appear this site is using any XML sitemap plugins. Look for … Read more

How to debug new shortcode? And how to get string from shortcode into code?

To run this code to test it you can use the wp-cli tool with the eval-file command. wp-cli eval-file loads up the whole WordPress infrastructure then runs your PHP file so you can use WordPress calls like wp_remote_request without having to put this code in a page or pulgin. E.g. write a file called test.php … Read more

.htaccess and proxy settings for routing a decoupled REST API consuming theme

Ok this probably has a superfluous few lines but this works for me: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^static/(.*)$ /wp-content/themes/MYTHEME/static/$1 [R=301,NC,L] RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

Using the JSON API via HTTPS and HTTP

You can serve your site on both protocols http and https. This might be problem if you care about SEO (duplicate content). You can use 301 redirection to force users to be redirected from http to https. Old app will be slightly slower because of redirection but it will be working. This might be problem … Read more