The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Using XML to generate markup for WP themes

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #33637

    Pretty much every design, requires a different mark-up. If there’s a “golden markup” which can fit with every imaginable design, I don’t know about.
    So, I had my own WP framework using for a couple of years now, and this markup problem was a big problem for me. With every child theme I had to make a copy of header.php and footer.php to include the desired markup. I’ve been struggling to find an elegent solution for this, and I thought of arrays.
    I built this function which could take an array that described the markup, and build the markup based on that. There were several advantages than hard-coding the div’s in header and footer php files, for one it produced several action hooks for every element (which comes really handy), and the array could be altered based on whatever condition. (for example, on home page, unset a member of the array, which prevented it from being rendered).
    Now, to make it easier, I want to have an XML file to do that. Because it’s way more readable!

    This is an example of such file.
    The idea is that we give our parser this file and the parser can render everything.

    What’s your opinion about this? Is it any good? Have anyone done this before?

Viewing 1 post (of 1 total)
  • The forum ‘Other’ is closed to new topics and replies.