Object method calling for global $wpdb in header.php

I think the problem might lie in: $wpdbinfo = $wpdb->get_results(“SELECT * FROM bo_mytable WHERE id=3”); $wpdb->get_results() returns an array of objects, yet you are referencing a property on $wpdbinfo (->nameinfo). You’ll either want to loop through the $wpdbinfo array, or if you’re certain you’ll get only a single record (possibly a safe assumption if id … Read more

Adding CSS to custom post type admin page causes error

You need to check for the presence of ‘post_type’ as an index of $_GET before using it: if ((isset($_GET[‘post_type’]) && $_GET[‘post_type’] == ‘slide’) || (isset($post_type) && $post_type == ‘slide’)) : Also, you should be using the wp_enqueue_style function instead of echoing your stylesheet at ‘admin_head’: wp_enqueue_style( ‘meteor-slides-admin’, plugins_url(‘/css/meteor-slides-admin.css’, __FILE__), array(), ‘1.0’ ); More information on … Read more

Add quantity field with each product on shop page-wooCommerce [closed]

Here is how i modified my loop/add-to-cart.php to achieve this: <?php /** * Loop Add to Cart * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly global $product; ?> <?php if ( ! $product->is_in_stock() ) : ?> <a href=”https://wordpress.stackexchange.com/questions/125946/<?php echo … Read more

What happens if I don’t update my plugins?

I personally disable all updates; themes/plugins/core, too many times I was burned with erros in the most inconvenient times possible. Now I do manual updated for each site after I checked in a development environment. after im sure that everything works and I fixed every bug that happened I update the live site. Now I … Read more

Woocommerce: how to change ‘Cart Updated’ message [closed]

WooCommerce is heavily localised, so you can make use of WordPress’ localisation functions to change its messages. add_filter(‘gettext’, ‘wpse_124400_woomessages’, 10, 3); /** * change some WooCommerce labels * @param string $translation * @param string $text * @param string $domain * @return string */ function wpse_124400_woomessages($translation, $text, $domain) { if ($domain == ‘woocommerce’) { if ($text … Read more

How to use is_single and get_post_type within a plugin?

You need to hook into an appropriate place within the WordPress load sequence. For example, add_action(‘init’, ‘my_function’); //is too early and won’t work! Where as, add_action(‘wp’, ‘my_function’); //will work! And so too will, add_action(‘template_redirect’, ‘my_function’); //this works too! In fact template_redirect fires just before rendering the page/post to the viewer so its an appropriate place … Read more

WordPress 4.8.1 php getting commented

As I mentioned in the comments, you should not and also can not use codes inside your content. Any code tags that you use will be escaped. Instead, define a shortcode in your theme’s functions.php file and use that inside your content. Let’s create a simple shortcode together: function create_shortcode( $atts ) { // Create … Read more

How to create a child/addon plugin

Personally I’d either write my own plugin with a if plugin x exists clause or just edit it and send the code off to the developer saying “I have added a feature to your plugin, hope you like it” kinda deal. Realistically though, in my own site I just edit the code and be done … Read more