Get the alphabetical sorted data with wpdb

It isn’t really WordPress-related indeed, but then again, OP doesn’t seem to know that, so here’s your answer :-). However, next time: this isn’t WordPress-related, please post PHP-questions in the corresponding SE. Sorting a PHP array can be achieved by using the sort function, which sorts an array alphabetically by its values. I’m assuming you … Read more

Dynamically Generate Functions and Hooks

Since Milo is a genius, I got this done much simpler by just looping through the array inside of the function, instead of trying to generate a new function dynamically for each item. The array contains ‘slug’ and ‘title’ attributes, and here’s the function: function cx_product_field() { global $fieldset; foreach ( $fieldset as $field ){ … Read more

Meta box not appearing in my custom post type

The last two parameters in add_meta_box() are switched. Look at the code in the tutorial next to yours: // tutorial code add_meta_box(‘wpt_events_location’, ‘Event Location’, ‘wpt_events_location’, ‘events’, ‘side’, ‘default’); // your code add_meta_box( ‘linkToArcticle’, ‘Link to arcticle’, ‘linkToArcticle’, ‘arcticles’, ‘default’, ‘normal’ ); Change it to: add_meta_box( ‘linkToArcticle’, ‘Link to arcticle’, ‘linkToArcticle’, ‘arcticles’, ‘normal’, ‘default’ ); And … Read more

Call two different function.js depending on page

You can write conditionals in your functions.php file to conditionally load the javascript files. For example: function theme_scripts() { // If this is the home page, run this script if(is_home()) { wp_enqueue_script( ‘example-script’, get_stylesheet_directory_uri().’/path/to/file.js’); } // Otherwise, run this script else { wp_enqueue_script( ‘other-script’, get_stylesheet_directory_uri().’/path/to/file.js’); } } add_action( ‘wp_enqueue_scripts’, ‘theme_scripts’ ); Codex page for home … Read more

Replace admin header logo with an image

I think the path to the image is wrong, use get_stylesheet_directory_uri() to retrieve the style.css path. If this isn’t it let me know and I will take a closer look. I just dug out an example which worked for me in the past: function my_login_logo() { ?> <style type=”text/css”> body.login div#login h1 a { background-image: … Read more

Changing plugin options from theme functions file?

For reference, you may want to read the update_option documentation. The arguments you are passing are completely unrelated. However, your third technique is the closest, you have to update all the options in the the update_option call, not just the one option you want. This is because of how the plugin is storing it’s options … Read more