Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry, i ended here looking for a solution for this and didn’t realise this was the alpha/beta section.

    My fault

    This adaptation is working for me in WP 3.2.1

    function restrict_your_post_type_by_your_taxonomy() {
    	global $typenow;
    	global $wp_query;
    	if ($typenow=='your_post_type') {
    		$taxonomy = 'your_taxonomy';
    		$your_taxonomy_tax = get_taxonomy($taxonomy);
    		wp_dropdown_categories(array(
    			'show_option_all' => __("Show All {$your_taxonomy_tax->label}"),
    			'taxonomy' => $taxonomy,
    			'name' => 'your_taxonomy',
    			'orderby' => 'name',
    			'selected' => $wp_query->query['your_taxonomy'],
    			'hierarchical' => true,
    			'child_of' => 0,
    			'depth' => 2,
    			'hide_empty' => false,
    		));
    	}
    }
    add_action('restrict_manage_posts','restrict_your_post_type_by_your_taxonomy');
    
    function convert_your_taxonomy_id_to_taxonomy_term_in_query($query) {
    	global $pagenow;
    	$qv = &$query->query_vars;
    	if( $pagenow=='edit.php' && isset($qv['your_taxonomy']) && is_numeric($qv['your_taxonomy']) ) {
    		$term = get_term_by('id',$qv['your_taxonomy'],'your_taxonomy');
    		$qv['your_taxonomy'] = $term->slug;
    	}
    }
    add_filter('parse_query','convert_your_taxonomy_id_to_taxonomy_term_in_query');

    You only have to change “your_post_type” and “your_taxonomy” to your needs.

    I have tweaked the second function a bit, as now wordpress passes the variable as your taxonomy name instead of a “term”.

    Thread Starter rhundesign

    (@rhundesign)

    Another solution I’m thinking about would be to rename the filename to something like

    “%the post title%-%constant string%.pdf”

    when uploading it, and then hardcode in my template a link to that specific filename…

    But I don’t know how to do that neither…

    Help will be much appreciated!!

Viewing 3 replies - 1 through 3 (of 3 total)