WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help: Need function code for making a string to use in title and taxonomy (1 post)

  1. iyamdman
    Member
    Posted 2 years ago #

    I have a WordPress based website.

    In the structure of the site, I have created 2 custom post types:

    1) Cars
    2) Wheels

    For Cars I have 4 taxonomies: Color, Year, Model, Wheel Type

    For Wheels, I have 5 taxonomies: Size, Brand, Rim form, rim color, weight

    Requirement:

    In the Wheels admin area, I want a some function code that would:

    1) Create a string made up of the first character of every word for each checked taxonomy terms for a Wheel.

    2) I want to add that string as a taxonomy term for Wheel Type used in Cars.

    3) I want to replace the Wheels post title, with that string.

    4) Then I need to attach to the new Wheel Type taxonomy, metadata that would be the full checked taxonomy terms.

    Example:

    Adding a new Wheel, I would insert the image and text into the description.

    Then I would check the following terms in the Taxonomy boxes:

    Size: "5"
    Brand: "Good Year"
    Rim form: "Spoke"
    Rim Color: "Silver"
    Weight: "7"

    In the function area of the admin panel will be an empty character box with 2 buttons: create and replace.

    I would click the create button, and the empty character box would display "5GYSS7"

    Then I would make any edits to the string in the character box, and click the replace button:

    1) The Wheels post title would be changed to "5GYSS7" (or whatever is in the character box, if I had edited it)

    2) The taxonomy "Wheel Type" would now have the term "5GYSS7" added to it

    3) The taxonomy Wheel Type "5GYSS7" would have the metadata string of "5 Good Year Spoke Silver 7" added to it

    Can anyone provide the code I would need to insert into the function.php file to do this?

Topic Closed

This topic has been closed to new replies.

About this Topic