Check IF single OR multiple custom data has been entered

Since you already using get_post_custom a slightly cleaner yet still dirty (php) way of doing it. $sermondata = get_post_custom($post->ID); if( isset($sermondata[‘sermon_audio’]) || isset($sermondata[‘sermon_video’]) || isset($sermondata[‘sermon_document’])) { ?> <div id=”downloads”> // rest of your echo output </div> <?php } ?> ps . Just make sure the value is not null, to be safe you can combine … Read more

How to output an image or icon for selected check box in a custom post

You can do this by custom meta, all you have to do create custom metabox and the your checkboxes on it, the easiest way to create custom metabox is 1). Download WP Alchemy Metabox Class from here 2). Palce ‘wpalchemy’ folder inside of your theme folder in your function.php file include_once WP_CONTENT_DIR . ‘/themes/yourtheme/wpalchemy/MetaBox.php’; 3). … Read more

page not found for single-type.php file

Follow this tutorial for creating the custom post type. Here is the working code as per your requirement: function create_post_type_event() { //Create custom post type for event $labels = array( ‘name’ => _x(‘Event’, ‘post type general name’), ‘singular_name’ => _x(‘Event’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘event’), ‘add_new_item’ => __(‘Add New Event’), ‘edit_item’ … Read more

Give each post type label a different color?

You can do something like this: <a href=”https://wordpress.stackexchange.com/questions/80014/<?php echo get_post_type( $post->ID ); ?>” class=”<?php echo str_replace(‘ ‘, ‘-‘, get_post_type( $post->ID )); ?>”> <?php $post_type = get_post_type_object( get_post_type($post) ); echo $post_type->label ; ?> </a> and in your CSS part you can do something like: .pretty-little-liars { background color: khaki; } .once-upon-a-time { background color: blue; }

Creating Sections for Post Types

Set your regular permalinks to /blog/%postname%/ Register your custom post type with has_archive => TRUE and with_front => FALSE. Example: add_action ( ‘init’, ‘register_project_cpt’ ); function register_project_cpt() { register_post_type( ‘projects’, array ( ‘has_archive’ => TRUE, ‘hierarchical’ => TRUE, ‘public’ => TRUE, ‘publicly_queryable’ => TRUE, ‘rewrite’ => array ( ‘slug’ => _x( ‘projects’, ‘slug’, ‘text_domain’ ), … Read more

Custom post type, custom taxonomy, query posts only from taxonomy (children of)

The problem was in not reading documentation carefully enough 😉 As it stands in http://codex.wordpress.org/Class_Reference/WP_Query in ‘tax_query’ part, “tax_query takes an array of tax query arguments arrays” so the correct part of code would be: $query_args = array( ‘post_type’ => ‘portfolio-type’, ‘paged’ => $paged, ‘tax_query’ => array( array( ‘taxonomy’ => ‘portfolio-category’, ‘field’ => ‘id’, ‘terms’ … Read more

How to get postname in custom page?

You can use sanitize_title() on the page title: http://codex.wordpress.org/Function_Reference/sanitize_title and then you might try something like this: $my_page_title = “My page name”; $my_page_slug = sanitize_title($my_page_title); // or you can set the slug you want: //$my_page_slug = “my-slug-for-this-page”; $my_page_content = “This is my page content”; // Create page object $my_page = array( ‘post_title’ => $my_page_title, ‘post_name’ … Read more