Forum Replies Created

Viewing 5 replies - 31 through 35 (of 35 total)
  • I agree with you that some people won’t want this behaviour, but I think the point is to show case all the new features of wp 3.0 and how they could be used. An option to turn it on and off might be an idea.

    The likely hood of a thumbnail matching the header size for one is unlikely.

    actual its not.. the theme will crop any image to the right size if its originally bigger than the header image size, default 940 x 198

    line 39 of functions.php

    // We'll be using them for custom header images on posts and pages
    	// so we want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit)
    	set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

    Its clearly a design feature of that theme. the header image width/height can be overloaded by filter as well twentyten_header_image_width, twentyten_header_image_height lines 13 & 14 of the functions file.

    Hi Just tried that out and there was a bug in it anyway,

    if (isset($page_template)) {
    	$template = array( $page_template ) . $templates;
    }

    needs to be

    if ( !empty( $page_template ) ) {
    	$templates = array( $page_template ) + $templates;
    }

    however, the _wp_page_template post meta property never gets set, if you hit save, navigate away and navigate back the drop down is back on default, so would have to hack the code that saves that meta_box’s settings to save when the post type isn’t a page.

    In theory, the below modification should check for/ and push a ‘page template’ to the front of the list of templates to look for. but not tested

    function get_publication_template()
    {
    	global $wp_query;
    
    	$object = $wp_query->get_queried_object();
    
     	$templates = array( 'publication-'. $object->ID .'.php',
    						'publication.php',
    						'single-'. $object->post_type .'.php',
    						'single.php' );
    
    	$page_template = get_post_meta( $object->ID , '_wp_page_template', true );
    	if (isset($page_template)) {
    		$template = array( $page_template ) . $templates;
    	}
    
    	return locate_template( $templates );
    }

    Not sure about using page templates for custom_post_types but you cant load a specific page template for a custom type, get_single_template() in wp-includes/theme.php actually looks for one.

    single-‘post_type’.php in the current 3.0 code base. so if you create a ‘single-song.php’ and put in you theme it will get used.

    More over if you want to take complete control of the template loaded you can do something similar to.

    function is_publication()
    {
    	$post_type = get_query_var('post_type');
    	// short had for if / else;
    	return $post_type == 'publications' ? true : false;
    }
    
    function get_publication_template()
    {
    	global $wp_query;
    
    	$object = $wp_query->get_queried_object();
    
     	$templates = array('publication-'. $object->ID .'.php', 'publication.php','single-'. $object->post_type .'.php', 'single.php' );
    	return locate_template( $templates );
    }
    
    function set_publication_template( $template )
    {
    	if ( is_publication() ) {
    		// custom template filename
    		$template = get_publication_template();
    	}
    	return $template;
    }
    
    add_filter('template_include', 'set_publication_template');

    where ‘publications’ was the name of my custom post type.

    Hope that helps.

Viewing 5 replies - 31 through 35 (of 35 total)