Custom HTML structure in wp_list_categories

In case someone finds this someday I was able to solve this and I used tis walker: class Navigation_Catwalker extends Walker_Category { // Configure the start of each level function start_lvl(&$output, $depth = 0, $args = array()) { $output .= “”; } // Configure the end of each level function end_lvl(&$output, $depth = 0, $args … Read more

Filtering the default avatar list

You are doing it correctly. The call to gravatar.com passes the location of your custom image so that WP can load it. Take a look at the query string in the src, you’ll see your image location. That’s how it works.

Comparing arrays within a loop

For anyone else, or for someone to maybe give a better, neater, more professional answer, this is what I have ended up doing: First I added a function to compare the new search data ($newSearch): function identical_values( $arrayA , $arrayB ) { sort( $arrayA ); sort( $arrayB ); return $arrayA == $arrayB; } Kept the … Read more

Check if page parent has certain template

This question has been answered on Stack Overflow before: https://stackoverflow.com/a/14626254/844732 add_action( ‘admin_head’, ‘check_page_template’ ); function check_page_template() { global $post; if ( ‘page-homepage.php’ == get_post_meta( $post->ID, ‘_wp_page_template’, true ) ) { // The current page has the foobar template assigned // do something } }

Who’s job is it to load a plugin’s translated strings?

EDIT – apparently this is all wrong so please disregard. You can use the WP_LANG_DIR constant to load translations from the update-safe languages directory first, and fall back to your plugin languages directory for any plugin-supplied translations. The default location is wp-content/languages, and users can set WP_LANG_DIR themselves in wp-config.php. When you load translations from … Read more

Bypass .htaccess when using download_url

You can inject a made-up referer into WordPress’ HTTP request by filtering pre_http_request. All you need is a simple class like this (untested!): class FakeWpReferer { private $referer; private $url; private $is_regex; /** * @param string $referer * @param string $url URL to fake the referer for. * @param bool $is_regex Is $url a regular … Read more

How to find objects by terms

Assuming “users” you are trying to pull is a custom post type. You can use “tax_query” as below. $user_args = array( ‘post_type’ => ‘custom_user_post’, // Custom post type, ‘posts_per_page’ => 10, ‘paged’ => ( ! empty( get_query_var( ‘paged’ ) )? get_query_var(‘paged’): 1 ), ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘user_sports’, //assuming your … Read more

Easy way to process search results before displaying

You can use pre_get_posts filter to filter out what you need. There’s an example on how to do this in Codex: https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_Pages_from_Search_Results function search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘post_type’, ‘post’); } } } add_action(‘pre_get_posts’,’search_filter’); Also, this article might get you in the direction of editing the search form…