Class: CustomPostType
- Inherits:
-
Generator
- Object
- WpScaffold::Base
- Generator
- CustomPostType
- Defined in:
- lib/wp_scaffold/models/generators/custom_post_type.rb
Constant Summary collapse
- DEFAULT_NAME =
"custom-post"
Constants inherited from WpScaffold::Base
WpScaffold::Base::TEMPLATE_BASE, WpScaffold::Base::USER_DIRECTORY
Instance Attribute Summary
Attributes inherited from Generator
#destination, #name, #relative_to_cwd, #template_path
Instance Method Summary collapse
Instance Method Details
#generate ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/wp_scaffold/models/generators/custom_post_type.rb', line 5 def generate super base_path = USER_DIRECTORY + self.destination # Rename the register CPT file File.rename(base_path + "/custom-post-types/custom.php", base_path + "/custom-post-types/" + self.name.to_dash + ".php") # Rename the CPT's template files File.rename(base_path + "/page-custom.php", base_path + "/page-" + self.name.to_dash + ".php") File.rename(base_path + "/single-custom.php", base_path + "/single-" + self.name.to_dash + ".php") end |