Solved

Outputting Just The Category Name Using  Exisiting Function

Posted on 2007-04-04
3
174 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
  • 2
3 Comments
 

Author Comment

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

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 10

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Uploading a CSV Data Import via PHP & MySql 3 36
AJAX, If No returns don't let the AJAX Call run again 2 21
Ajax and PHP 9 32
Wordpress Pricing 3 14
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

807 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