Use of undefined constant issue

It’s possible that your $http_host isn’t in the list of possible choices. You can always check first that the ENVIRONMENT constant has actually been defined: if ( defined( ‘ENVIRONMENT’ ) && ‘local’ === ENVIRONMENT ) { define(‘ASSETSDIR’, get_template_directory_uri() . ‘/assets’); } else { define(‘ASSETSDIR’, $dist_dir . ‘/assets’); }

Error with PHP 8

You are using a global variable called $post in your code, but this variable is not defined. To fix this issue, you can try defining the $post variable at the top of your script: <?php global $post; if (get_the_terms($post->ID, ‘ausstattung’)) { $taxonomy_ar = get_the_terms($post->ID, ‘ausstattung’); echo “”; $output=”<ul>”; foreach ($taxonomy_ar as $taxonomy_term) { $output .= … Read more

How to group by column a and sum column b and c in a php array

To group and sum the values in your array by the shipping field, you can use a loop and a temporary associative array to store the intermediate results. Here is an example of how you can do this: $result = array(); foreach ($array as $item) { $shipping = $item[‘shipping’]; if (!isset($result[$shipping])) { $result[$shipping] = array( … Read more