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.

inserting a category into post

I haven’t tested the code below, but I think you could use something like it. add_shortcode( ‘show_posts_from_cat’, ‘wpse_85708_posts_from_cat’ ); function wpse_85708_posts_from_cat( $atts ) { extract(shortcode_atts(array( ‘id’ => ” ), $atts)); $args = array( ‘category’ => $id ); $cat_posts = get_posts( $args ); foreach( $cat_posts as $cat_post ) { setup_postdata( $cat_post ); // Display code here. … Read more

Display Related Posts by Category in Random

In the arguments for get_posts, add ‘orderby’ => ‘rand’. See get_posts in Codex for a full list of available arguments. $args = array( ‘category__in’ => $category_ids, ‘post__not_in’ => $showed_posts, ‘showposts’ => $SMTheme->get( ‘layout’, ‘relatedcnt’ )-$post_cnt, ‘caller_get_posts’ => 1, ‘orderby’ => ‘rand’ );

Find out in which kind of archive am I

Inspect get_queried_object(). On an archive for the category Uncategorized you get something like … stdClass Object ( [term_id] => 1 [name] => Uncategorized [slug] => uncategorized [term_group] => 0 [term_taxonomy_id] => 1 [taxonomy] => category Find out in which kind of archive am I => [parent] => 0 [count] => 8 [cat_ID] => 1 [category_count] … Read more

How To Download WordPress Audio Attachments

Some people like to stream audio in the browser, others like to download. Each of them is able set up the browser to choose between downloading or streaming different MIME types to get what they need. On the other hand you can force download of certain MIME type files using PHP header() function. See How … Read more

Link post images to post

Yes, don’t use regex for parsing HTML but use DOM instead. This is how I would work it out : In your toolbox, a function to get innerDOM of a node : // GET INNER HTML OF A NODE function DOMinnerHTML($element) { $innerHTML = “”; $children = $element->childNodes; foreach ($children as $child) { $tmp_dom = … Read more