• First of all, apologies for my low understanding that might lead to my question not being easy to understand:

    Can I display some HTML from my own plugin, at a URL of my choice? The URL not being an official page created by ‘New Page’ within WordPress. Example, mydomain.com/booking.php would display some HTML, like an HTML form (which I have coded up in an HTML file).

    I know so little at the moment, I can’t use the correct terms to describe what I want. Maybe I need to use hooks to do this, but like I say, I’m at such an early stage of learning WordPress development, that I am overwhelmed by the possibilities.

    I know I can display HTML by creating a page (using ‘New Page’) via the WordPress user interface, and then using the [display_some_html] method. But that feels messy. Is that the standard way to do it?

Viewing 1 replies (of 1 total)
  • Hello speedy_snail,

    WordPress provide shortcode functionality. You can create your own shortcode and put it any page to show you shortcode content.

    Check below example for creating shortcode :

    /** Html Code **/
    
    function my_html_code_fun( $atts ) {
      $html = '<div>';
      $html .= '<p>Hello World</p>';
      $html = '</div>';
      return $html;
    }
    
    /** Create Shortcode **/
    add_shortcode( 'my_html_code', 'my_html_code_fun' );

    Now you have to add [my_html_code] shortcode in page’s/post’s editor & save page/post.

    You can add above code in your plugin.

    Check link for other info about shortcode.

    Hope this will helps you.

    Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Display HTML at specific URL via my own plugin’ is closed to new replies.