0

I'm running around with an idea in my head that I would like to make but I don't really know how or where to start.

In a custom theme I had to make serveral templates for one of my clients. I noticed that I had around 20 possible templates for my client (because he wanted to have "multiple" options)

You can imagine that the dropdown list for the templates was immense. So I was wondering how I can replace the default dropdown with a new screen or a pop-up to create a visual reference to the possible templates.

It would be even cooler if there are thumbnails of templates generated based on how the template looks. (like Google used to do a while ago) But this is part two. First I would like to know how to even replace the dropdown.

Any thoughts/ideas?

I found this but.... well I don't know.

1

You could develop your own metabox for the page (with custom styling, probably) that allows selection of the template. I don't know that generating screenshots is feasible, but you could definitely have it pull from some sort of associated file (eg: template name is template-name.php, screenshot is template-name.png).

With the replacement selection method generated, you can then just use remove_meta_box() to remove the default input box (see: Get List of Registered Meta Boxes and Removing Them) and you should be set!

  • That's a great idea. Thnx. I didn't know a remove_meta_box() existed. Now I can custom save the template_name to the database and call it upon pageload or something. Thnx – Interactive Jan 29 '15 at 14:48
  • If this solved the problem, please mark it as the solution so that it doesn't show up in unanswered questions. – mor7ifer Jan 29 '15 at 14:52
  • This didn't solve my problem this is merely a solution to a problem. I would like to leave the question open for a little longer to see if there is anyone else who has a different idea. If I do work with your solution I will mark this answer as solved! – Interactive Jan 29 '15 at 14:59
  • Indeed I created a metabox that holds the templates and was able to update the _wp_page_template with another template. Used remove_meta_box() to hide the attributes. Thnx @m0r7if3r – Interactive Feb 2 '15 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.