Changeset 1272199
- Timestamp:
- 10/24/2015 11:41:13 AM (10 years ago)
- Location:
- enhanced-category-pages/trunk
- Files:
-
- 2 added
- 2 edited
-
classes/ecp/WP_Integration.php (modified) (1 diff)
-
readme.txt (modified) (5 diffs)
-
views (added)
-
views/ecp_category_description.php (added)
Legend:
- Unmodified
- Added
- Removed
-
enhanced-category-pages/trunk/classes/ecp/WP_Integration.php
r1101510 r1272199 78 78 //customize admin area 79 79 add_action("admin_init", array(&$this, 'admin_init'), 10000); 80 81 add_filter( 'category_description', array(&$this, 'category_description_filter') ); 82 add_filter( 'get_the_archive_description', array(&$this, 'category_description_filter') ); 83 } 84 85 public function category_description_filter($description, $categoryId) { 86 87 ob_start(); 88 89 include pathinfo($this->_plugin_file_path, PATHINFO_DIRNAME)."/views/ecp_category_description.php"; 90 91 $description = ob_get_clean(); 92 93 return $description; 80 94 } 81 95 -
enhanced-category-pages/trunk/readme.txt
r1179826 r1272199 5 5 Requires at least: 3.0.1 6 6 Tested up to: 4.2.2 7 Stable tag: 1.0.27 Stable tag: 2.0.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 **NEW** Version 2.0.0 brings great new feature: with some magic, if your theme displays category/term description, then it would be **automatically** enhanced. 16 Are you ready for more? You can customize the template by creating a `content-ecp.php` file in your theme of choice. 17 18 15 19 Enhanced Category Pages allows you to create custom category and term pages by managing them using a special custom post type. 16 20 17 21 **Features** 18 22 19 * **NEW** Traverse categories using setup_ec_data that allows now category id as parameter 23 * **NEW** Easy to use for everyone: users, designers, developers 24 * **NEW** automatically show enhanced category/term content 25 * **NEW** customize enhanced category/term content by creating a `content-ecp.php` file in your theme of choice 26 * Traverse categories using setup_ec_data that allows now category id as parameter 20 27 * Enhance any taxonomy: edit **any taxonomy** term as a custom post 21 * edit category as a custom post - *Enhanced Category*22 * automatically generates *Enhanced Category* post type for each category23 * transparent synchronization of *Enhanced Category* and it's corresponding category24 * add any features available to WordPress custom posts25 * easy *Enhanced Category* display on category template using `<?php $GLOBALS['enhanced_category']->setup_ec_data(); ?>` (see install section)26 * internationalization ready28 * Edit category as a custom post - *Enhanced Category* 29 * Automatically generates *Enhanced Category* post type for each category 30 * Transparent synchronization of *Enhanced Category* and it's corresponding category 31 * Add any features available to WordPress custom posts 32 * Easy *Enhanced Category* display on category template using `<?php $GLOBALS['enhanced_category']->setup_ec_data(); ?>` (see install section) 33 * Internationalization ready 27 34 28 35 **Future Features** … … 37 44 3. Activate the plugin through the "Plugins" menu in WordPress. 38 45 4. Use "Enhanced Edit" link to edit the page of the respective category 46 5. Category/term description display is automatically enhanced with your content. 47 6. Optional: create `content-ecp.php` in your theme folder to customize the display. 39 48 40 ** Usage options**49 **Advanced usage options** 41 50 42 1. Display category/term page. Edit **category/taxonomy template** to show the content of the "Enhanced Category": 43 44 45 46 //in category.php or taxonomy.php 47 <?php 48 global $enhanced_category; 49 //get enhanced category post and set it up as global current post 50 $enhanced_category->setup_ec_data(); 51 ?> 52 <!-- enhanced category content --> 53 <?php the_post_thumbnail("medium"); ?> 54 55 <?php get_template_part( 'content', 'page' ); ?> 56 57 <!-- custom fields --> 58 <?php 59 get_post_custom(); 60 ?> 61 62 <?php 63 // If comments are open or we have at least one comment, load up the comment template 64 if ( comments_open() || get_comments_number() ) : 65 comments_template(); 66 endif; 67 ?> 68 51 1. Create `content-ecp.php` in your theme folder to customize the display of the enhanced content. The custom post associated with category/term is set up, so all display functions for posts are usable. 52 53 1. Display category/term page. Edit **category/taxonomy template** to show the content of the "Enhanced Category" (feel free to adjust to your needs): 54 55 56 //in category.php or taxonomy.php or any other place your theme displays the category/term content 57 <?php 58 global $enhanced_category; 59 //get enhanced category post and set it up as global current post 60 $enhanced_category->setup_ec_data(); 61 ?> 62 <!-- enhanced category content --> 63 <?php the_post_thumbnail("medium"); ?> 64 65 <?php get_template_part( 'content', 'page' ); ?> 66 67 <!-- custom fields --> 68 <?php 69 get_post_custom(); 70 ?> 71 72 <?php 73 // If comments are open or we have at least one comment, load up the comment template 74 if ( comments_open() || get_comments_number() ) : 75 comments_template(); 76 endif; 77 ?> 78 69 79 1. Display a list of categories: 70 80 71 72 //$categories is presumed to be an already fetched array of categories/terms73 foreach($categories as $category) {74 $GLOBALS['enhanced_category']->setup_ec_data($category->term_id);75 the_post_thumbnail('thumbnail');76 }77 81 82 //$categories is presumed to be an already fetched array of categories/terms 83 foreach($categories as $category) { 84 $GLOBALS['enhanced_category']->setup_ec_data($category->term_id); 85 the_post_thumbnail('thumbnail'); 86 } 87 78 88 79 89 == Frequently Asked Questions == 80 90 91 = How does magic happen? = 92 93 *We use the `category_description` or `get_the_archive_description` filters in order to replace the plain content with the enhanced one. 94 95 = How can I customize the output? = 96 97 * `content-ecp.php` and `content-page.php` partial templates are looked for (in that order) and the first found is loaded. 98 81 99 = What custom post type is created? = 82 100 83 *Enhanced Category* (safe name: enhancedcategory) custom post type is created and a post is generated automatically for each category .101 *Enhanced Category* (safe name: enhancedcategory) custom post type is created and a post is generated automatically for each category/term. 84 102 85 103 = What happens if I edit the category fields? = … … 127 145 * setup_ec_data allows now category id as parameter 128 146 147 = 2.0.0 = 148 * automatically show the enhanced content using `category_description` or `get_the_archive_description` filters 149 * customize the display of content with `content-ecp.php` theme partial template 150 129 151 130 152 == Upgrade Notice == … … 141 163 = 1.0.2 = 142 164 * traverse categories using setup_ec_data that allows now category id as parameter 165 166 = 2.0.0 = 167 * This version adds magic: automatically show the enhanced content using `category_description` or `get_the_archive_description` filters. 168
Note: See TracChangeset
for help on using the changeset viewer.