How can i list random author?

The Codex lists rand as the orderby string, not RAND. I suspect that either works but I haven’t checked. But that isn’t how I’d do this. I’d lean toward something like… $current_category_ID = getCurrentCatID(); $current_cat_id = $current_category_ID; $author_array = array(); $args = array( ‘numberposts’ => -1, ‘cat’ => $current_cat_id ); $cat_posts = get_posts($args); foreach ($cat_posts … Read more

How can i listing current category and Featured Category post list?

I think you’re asking about your custom secondary loop affecting your main loop, correct? query_posts() alters the main loop. A quick fix would be to call wp_reset_query() after your custom loop to reset the query data: <?php wp_reset_query(); ?> However, it’s more efficient and friendlier to use WP_Query() instead of query_posts() (especially if you’re making … Read more

Shortcode of a function

Build a string instead of directly outputting the contents. $str=””; foreach ($postslist as $post) : setup_postdata($post); $str .= ‘<div class=”events”>’; $str .= ‘<p><strong>’.get_the_date().'</strong></p>’; $str .= ‘<p><a href=”‘.get_permalink().'” title=”‘.esc_attr(get_the_title()).'”>’.get_the_title().'</a></p>’; $str .= ‘</div>’; endforeach;

Adding a ‘style=’ bit to image_send_to_editor output

I can’t find the proper hook, but there is alternative solution: to add style=”float:right” to all images in content, which have class=”alignright”: add_filter(‘the_content’, ‘my_add_image_float_right’); function my_add_image_float_right($content) { $pattern = ‘@(<img.+)(alignright)(.*)(/>)@Ui’; $replacement=”$1$2$3 style=”float:right” />”; $content = preg_replace($pattern, $replacement, $content); return $content; }

how can authors to define custom pages?

You can do the following: <?php $post = $wp_query->post; $options = get_option( ‘sample_theme_options’ ); $authors = explode( ‘,’, $options[‘sometext’] ); if ( is_author( $authors ) ) { include ( TEMPLATEPATH . ‘/brand.php’ ); } else { include ( TEMPLATEPATH . ‘/customauthor.php’ ); } ?> This way, you’re always sure that $authors contains an array.

Why is this function crashing my wordpress installation? [closed]

First, be sure to enable WP_DEBUG in your wp-config.php file, so that you can see fatal error messages. In this case, the problem is that you’ve named your function load_wforms(), but you reference the callback wforms in your add_action() call: function load_wforms() {} …vs… add_action(‘init’, ‘wforms’); The second parameter, wforms, refers to a function named … Read more