Get categories names as an array to use it in theme settings

Thanks Michael for the tip. I finally got it. The solution is as follows: $options[] = array( “section” => “zzz”, “id” => HS_SHORTNAME . “_multicheckbox_inputs”, “title” => __( ‘Multi-Checkbox’, ‘hs_textdomain’ ), “desc” => __( ‘Some Description’, ‘hs_textdomain’ ), “type” => “multi-checkbox”, “std” => ”, “choices” => my_list_cats() ); And in functions.php: function my_list_cats() { $cats … Read more

Editing a PHP file to include a small text piece on every page

You should provide your code when asking this type of question. Here is an example of a header.php file. Look at the code and see how it’s done: <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset=”<?php bloginfo( ‘charset’ ); ?>” /> <title> <?php global $page, $paged; wp_title( ‘|’, true, ‘right’ ); bloginfo( ‘name’ ); … Read more

Error while setting role

You have to use just $current_role variable instead of $current_role[0], because call get_user_meta( $author->ID, ‘wp_capabilities’ ); will return you array with roles as keys. <?php add_action( ‘save_post’, ‘update_roles’ ); function update_roles( $post_id ) { if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return $post_id; // Get the author $author = wp_get_current_user(); // Set variables for … Read more

How Can I Edit the Registration Code?

You can use the plugin AWeber Web Form Plugin. Just enable aweber optin checkbox for registration. Or If you want to do it yourself checkout the article http://adamcap.com/2011/10/how-to-integrate-aweber-and-wordpress-registration-without-a-plugin/

Cinema site, retrive the movies that actor play in

I think you want to list actors worked in a movie on the Movie Page and Vice Versa,, right ? Then you should consider using plugin called post-to-post to connect your Movies posts and Actors posts. Recently I came across an article by one of the WP developers itself, He developed a similar kind of … Read more

Only show image from custom field when present

<?php $imageid = get_post_meta($post->ID, ‘imageembed’, true); if($imageid != ”) { ?> <div class=”newsimage”><img src=”https://wordpress.stackexchange.com/questions/57967/<?php echo wp_get_attachment_url( $imageid ); ?>” width=”640″ /></div> <?php } ?> Use if condition to check if $imageid has any value in it or not.