Solved

Outputting Just The Category Name Using  Exisiting Function

Posted on 2007-04-04
3
175 Views
Last Modified: 2013-12-12
I'm new to PHP (from ColdFusion) and am looking to output JUST the Category within a modified template design.  Is there a function I can use to do that?  the_category() returns the category name with the built in link to the catgeory.  I just need the category name outputted.

If there is no function, can someone help me write one?

500 points to the person who can help me learn a little about PHP and WordPress.

Thanks.

Phil
0
Comment
Question by:SiriusPhil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:SiriusPhil
ID: 18852651
By The Way... I'm running WordPress 2.1.
0
 
LVL 11

Accepted Solution

by:
Chris Gralike earned 500 total points
ID: 18853473
Can you give us an example of the function you are trying to alter?

I dont know much about wordpress so i downloaded it and located the file wich contains the functions. The question now is, wich one do you use in the template?

function get_category_children($id, $before = '/', $after = '') {
}

function get_category_link($category_id) {
}

function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
}

function get_the_category($id = false) {
}

function get_the_category_by_ID($cat_ID) {
}

function get_the_category_list($separator = '', $parents='') {
}

function in_category($category) { // Check if the current post is in the given category
}

function the_category($separator = '', $parents='') {
}

function category_description($category = 0) {
}

function wp_dropdown_categories($args = '') {
}

function wp_list_categories($args = '') {
}

Next it could be nice for the developers here to see the complete code of the function in question. You can find the file in,
wordpress\wp-includes\catagory-template.php

(Be mindfull most include classes that add functionality to the functions displayed in that file)

-regards,
0
 
LVL 11

Expert Comment

by:Chris Gralike
ID: 18853483
ps the get_the_catagory(); function is the following

function get_the_category($id = false) {
global $post, $category_cache, $blog_id;

      $id = (int) $id;
      if ( !$id )
            $id = (int) $post->ID;

      if ( !isset($category_cache[$blog_id][$id]) )
            update_post_category_cache($id);

      $categories = $category_cache[$blog_id][$id];

      if ( !empty($categories) )
            sort($categories);
      else
            $categories = array();

      return $categories;
}

-Regards,
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question