MichaelH
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to show category name that have today post?<?php // display the categories used on today's posts $this_year = date('Y'); $this_month = date('m'); $this_day = date('d'); $args=array( 'year' => $this_year, 'monthnum' => $this_month, 'day' => $this_day, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); $cat_args=array('orderby' => 'none'); $cats = wp_get_post_terms( $post->ID , 'category', $cat_args); foreach($cats as $cat) { $cat_array[$cat->term_id] = $cat->term_id; } endwhile; } if ($cat_array) { echo '<p>List of categories used on posts for '.$this_year.$this_month.$this_day.'</p>'; foreach($cat_array as $cat) { $category = get_term_by('ID',$cat, 'category'); echo '<p><a href="' . esc_attr(get_term_link($category, 'category')) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a><p> '; } } wp_reset_query(); // Restore global post data stomped by the_post(). ?>Forum: Fixing WordPress
In reply to: Calculate occurrences of text word in postmeta meta_value<?php $var_count = $wpdb->get_var("SELECT count( * ) FROM $wpdb->postmeta WHERE meta_key = '_custom_meta' AND meta_value LIKE '%super_m%';"); echo '<p>count is ' . $var_count . '</p>'; ?>Forum: Plugins
In reply to: Taxonomy PaginationIf you are creating your own template to display posts/custom posts you need to use the paged query var and the next/previous posts link code.
Disable all plugins, switch to the twentyten theme. Update your permalinks to use the Default permalinks. In single.php put this line after
the_content()(line 30) and put your custom taxonomy name in place of genre.<?php echo get_the_term_list( $post->ID, 'genre', '<p>Genre: ', ', ', '</p>' ); ?>Then visit a single post, click on the taxonomy link and see if pagination works.
Forum: Alpha/Beta/RC
In reply to: 3.1 beta auto installed with beta testing plugin UNINSTALLEDPut it in your theme’s function.php
Forum: Plugins
In reply to: Taxonomy PaginationLink to see the problem might be useful.
Forum: Fixing WordPress
In reply to: Calculate occurrences of text word in postmeta meta_valueI’m sorry, please restate the goal.
Count all occurences of ‘super_m’ in the database or count all occurences of ‘super_m’ in a custom field for a particular post.
Also, what is the custom field ‘key’ you are trying to search? Is it “_custom_meta”?
Forum: Alpha/Beta/RC
In reply to: 3.1 beta auto installed with beta testing plugin UNINSTALLEDDon’t know why that happened–hopefully you have a backup to restore. If not you might use
remove_action( 'init', 'wp_admin_bar_init' );to remove the admin bar.Also note that there is to be a big ‘check-in’ of code this weekend to clean-up the admin bar.
Forum: Fixing WordPress
In reply to: Calculate occurrences of text word in postmeta meta_value$dum = get_post_custom_values('_custom_meta'); echo substr_count($dum, 'super_m');Forum: Plugins
In reply to: Taxonomy Pagination<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($query_string .'&posts_per_page=5&paged=' . $paged); if (have_posts()) : while (have_posts()) : the_post(); the_title(); the_excerpt(); endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php endif; get_footer(Credits); ?>Note: that the only reason you really need a specific template for this is that you are wanting a different number of posts displayed for taxonomies than you specify in your Settings->Reading->Blog pages show x posts.
Forum: Fixing WordPress
In reply to: Calculate occurrences of text word in postmeta meta_valueSee Custom Fields
Forum: Plugins
In reply to: Taxonomy PaginationThen paste your complete template in a pastebin (e.g. wordpress.pastebin.com), report the link back here and maybe someone can spot the problem.
Forum: Fixing WordPress
In reply to: Get categoriesForum: Plugins
In reply to: Query for multiple meta keys and valuesYou’d have to query for just one value, then in your loop get the other custom field and filter based on that.
Or consider some of the wpdb examples.
Forum: Fixing WordPress
In reply to: wp_usermeta: Table 'testmarquez.wp_usermeta' doesn't existForum: Fixing WordPress
In reply to: Calculate occurrences of text word in postmeta meta_valueUgly, but try http://www.php.net/manual/en/function.substr-count.php
Note: that’s a serialized array so see http://php.net/manual/en/function.unserialize.php