Cannot get wpdb data (Error in a simple fuction) [closed]
What about changing BTC to a string <?php get_coin_price(‘BTC’); ?>
What about changing BTC to a string <?php get_coin_price(‘BTC’); ?>
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; }
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
Here is a short and simple plugin I wrote to add a re-tweet and Facebook like button to each post. This version of the Facebook like button uses the newer XFBML instead of the iframes but requires you to register an app id. To use the buttons just add the function call to your loop. … Read more
I think you’ll need to add a posts_join filter, to join the posts and postmeta tables. This link should be helpful: http://codex.wordpress.org/Custom_Queries, in particular this piece of example code: add_filter(‘posts_join’, ‘geotag_search_join’ ); add_filter(‘posts_where’, ‘geotag_search_where’ ); function geotag_search_join( $join ) { global $geotag_table, $wpdb; if( is_search() ) { $join .= ” LEFT JOIN $geotag_table ON ” … Read more
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
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
You can simplly check if ($comment->user_id > 0){ //comment by registered user }else{ //comment by none registered user }
I think you’ll have to work via get_plugins(). It will return a list of all plugins in your plugin folder, indexed by plugin location – which is the same as your array index. This is also what the plugin administration table uses. If you only need the data from one file you could also call … Read more
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.