Combining old and new ‘tags

Question

I have wordpress site that uses tags to represent the amount of workouts a client has been to. That number has become a competitive spark for my clients and they compete with each other. I am in the middle of migrating to a completely new wordpress site that has a ton more functionality and checks in place that will help with the administration piece. The new site does not use the tags but uses a custom taxonomy called "Pax."

I have been trying to code something that will take the old site tags count and add the to the new site’s ‘Pax’ counts. Then I want to display them on the frontend in the form of a tag cloud with counts.

here is what I have tried so far:

    function my_old_tags() {

global $wpdb;
$old_tags = 
    // getting the count of the old tags
    $terms = get_terms('post_tag',array('hide_empty'=>false));
    foreach($terms as $t) {
        return $t->count;
    } 
    // getting the count of the new "pax"
    $newTerms = get_terms('pax',array('hide_empty'=>false));
    foreach($terms as $u) {
        return $t->count;
    }
    
    // adding them together
    foreach($terms as $y) {
    $x = sum ($terms+$newTerms) ;
    }
    // echo to the screen
    echo $x;
}

I do not know much about php but I’m hopeful that with some guidance we can figure this out.

0
F3 Lehigh Valley 1 month 0 Answers 9 views 0

Leave an answer