get_the_tags() not iterating through for/while loop, but will with foreach
get_the_tags() returns an array but the indexes do not start at 0 because they are the term ids.
get_the_tags() returns an array but the indexes do not start at 0 because they are the term ids.
FYI, you should never hack the WordPress core files. Instead, WordPress provides the handy rss2_item action hook. All we need to do is check if we’re on a category feed or not: function wpse_99336_category_feed_item() { if ( is_category() && get_the_post_thumbnail() ) { printf ( ‘<featured-item>%s</featured-item>’, wp_get_attachment_url( get_post_thumbnail_id() ) ); } } add_action( ‘rss2_item’, ‘wpse_99336_category_feed_item’ );
You can remove scripts with wp_dequeue_script(): function wpse99450_remove_cufon() { wp_dequeue_script( ‘inktheme-confu-ui’ ); // inktheme-confu-ui is the script’s handle, according to your posted code } add_action( ‘wp_enqueue_scripts’, ‘wpse99450_remove_cufon’, 20 ); // set priority to ’20’ so it will run later than the default But be careful — as @gdaniel pointed out, if the theme depends on … Read more
I’m not aware of any WordPress functions that do this, so you can try to play with this kind of query (untested): function get_custom_user_comments_count( $uid ){ global $wpdb; $sql = “SELECT COUNT(*) as total FROM {$wpdb->comments} as c JOIN {$wpdb->posts} as p ON p.ID = c.comment_post_ID WHERE c.comment_approved = ‘1’ AND p.post_status=”publish” AND … Read more
Try this, $cat = get_category_by_path(‘http://www.example.com/category/category-name/’) Reference http://codex.wordpress.org/Function_Reference/get_category_by_path
The user_register hook only fires when the user first registers. To have the custom profile data show up on the Edit User screen, you should use the edit_user_profile hook (and possibly show_user_profile, if you want users to be able to edit their own custom profile information).
Adding a new shortcode requires the following function in your plugin file: add_shortcode( ‘google-cal’, ‘output_calendar’ ); This means that your plugin has a function named output_calendar that is called anytime WordPress sees the shortcode [google-cal] in post or page content. Put your existing code in the output_calendar function. You only need three things in your … Read more
attachment.php is not the only template file for attachment display. mime-type based template files get priority. MIME_type.php – it can be any MIME type (image.php, video.php, application.php). For text/plain, in order: text.php plain.php text_plain.php http://codex.wordpress.org/Template_Hierarchy#Attachment_display I expect that that is the issue you are seeing. Check your theme for image.php. There is a further problem … Read more
Seeing as my comments seemed to answer the question: To get access to the URL params you want $wp_query->query_vars[‘myvar’]: http://wordpress.org/support/topic/how-to-pass-value-in-wordpress-url, e.g.: <?php global $wp_query; $node_id = 0; $args = array( ‘post_type’ => ‘jobs’, ‘category_name’ => $wp_query->query_vars[‘position_name’] ); $the_query = new WP_Query( $args ); The other parts of the question aren’t really WordPress issues, so Stack … Read more
In your functions.php file you should add an action to enqueue your scripts. <?php function my_enqueue_scripts() { wp_enqueue_script( ‘load_post’, get_template_directory_uri() . ‘/js/load_post.js’, array( ‘jquery’ ), ‘1.0’, 1 ); wp_localize_script( ‘load_post’, ‘wp_ajax’, array( ‘url’ => admin_url( ‘admin-ajax.php’ ), ‘nonce’ => wp_create_nonce( ‘ajax_nonce’ ) ) ); } add_action( ‘wp_enqueue_scripts’, ‘my_enqueue_scripts’ );