Undefined offset: 0-wp-includes/meta.php:488 -Melding

You should change $parents[] to $parents in get_parents() function: $parents = get_metadata(‘post’, $post_id, WPKWP::$META_CHILD, false); if ($parents !== FALSE && count($parents) > 0) return $parents; return false; because get_metadata return array in this case. If the $post_id parameter is invalid, false is returned. If the meta value isn’t set, function return an empty array. Therefore, … Read more

Adding Author Box Meta Links with Co-Authors

These are outside of the foreach loop: $twitter = get_the_author_meta(‘twitter’, $author_id); $facebook = get_the_author_meta(‘facebook’, $author_id); $googleplus = get_the_author_meta(‘googleplus’, $author_id); $linkedin = get_the_author_meta(‘linkedin’, $author_id); $instagram = get_the_author_meta(‘instagram’, $author_id); $youtube = get_the_author_meta(‘youtube’, $author_id); $email = get_the_author_meta(’email’, $author_id); So (remove that, and) try using $coauthor->ID with get_the_author_meta() like this: <div class=”author-box-social-icons”> <?php if( $email = get_the_author_meta( ’email’, $coauthor->ID … Read more

How to get post ID from button and pass title to Modal

When we display post data in model with on click of button we have to provide the post-id with data attribute in for specific model target. Please add post-id in data-target in anchor tag as well as in main div tag ID. I have modified your code here: <div><?php echo wp_get_attachment_image($image_upload,$size=”full”);?><br/> <span class=”name”><?php echo $title; … Read more

Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]

The meta box template for the variations is defined in the file html-variation-admin.php. There you will find the hook “woocommerce_variation_options_pricing”. With this hook you can add your input field to the desired place. function variation_settings_fields($loop, $variation_data, $variation) { // Your Text Field woocommerce_wp_text_input( array( ‘id’ => ‘_text_field[‘ . $variation->ID . ‘]’, ‘label’ => __(‘My Text … Read more

woocommerce related product title length

Problem solve based on this article https://designsmaz.com/how-to-short-woocommerce-products-title/#comment-76957 Basically I just replace the <?php the_title(); ?> to <?php $shorttitle = mb_substr(the_title(”,”,FALSE),0,45); echo $shorttitle; if (strlen($shorttitle) >44){ echo ‘&hellip;’; } ?>

Calling PHP Scripts in Ajax that are in PHP Snippets

PHP snippets intended for shortcode use aren’t going to work here (unless the plugin explicitly offers a solution, in which case ask them). To properly use AJAX in WordPress you need to put the functions in your child theme’s functions.php file or a simple plugin. Then you need to either: Hook the function into the … Read more

Undefined index for default custom theme option

You could make sure the index is defined before accessing it in header.php, and fallback gracefully: <?php $theme_option = flagship_sub_get_global_options(); if ( array_key_exists( ‘flagship_sub_shield’, $theme_option ) ) { $shield = $theme_option[‘flagship_sub_shield’]; } else { $shield = ‘option1’; // Default value } if (‘option2’ === $shield): //Image Option #2 elseif (‘option3’ === $shield): //Image Option #3 … Read more