{"action":"created","issue":{"url":"https://api.github.com/repos/gantry/gantry5/issues/987","labels_url":"https://api.github.com/repos/gantry/gantry5/issues/987/labels{/name}","comments_url":"https://api.github.com/repos/gantry/gantry5/issues/987/comments","events_url":"https://api.github.com/repos/gantry/gantry5/issues/987/events","html_url":"https://github.com/gantry/gantry5/issues/987","id":115837541,"number":987,"title":"How to programmatically populate select.select/select.selectize field with custom data?","user":{"login":"kmbt","id":2975117,"avatar_url":"https://avatars.githubusercontent.com/u/2975117?v=3","gravatar_id":"","url":"https://api.github.com/users/kmbt","html_url":"https://github.com/kmbt","followers_url":"https://api.github.com/users/kmbt/followers","following_url":"https://api.github.com/users/kmbt/following{/other_user}","gists_url":"https://api.github.com/users/kmbt/gists{/gist_id}","starred_url":"https://api.github.com/users/kmbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmbt/subscriptions","organizations_url":"https://api.github.com/users/kmbt/orgs","repos_url":"https://api.github.com/users/kmbt/repos","events_url":"https://api.github.com/users/kmbt/events{/privacy}","received_events_url":"https://api.github.com/users/kmbt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gantry/gantry5/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-09T09:25:19Z","updated_at":"2015-11-11T07:53:39Z","closed_at":null,"body":"Hi all,\r\n\r\nI am getting familiar with the Gantry 5 framework for Wordpress and so far I like it a lot - especially the fact that it makes use of the Timber plugin which I am already familiar with.\r\n\r\nFrom the Gantry 5 docs I have learned that it is possible to add a select.select or select.selectize field with options defined upfront, in the YAML file. What I would like to do is to populate the field options by a custom PHP function. Such function might for example fetch custom posts of some type by means of Timber::get_posts.\r\n\r\nAnother one would be pulling CSS class names from a stylesheet file by means of a regular expression. The possibilities are countless, therefore I think that being able to write a function to generate options would be a great feature.\r\n\r\nIs there any feasible way to populate select fields in such a way?"},"comment":{"url":"https://api.github.com/repos/gantry/gantry5/issues/comments/155696948","html_url":"https://github.com/gantry/gantry5/issues/987#issuecomment-155696948","issue_url":"https://api.github.com/repos/gantry/gantry5/issues/987","id":155696948,"user":{"login":"mahagr","id":854915,"avatar_url":"https://avatars.githubusercontent.com/u/854915?v=3","gravatar_id":"","url":"https://api.github.com/users/mahagr","html_url":"https://github.com/mahagr","followers_url":"https://api.github.com/users/mahagr/followers","following_url":"https://api.github.com/users/mahagr/following{/other_user}","gists_url":"https://api.github.com/users/mahagr/gists{/gist_id}","starred_url":"https://api.github.com/users/mahagr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mahagr/subscriptions","organizations_url":"https://api.github.com/users/mahagr/orgs","repos_url":"https://api.github.com/users/mahagr/repos","events_url":"https://api.github.com/users/mahagr/events{/privacy}","received_events_url":"https://api.github.com/users/mahagr/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T07:53:39Z","updated_at":"2015-11-11T07:53:39Z","body":"Sorry for my delayed answer -- been having a bad flu.\r\n\r\nWhat comes to WP, it already processes most of its data inside template (functions.php and index.php etc), usually just before rendering head. That is no different with particles, which get all processed before head gets called. Well, they actually get rendered, too, as because of the nature of particles, you cannot know what is inside them until you render the content. Again that is not so much against WP ways of thinking as it doesn't have MVC. Also widgets in WP get only rendered from the template level, so actually particles get rendered before (other) widgets do.\r\n\r\nTo me pulling post from a particle is like pulling it from a widget as long as you do not have any real code inside your template file."}}