The number of syllables depends on the pronunciation. It has nothing to do with spelling.
According to the OED:
A syllable is a vocal sound or set of sounds uttered with a single effort of articulation and forming a word or an element of a word; each of the elements of spoken language comprising a sound of greater sonority (vowel or vowel-equivalent/vowel-like) with or without one or more sounds of less sonority (consonants or consonant-equivalents/less sonorous).
A simplified version of the OED definition is: a set of (one or more) sounds including at least one vowel-like sound and possibly with other consonant-like sounds surrounding it.
Technically the number of syllables is determined by the peaks of sonority.
The only common exception is a cluster of /s/ followed by a stop (i.e. /st/, /sk/, /sp/ etc).
Now Sonority hierarchy and Sonority sequencing principle (SSP) come into play.
The typical sequence of SSP is:
Vowel > Glide > Liquid > Nasal > Obstruent.
Vowels are the most sonorous and obstruents are the least sonorous sounds.
Now if you pronounce child [t͡ʃaɪ̯ld̚], then there is only one peak of sonority here, hence one syllable.
If you pronounce child [t͡ʃaɪ̯əld̚] or something like that, then there can be two peaks of sonority which means two syllables.
I can't draw the Sonority graphs for the pronunciations I mentioned above but I will upload two graphs I've made earlier.
- Metal -> [me.tl̩]
- Melt -> [melt]
Both 'metal' and 'melt' have the same sounds but in different order. How many syllable do you think each has? Let's draw a sonority graph to see:

There are two peaks (indigo colour) of sonority (one peak by the vowel [e] and another by syllabic l [l̩]) in the word metal, so it has two syllables.

There's only one peak of Sonority in 'melt', so one syllable.