• chroma123

    (@chroma123)


    Hi! I have developed my own template, and now I’m trying to write a multi-step form plugin, which I will insert in a specific spot on the front page. I have spent some time reading the plugin development docs now, but I’m not really getting what would be the best approach for a plugin like that.

    For example, if I wanted this (link) in a plugin, and then to show it in a specific spot on the frontpage.
    https://www.w3schools.com/howto/howto_js_form_steps.asp

    I have an activated working plugin that I can get to output text through a custom shortcode. But I am not sure if shortcode is the right way to do it, because it seems like I have to return everything in a variable, which seems to eliminate code tidyness and also the small fact that I need to use both ” and ‘ in my value there.

    I tried fetching the code from a separate file and then returning it to the shortcode, but that throws an error. So now I’m lost.

    Can somebody guide me into the right direction?

    • This topic was modified 4 years ago by chroma123.
    • This topic was modified 4 years ago by chroma123.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    If you don’t know what theme is being used and you want users to be able to manage where plugin output occurs, shortcodes have been the go-to option for years. Lately, there is more emphasis on creating custom editor blocks, but many find developing shortcodes more accessible.

    Some sort of optimizer will often eliminate any tidiness in your HTML output anyway. You can include newline and tab chars in output so the HTML is nicely formatted before an optimizer messes everything up. You can escape quote chars so they are retained in the string while not causing syntax errors. For example:
    $output .= "\t<a href=\"$html\">Link</a>\n";

    You should be able to include or require other templates in shortcode handlers. The problem is they often generate output instead of collecting into a variable. To work around such behavior you need to utilize output buffering to capture output before it is sent out.

Viewing 1 replies (of 1 total)
  • The topic ‘n00b question: Best method for outputting plugin data on specific places on page’ is closed to new replies.