• First let me say: This is my first child theme, so if someone knows a better way to achieve this, I’m all ears 🙂

    I have a site that requires all meta data to be removed from almost all categories, say approximately 45 out of 50 categories.

    I have created a child theme to remove meta data from posts, and would like to now add in code to the style.css that will allow that meta data to show only for certain categories. (Or would I need to create a php file for those categories in my child theme?)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Halo Diehard

    (@halo-diehard)

    I found this and could try to use it, but I’m not sure exactly how I tweak it to show meta for those categories, or how to plug my category id’s into it:

    $post_categories = wp_get_post_categories( $post_id );
    $cats = array();
    
    foreach($post_categories as $c){
    	$cat = get_category( $c );
    	$cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug );
    }

    The language on the page is also beyond my scope atm: http://codex.wordpress.org/Function_Reference/wp_get_post_categories

    Please let me know if I’m posting this in the wrong place or if I need to supply more information. The child theme is for Twenty Eleven.

    Good Guy

    (@mytaxsitecouk)

    Perhaps you could post a link to your site and explain exactly what do you want to do.

    Good luck.

    Thread Starter Halo Diehard

    (@halo-diehard)

    I have a site that requires all meta data to be removed from almost all categories, say approximately 45 out of 50 categories.

    As I stated, currently it is using a child theme that removes *all* meta data. I want the other five categories to show the meta data. (category, author, date)

    I prefer not to link to my site.

    Thread Starter Halo Diehard

    (@halo-diehard)

    Why does it say wang7889 started this post?

    So, after hours of studying, I may be closer (I could really use some help…)

    It looks like I might want to put something like this in a php file (functions?), but I don’t know if I have it right and I’m not sure which file.

    Again, I’m trying to only have meta-data (ie: author, date, category) show up in certain categories and not in others. This would be to only show meta-data in those categories whose id’s are shown:

    function exclude_category_meta () {
    if ! in_category( array( 56,57,58,59,60,61,62,63,64,65) ) delete_post_meta }
    <?php exclude_category_meta() ?>

    Am I getting close?

    Halo,

    I’m trying to do the same- did you get this to work?

    Thread Starter Halo Diehard

    (@halo-diehard)

    Nope, didn’t get anyone to help me and I’ve been studying it as new tweaks come up, but I still haven’t figured out how to mess with functions.php and my child theme. Still have it set to remove all meta.

    I’m having a similar problem, I only want to remove metatdata on specific categories. I am not sure if this will work for me: http://wordpress.stackexchange.com/questions/50961/removing-post-meta-from-category-pages

    Please post your own topic.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Child theme – how to remove meta from some categories’ is closed to new replies.