Title: setup_ec_data and wordpress functions
Last modified: August 31, 2016

---

# setup_ec_data and wordpress functions

 *  Resolved [DaveWP196](https://wordpress.org/support/users/davewp196/)
 * (@davewp196)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/setup_ec_data-and-wordpress-functions/)
 * It is not clear from the documentation what the full effect of the setup_ec_data
   routine on which of the standard wordpress functions are available.
    For example,
   after calling setup_ec_data, what should be the effect of calling the_title()
   function.
 * What I am after is a working example of
    - calling setup_ec_data and outputting a category
    - outputing a category title
    - the category description
    - the first 2 posts associated with the category
 * I’ve looked at the code of setup_ec_data routine and not clear which of the standard
   functions will work as some depend on WP_Query which is not changed using setup
   postdata(). In particular is_category() function does not work as it relates 
   to original page.
 * [https://wordpress.org/plugins/enhanced-category-pages/](https://wordpress.org/plugins/enhanced-category-pages/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [cip](https://wordpress.org/support/users/cip/)
 * (@cip)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/setup_ec_data-and-wordpress-functions/#post-6917288)
 * Hi!
 * Thank you for finding the plugin useful.
 * To answer your questions now, we are setting the current post, so all functions/
   template tags that are available in “**[the loop](https://codex.wordpress.org/The_Loop)**“.
   Here is the reference of WordPress Post tags: [https://codex.wordpress.org/Template_Tags#Post_tags](https://codex.wordpress.org/Template_Tags#Post_tags)
 * So, once you call `setup_ec_data` the current post is set to the custom post 
   type associated with the category/term. Then you can call template tags/functions
   such as:
    - the_ID()
    - post_class()
    - the_post_thumbnail
    - the_content()
    - the_title()
    - the_meta()
    - the_date()
    - comments_template()
    - etc.
 * To get the first two posts from current category:
 *     ```
       $enhanced_category->setup_ec_data(); //optionally you can send a category ID
       $filter = array( 'category' => get_the_ID(), 'posts_per_page' => 2 );
       $posts = get_posts($filter);
       ```
   
 * Also you can use `views/ecp_category_description.php` as a source of inspiration.
 * I hope this answers your questions and would appreciate showing your gratitude
   by rating our plugin.
 * Cheers!

Viewing 1 replies (of 1 total)

The topic ‘setup_ec_data and wordpress functions’ is closed to new replies.

 * ![](https://ps.w.org/enhanced-category-pages/assets/icon-256x256.png?rev=1101510)
 * [Enhanced Category Pages](https://wordpress.org/plugins/enhanced-category-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/enhanced-category-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/enhanced-category-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/enhanced-category-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/enhanced-category-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/enhanced-category-pages/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [cip](https://wordpress.org/support/users/cip/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/setup_ec_data-and-wordpress-functions/#post-6917288)
 * Status: resolved