Search Woocommerce product titles only

It turns out the free Relevanssi plugin does this rather well. I was afraid it would only search posts and not custom post types, but it does it all… and rather well! It only requires a simple filter added to your theme’s functions.php file to get it to omit the body content: // search titles … Read more

Creating Multiple Admin Widget Page with Calling One Sidebar

Your code deletes keys from widgets. One of those keys is named ‘class’. When WordPress looks for the ‘class’ key it is missing and PHP reports that. I think you want this: $groups_sidebars = array(); foreach ( retrieve_widgets() as $widget ) { if ( array_key_exists( ‘groups-sidebar’, $widget ) ) $groups_sidebars[] = $widget; } $wp_registered_sidebars = … Read more

Reference external file as a function

You can’t. Create a function that loads that file: function load_admin_page_file() { require ‘admin-members.php’; } Then use that function name as callback argument. In PHP 5.3 you can use a lambda: add_menu_page( ‘Members’, ‘Members’, ‘manage_options’, ‘members’, function() { require ‘admin-members.php’; } );

How to Publish WP original Source metabox value on front-end webpage

get_post_meta is returning an array. Apparently, the plugin is saving _original_source as an array. I don’t know what that array looks like but instead of echo do print_r($original_source); and you get something that looks like: Array ( [a] => apple [b] => banana ) You can then do something like echo $original_source[‘a’] to print “apple”.

Re writing Category Argument

The codex explains this pretty well. <?php $args = array( ‘orderby’ => ‘slug’, // or name ‘order’ => ‘ASC’, ‘taxonomy’ => ‘types’ ); $categories= get_categories( $args ); ?>