Solved

Outputting Just The Category Name Using  Exisiting Function

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

623 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