Tag Info

Hot answers tagged

3

I think it's not exactly possible the way you want to achieve. It's really annoying to not getting a filter there to alter template files names :( I have a workaround on it though. Let use content.php for the comparison. // content.php file $format = get_post_format(); if( '' != $format ){ get_template_part( 'content-'. $format ); } else{ ...


3

There is no hook to do this. Copy the index.php to the child theme and make the single line change. Also, tell the parent theme's author that they should make the same change in their theme, for flexibility.


2

Use below code for getting post format, simple made condition if post format ="standard" then load your preferred template $format = get_post_format(); if($format ="video") { get_template_part( 'format', $format ); } Something like this.


1

If you are referring to the categories from the post type post (the blog) then this would do the trick: For a drop-down: wp_dropdown_categories() For a list: wp_list_categories() child_of Only display categories that are children of the category identified by this parameter. There is no default for this parameter. <?php // Put the parent ...


1

As Pages are a special built in Posttype, they get an own template hierarchy. Other "normal" post types and custom post types can only be templated by "single-$posttype.php". You can however hook into the single_template filter and make wordpress redirect to your template file: function get_custom_post_type_template($single_template) { global $post; ...


1

Define your template name in the custom template file. <?php /* Template Name: demo */ ?> After this the select template option will be available on the edit screen. You can choose the desired name you want.



Only top voted, non community-wiki answers of a minimum length are eligible