hatefulcrawdad
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom Post Types and CategoriesHere is the code I’m using to get my custom post type and taxonomy. Does it look right?
add_action('init', 'portfolio'); function portfolio() { $labels = array( 'name' => _x('Portfolio', 'post type general name'), 'singular_name' => _x('Portfolio', 'post type singular name'), 'add_new' => _x('Add New', 'project'), 'add_new_item' => __('Add New Project'), 'edit_item' => __('Edit Project'), 'new_item' => __('New Project'), 'view_item' => __('View Project'), 'search_items' => __('Search Projects'), 'not_found' => __('No projects found'), 'not_found_in_trash' => __('No projects found in Trash'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 4, '_builtin' => false, 'supports' => array('title','editor','thumbnail','custom-fields','cats') ); register_post_type('portfolio',$args); } register_taxonomy( 'media', 'portfolio', array( 'hierarchical' => false, 'label' => __('Media Type'), 'query_var' => 'media' ) );
Here is the code I’m using in my page file to try and get the ‘media’ => ‘print’ to pass through.
<?php query_posts( array( 'post_type' => 'portfolio', 'media' => 'print' ) ); while (have_posts() ) : the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php endwhile; ?>
Forum: Fixing WordPress
In reply to: Custom Post Types and CategoriesI cannot seem to get that to work. I wonder if my custom post code is wrong somewhere. Can you tell me how you went about creating your custom post? Did you use a plugin or go into function.php?
Forum: Fixing WordPress
In reply to: Custom Post Types and Categoriesshould
'post_type' => 'portfolio', 'Project Type' => 'Print'
work?Forum: Fixing WordPress
In reply to: Custom Post Types and CategoriesThat plugin doesn’t really do what I need. I just want to show posts that include the taxonomy “web” or something like that. But these posts are from a custom post type. It must be possible, why would WP leave that out?
Forum: Fixing WordPress
In reply to: Custom Post Types and CategoriesI realize it going to take some programming skills. I just want en explanation of terms or tags that will filter by category of a custom post type.
I’m currently using this code to pull out all posts in the “portfolio” post type. But I want to limit what it shows to the Project Type of ‘print’ or ‘web’, etc.
<?php $port = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => 1 ) ); while ( $port->have_posts() ) : $port->the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php endwhile; ?>
Forum: Themes and Templates
In reply to: Problems with image attach tagThe more I look at it and fool around, the more it gets screwy. Shouldn’t there be a way to either push the rel though in the $args array? Or to echo the a tag and rel, then use the get attachment url? When I try that, it seems to break. Any help will be greatly appreciated.
Forum: Themes and Templates
In reply to: Problems with image attach tagoops, the code is actually this… I forgot to take out my attempt at adding rel to it.
?php $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1, ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { echo wp_get_attachment_link($attachment->ID, 'medium'); } } ?>
Forum: Themes and Templates
In reply to: Display images in Media LibraryHave you tried looking for some sort of gallery plugin? Perhaps one that has it’s own upload?
I have looked around, but most of them seem to be more advanced than what I’m looking for. I’m simply having a page where it just lists clickable thumbnails of all the photos in the Media library, well thats what I want to have. I know I could just make a post and past the url’s in it, but I wanted something easier. I figured WP would have something native for posting things from the media library, strange that it doesn’t.
For now I suppose I can just upload the images to blog posts as the method of uploading so that it will work. But I also don’t want to have to show a bunch of images with a blog if I want to upload pics from a trip or something.
Forum: Themes and Templates
In reply to: Display images in Media Libraryso by “attached” you mean they would have to be part of a blog post? They can’t just be images that I upload straight into the Media Library?