Last active
July 3, 2019 11:19
-
-
Save imran-khan1/2671a506c5f4a254d4667bf32ad83533 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function wcik_add_page_template ($templates) { | |
| $templates['archive-manufacturer.php'] = 'Manufacturer'; | |
| return $templates; | |
| } | |
| add_filter ('theme_page_templates', 'wcik_add_page_template'); | |
| function wcik_archive_page_template ($template) { | |
| if (is_page_template('archive-manufacturer.php')){ | |
| $template = plugin_dir_path( __FILE__ ) . 'templates/manufacturer/archive-manufacturer.php'; | |
| } | |
| return $template; | |
| } | |
| add_filter ('page_template', 'wcik_archive_page_template'); | |
| function wcik_single_page_template($single_template) { | |
| global $post; | |
| if ($post->post_type == 'manufacturer') { | |
| $single_template = plugin_dir_path( __FILE__ ) . 'templates/manufacturer/single-manufacturer.php'; | |
| } | |
| return $single_template; | |
| } | |
| add_filter( 'single_template', 'wcik_single_page_template' ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment