Initialize class inside plugin

You don’t appear to have actually enqueued your script anywhere. You registered it, but don’t enqueue it, unless that code is elsewhere. When you load a file directly like you are– aka., browsing straight to ‘/wordpress/wp-content/plugins/konfigurator/html/class.konfigurator.php’— you can’t use any of WordPress’ functions because you have bypassed WordPress’ boot process. To use WordPress functions you … Read more

Using $wpdb to update current post

Nevermind, I was complicating this whole process because I wasn’t thinking about just using get_post_meta(). add_action(‘draft_to_publish’,’gcpl_draft_to_published’); function gcpl_draft_to_published($post){ $exp_processed = get_post_meta($post->ID, ‘_expiration-date-processed’, true); // check if the custom field has a value if($exp_processed != ”) { delete_post_meta($post->ID, ‘_expiration-date-processed’); } }

Shortcode with multiple variables

If you were to enable debugging and test the code (not sure why you are reluctant to do that), you would see that there are problems with the code. Your array elements need to be separated by commas and PHP variables begin with $. What you have won’t work as is. That kind of pure … Read more

I need to get this sub nav to show up on cat, sup-cat and post

The reason it only works on category and sub-category pages is because is_category() checks to see if a Category archive page is being displayed. However a post is not an “archive page” it is a “single page” (see http://codex.wordpress.org/Template_Hierarchy). So you would need to add another condition in there that first checks to see if … Read more

Sort categories by meta value

This is no solution, just an explanation: WordPress currently doesn’t have taxonomy meta data. You could add a stand alone table to add meta data there. Anyway, it’s not recommended to add your taxonomy/category/tag meta data to the options table as this one wasn’t made to get JOINed to do meta queries by it. My … Read more

Images not showing and plugins not installing on wordpress server move

First thing I would do: In your wp-config.php file, hardcode your new site URL by entering define(‘WP_SITEURL’, ‘http://www.example.com’); define(‘WP_HOME’, ‘http://www.example.com’); After that, have a look at the source code of your pages including images, and verify how the URLs of the the images look like. If they are wrong (relative to localhost?), you may have … Read more

default custom background image not saved in database when creating a new site

I assume you mean “get_theme_mod(‘background_image’) returns false” before I “save it once to activate it” If that is the case, get_theme_mod accepts a default parameter. Check the Codex: $name (string) (required) Theme modification name. Default: None $default (boolean|string) (optional) Default: false Pass your default image as the second parameter to that function and you should … Read more