1

My theme came with a custom taxonomy post type.

I want to rename the original and duplicate it with another different name.

I tried finding everything relative in functions.php and copy it over to the child theme assuming it would override the parent theme.

Upon refreshing the site it went blank.

Any ideas?

Should I copy the whole functions.php and use that in my child theme. Or is it possible to override?

or maybe it broke the template (even though I was not on a relative page) trying to call that which I changed?

Thank you in advance. I know it's probably really simple I just don't know enough about WP yet.

UPDATE-------------

The real issue why I am doing this. I got this template and it has a Practice Areas post/taxonomy type. But only one! I need for SEO purposes two. One for each city. So I'd like to at rename the original to one city and duplicate the whole thing for the other one.

here is relevant code I picked up from functions.php

http://www.codeshare.io/g2HBx

I added the Dallas/dallas everywhere in the code.

6
  • Hi @webdev. I think this is a duplicate of either wordpress.stackexchange.com/questions/161788/… or wordpress.stackexchange.com/questions/65075/… depending on what you mean by "custom taxonomy post type." Which one answers your question?
    – mrwweb
    Apr 2, 2015 at 22:46
  • I don't think either specifically addressed my question. Maybe it is because template has a custom meta array etc... Must I copy over the whole function? Or just the part I need?
    – Web Dev
    Apr 2, 2015 at 23:14
  • 1
    I'm not sure I understand your question then. Are you trying to override the taxonomy itself (e.g. it's settings or name) or are you trying to override the taxonomy's template? Those are completely different things. Please see if you can clarify your question and include the code that you've used and isn't working.
    – mrwweb
    Apr 2, 2015 at 23:18
  • I think it's an intertwined topic. I'm about to update now.
    – Web Dev
    Apr 2, 2015 at 23:52
  • 1
    Your edit implies that you actually need what you already have, but with an additional custom taxonomy called 'city'
    – Tom J Nowell
    Apr 3, 2015 at 1:31

1 Answer 1

1

So you have 3 problems

Problem 1, custom taxonomy post type

Your first problem is a misunderstanding of what taxonomies and post types are. There is no such thing as a custom taxonomy post type. Taxonomies and post types are 2 different things.

Post types are posts/pieces of content of a certain type. E.g. post, page, attachment, etc

Taxonomies are ways to group/classify posts of a certain type, e.g. colour, size, location

Problem 2, Overriding and Child Themes

Child themes don't work the way you think they do, and neither does functions.php. While yes, child theme templates are loaded instead of parent theme templates if they exist, but that's a templating thing, and only a templating thing.

functions.php is a place you can put code, and make use of the WordPress API. Plugins are also a place you can put code and make use of the WordPress API. The two are functionally identical, they're just loaded at slightly different times.

So a themes functions.php isn't special, it isn't a template, and it isn't overriden by a child theme

The codex says clearly:

Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

So when you try to call register_post_type, you're not overriding the parent theme, the parent theme hasn't been loaded! If the parent theme does something in its functions.php, you need to attach a function to a hook that happens later on, which then undoes what the parent theme did. WordPress doesn't keep track of what did and didn't happen in the parent theme so that you can magically unwind it, that would be unrealistic, especially when you consider actions events and hooks that might have been added.

Problem 3, Data

You have a post type, and you have a dallas_practice_area_letter taxonomy. You need to categorise all of these by city ( I assume all the Dallas practices are in Dallas? ) and your solution is to create a whole new post type and taxonomy under a new name for each city.

This won't scale, instead, register a new taxonomy called dallas_practice_area_city, and use that to mark each practice as being in a particular city. This way you don't need a new post type every time a new city or region is added, you avoid a huge amount of pain dealing with queries, and you sidestep entirely the problem of practices being entered in the wrong city post type and having to be moved.

5
  • Here is a link to the page template. I'm not sure how I would filter to show only the taxonomy....? codeshare.io/2EYtz
    – Web Dev
    Apr 3, 2015 at 6:08
  • I appreciate your explanation. In fact the original minus all the Dallas stuff. So I'd have to create one for Dallas and one for the other city.
    – Web Dev
    Apr 3, 2015 at 6:10
  • 1
    Taxonomies have their own archives and theme templates, use those
    – Tom J Nowell
    Apr 3, 2015 at 10:39
  • Eg taxonomy-dallas_practice_area_city.php
    – Tom J Nowell
    Apr 3, 2015 at 10:41
  • You'll also have a post type archive and template for your post type too, there's no need for your page template
    – Tom J Nowell
    Apr 3, 2015 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.