WordPress.org

Ready to get started?Download WordPress

Forums

Edge Suite
[resolved] Call ID for template based inclusion? (3 posts)

  1. Ben Hutchings
    Member
    Posted 1 year ago #

    Firstly, this plugin is great work! It's saved me a ton of hacking.

    I've included an animation using the template inclusion method and would like to know if I can call a specific ID using that method the same way can with shortcodes?
    If not, something like: echo edge_suite_view([ID]); would be nice and easy to use if you could add that functionality.

    Cheers!
    Ben

    http://wordpress.org/extend/plugins/edge-suite/

  2. ti2m
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Ben,
    thanks for the feedback. I'm not a big fan of including JS files inline within the body tag. At the moment this happen with shortcode proessing, but I'm thinking about changing that. With a direct call - like you are asking for - there would be no way around that, as there is no way to tell wp_head() to place the according JS files within the head tag. I dislike that as much as I dislike iframes, BUT of course it might make sense in some scenarios:

    Basically all you need is edge_suite_comp_render(id), which will return an array with keys 'stage' and 'scripts' (an array as well). You can put that together in a function:

    function edge_suite_view_inline($definition_id, $css_style = ''){
    
      $definition_res = edge_suite_comp_render($definition_id, $css_style);
    
      $stage = $scripts = '';
    
      if($definition_res != NULL){
        $scripts = implode("\n", $definition_res['scripts']);
        $stage = $definition_res['stage'];
      }
    
      return "\n" . $scripts . "\n" . $stage ."\n";
    }

    I'll wait until I have figured out what to do with shortcodes before I'll add the function to the plugin, otherwise I might have to change the function call later on. This could break stuff for people like you.

    Hope that helps

  3. ti2m
    Member
    Plugin Author

    Posted 1 year ago #

    Marking this as solved, let me know if you need any more assistance. I added the feature request to the roadmap on trello.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags