MichaelH
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Next Page Previous PageHave you look at the various arguments (e.g. link_before & link_after) for wp_link_pages()?
Forum: Fixing WordPress
In reply to: View a list of categories displayed on the current pageNot sure this answers exactly, but from a previous example:
<?php // get 20 latest posts, display the categories used on those posts (most recent categories) $cat_array = array(); $args=array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 20, '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 20 latest posts</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: How to link Page to Category?Use the technique here:
How to easily display links to both Pages and Categories in the blog navigation header?Forum: Hacks
In reply to: Adding array within the $my_query info<?php $my_query = new WP_Query('showposts='.$section1_numberofposts.'&cat='.$section1_categoryid); ?>Forum: Everything else WordPress
In reply to: Contacting a user for a WordPress plugin that he wrotegoogle.com
Forum: Hacks
In reply to: Signup code into every postWell if post.php is the template that displays your posts then that would work.
Forum: Fixing WordPress
In reply to: "Custom fields" for custom taxonomies? Is it possible?There is this http://wordpress.org/extend/plugins/wp-category-meta/
Forum: Hacks
In reply to: Signup code into every postCould use this http://wordpress.org/extend/plugins/simplr-registration-form/
If you want WordPress to place the registration automatically in each post you would add code to the appropriate template (e.g. your theme’s index.php maybe):
<?php echo do_shortcode('[Register]'); ?>Also see:
Stepping Into Templates
Template HierarchyForum: Plugins
In reply to: Custom sidebar for different pagesAssuming by items you mean widgets:
* http://wordpress.org/extend/plugins/slayers-custom-widgets
* http://wordpress.org/extend/plugins/widget-logic
* http://wordpress.org/extend/plugins/display-widgets
* http://wordpress.org/extend/plugins/widget-context
* http://wordpress.org/extend/plugins/dynamic-widgets/
* http://wordpress.org/extend/plugins/widgets-on-pages/Forum: Hacks
In reply to: Delete all categoriesYou can do it pretty quickly without a plugin.
Under Posts->Categories, under Screen Options set the number of categories to 999 then use the Select and Bulk Delete to delete 999 categories at one time.
Forum: Developing with WordPress
In reply to: Set WordPress Post Expiration with DateSee if a plugin works:
http://wordpress.org/extend/plugins/post-expirator/Forum: Fixing WordPress
In reply to: Possible to Sort Posts with Chinese Characters in the TitleLook at:
http://wordpress.org/extend/plugins/wp-custom-fields-search/You’ll also want to review
Stepping Into Templates
Template HierarchyForum: Themes and Templates
In reply to: Single post when clicking on taxonomy termThis seems to work.
Redirect to post permalink if taxonomy archive has only post
Needs to be added to theme functions.phpfunction tax_redirect() { global $posts, $wp_query; if ( is_tax() && $wp_query->found_posts == 1 ) { wp_redirect( get_permalink($posts[0]->ID), 301 ); } } add_action('template_redirect', 'tax_redirect');Can’t say how the plugin does it…didn’t test this, but might try this in your loop:
<?php $taxonomy = 'post_tag'; $args=''; $terms = wp_get_post_terms($post->ID , $taxonomy, $args); if ($terms) { foreach ( $terms as $term ) { if ($term->count > 1) { echo '<p><a href="' . esc_attr(get_term_link($term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a> has ' . $term->count . ' post(s). </p> '; } } } ?>Forum: Fixing WordPress
In reply to: Possible to Sort Posts with Chinese Characters in the TitleHave you tried:
<?php $cat_id = get_cat_ID('your_category'); $args=array( 'cat' => $cat_id, 'meta_key' => 'your_custom_field', 'orderby' => 'meta_value', 'order' => 'ASC', '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(); ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>See query_posts()