Title: Call category name
Last modified: August 21, 2016

---

# Call category name

 *  Resolved [codechip87](https://wordpress.org/support/users/codechip87/)
 * (@codechip87)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/call-category-name/)
 * Hello,
 * I changed the small things so it is now possible to add that to call himself 
   the name of the category.
 * Just what you need to do.
 * 1) Open up the faq.php script
 * Found **extract(shortcode_atts(array(** and below after **“limit” => ”** or replay
   to
 *     ```
       "catid" => '', // Shortcode to for category ID
       "catname" => '', // Shortcode to for category name
       ```
   
 * 2) Found **// Define limit** and below or re play to **// Define category style**
   and change code.
 *     ```
       // Define limit
       if( $limit ) {
        $posts_per_page = $limit;
       } else {
        $posts_per_page = '-1';
       }
       ```
   
 * to
 *     ```
       // Define category style
        if( $catid) { // call category ID
       $category_id = $catid;
       }		
   
       elseif ( $catname) { // call category name
         $category_name = $catname;
       }
   
       else {
        $category_id = '-1';
       }
       ```
   
 * 3) Finally, found **$query = new WP_Query( array ( ** and below after **‘posts_per_page’
   => $posts_per_page,** or replay to
 *     ```
       $query = new WP_Query( array (
       'post_type' => $post_type,
       'posts_per_page' => $posts_per_page,
       'cat' => $category_id,   // Shortcode  category ID
       'category_name' => $category_name,	// Shortcode for category Name
       'orderby' => $orderby,
       'order' => $order,
       'no_found_rows'  => 1
       )
       );
       ```
   
 * Now you can call you category name or category ID in next shortcode
 * **[sp_faq catname=”categoryname”]** or **[sp_faq catid=”4″]**
 * [https://wordpress.org/plugins/sp-faq/](https://wordpress.org/plugins/sp-faq/)

The topic ‘Call category name’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/sp-faq_b7d2d9.svg)
 * [WP responsive FAQ with category plugin](https://wordpress.org/plugins/sp-faq/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sp-faq/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sp-faq/)
 * [Active Topics](https://wordpress.org/support/plugin/sp-faq/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sp-faq/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sp-faq/reviews/)

## Tags

 * [category id](https://wordpress.org/support/topic-tag/category-id/)
 * [category name](https://wordpress.org/support/topic-tag/category-name/)

 * 0 replies
 * 1 participant
 * Last reply from: [codechip87](https://wordpress.org/support/users/codechip87/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/call-category-name/)
 * Status: resolved