flyingrabbit
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Get category-related data if I know the category IDThis does it:
$cat = get_the_category();
$catp = $cat[0]->category_parent;
$catID = $cat[0]->cat_ID;
$catname = $cat[0]->cat_name;
$catparname = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_id=".$catp);
$catparnicename = $wpdb->get_var("SELECT category_nicename FROM $wpdb->categories WHERE cat_id=".$catp);So that $catparname returns the parent category name and $catparnicename returns the parent category nicename. These values can be inserted after SELECT to return the various data: http://codex.wordpress.org/Database_Description#Table:_wp_categories
Forum: Themes and Templates
In reply to: Get category-related data if I know the category IDFor some reason this resturns not the category’s parent, but itself.
$cat = get_the_category();
$catp = $cat[0]->category_parent;
echo $catp; // returns "2" - the correct ID of the category's parent
echo $cat[0]->cat_name; //returns "River"
$catpar = get_the_category($catp);
echo $catpar[0]->cat_name; // returns "River" instead of "Current"Forum: Themes and Templates
In reply to: Get category-related data if I know the category IDHmmm. I don’t think I’m being clear – I need to be able to do this dynamically, not hard-coded. That is, let’s say I know the ID number of a category’s parent having used get_the_category. The ID is resturned as an integer. I need to be able to take that integer and use it to get the category’ parent as an object so I can get its nicename, etc.
Forum: Themes and Templates
In reply to: A page to list every monthly archiveThanks. That’s just what I needed.
Forum: Fixing WordPress
In reply to: 2-15-05 release of 1.5Heh. Go visit the “Download” page of this site.
Forum: Themes and Templates
In reply to: Get category and date archives to display all posts?Maybe this is difficult?
Forum: Themes and Templates
In reply to: adding special fonts into wordpresssIFR works quite well, though you only want to use it for headers – too many Flash objects running at once will bog down a user’s processor – Shaun Inman’s site, for example, freezes Firefox Mac.
Here, by the way, you can see how I’m using it: http://www.johnpauldavis.org
Forum: Plugins
In reply to: should be simple: get rid of <p> tags in post bodyWhere might one find the place where WP is inserting the tags to begin with, so I can just take it out. remove_filter/apply_filter is not working.
Forum: Plugins
In reply to: New Pluign: Faked FoldersReading the documentation – I’m not sure I understand this plugin. Will it solve the problem I describe here?
Forum: Fixing WordPress
In reply to: Does the MT import functionality support multipleAh. So the import script is pulling in MT export files, not pulling from the database itself?
Forum: Fixing WordPress
In reply to: Hacking Category Permalinks…There is a category_parent object and a get_category_parents method, but I’m not sure how they’re used. But you should be able to test to see if a given category has a parent using one or both.
Forum: Fixing WordPress
In reply to: Hacking Category Permalinks…“Alright, I set up my Categories to be in different directories, with different indexes.”
How did you do this? I’ve been trying to find a tutorial or instrructions that explain how to pull this off and have had no luck.
Does the code distinguish between categories and subcategories? You could change your hack to a conditional statment – i.e. if this is a subcategory, set $categoryparent to the nincename of the category’s parent, and then do this: $link = ‘http://www.site.com/wpblog/’ . $categoryparent . $category_nicename . ‘/’;, otherwise have it do your original hack.
If you can’t dymanically figure out whether or not a given caetegory is a subcategory, just hard-code categories who are subcategories into an array:
$subcats = array(0 => ‘category-x’, 1 => ‘category-x’, 2 => ‘category-x’, 3 => ‘category-x’);
where ‘category-x’ is whatever-the-category-name-is
then do a conditional to test and see if the category is one of those:
if (in_array(category_nicename, $subcats)){
$link = ‘http://www.site.com/wpblog/’ . $categoryparent . $category_nicename . ‘/’;
else:
$link = ‘http://www.site.com/wpblog/’ . $category_nicename . ‘/’;
endif;
}
of course, you might do best to have multiple arrays, one for each parent category, continaing its subcategories, but then you’d have to test each array seperately. But this would give you the parent category name to drop into $categoryparent.
HTH.