Solved

Outputting Just The Category Name Using  Exisiting Function

Posted on 2007-04-04
3
171 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WordPress - Published Webpage missing posts 4 46
Word Press Enigima 7 35
MySQL Grouping 2 19
array_values - reorder after unset? 5 9
In Part I (http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_8410-Getting-Started-In-WordPress-Part-I.html), I introduced you to the powerful WordPress backend, the WordPress administrative Dashboard.  In Part II, I will introduce yo…
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…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The viewer will learn how to dynamically set the form action using jQuery.

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now