Check if variable is set in filter

The variable you have named $query is actually the WP_Query instance having filters applied to it. You can simply call its function get to retrieve query vars. For example: function votes( $where, $query ) { $sort = $query->get(‘sort’); if (!empty($sort) $where .= ” AND $sort >= votes”; return $where; }

How to list posts from a plugin taxonomy?

To query by taxonomy you need to know its query_var that is used in its register_taxonomy() call. It defaults to taxonomy name so usually equal to that. Then you use that info in query argument: query_posts( array( ‘query_var’ => ‘term’ ) ); See Querying by taxonomy in Codex. It is hard to suggest more without … Read more

It’s okay if I do not write add_action()

It is not always required technically but it is good practice to follow for multiple reasons: Code is more organized by keeping hook-related stuff together The more precise conditions when it runs – the better for performance It is easier to unhook function, that performs multiple add_, then unhook each add_ individually. The order of … Read more

Why could my comment_form variable not be working?

This code makes no sense: function my_fields($fields) { $fields[‘new’] = ‘<p>red rover 1</p>’; return $fields; } add_filter(‘comment_form_top’,’my_fields’); I’m not even sure what it’s supposed to do, because comment_form_top is an action, not a filter. If you want to add extra fields, you should be using the comment_form_default_fields filter: add_filter(‘comment_form_default_fields’,’my_fields’); However, this might not work or … Read more

Custom styles.css sheet for visual editor

You don’t have to specify a file for the editor style. Just use add_editor_style(); in your functions.php, and then create a file called editor-style.css in your theme folder. You may want to look at some examples (e.g. Twenty Eleven) for some of the TinyMCE-specific rules, which is the stock visual editor you’re referring to.