Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter leanne63

    (@leanne63)

    To solve this, I did the following:

    • Changed my customize_register function so all of my custom settings’ ids were prefixed with their section’s id. (For example, I changed the ‘twitter_url’ setting id to ‘social_media_twitter_url’. I changed the Facebook setting id from ‘facebook_url’ to ‘social_media_facebook_url’, and so on.).
    • Wrote a function that accepts a section id (such as ‘social_media’), then searches the results of get_theme_mods(), and returns a new array with only the items that match the provided section id. (For example, get_section_mods( ‘social_media’ ) returns array([‘social_media_twitter_url]=>’http://twitter.com/…’ [social_media_facebook_url]=>’http://facebook.com/…’, and so on.)

    For my purposes, I also coded the function to check for a value for the found ids. If a setting doesn’t have a value, the function doesn’t include it in the returned array.

Viewing 1 replies (of 1 total)