• Hello,

    I’m afraid I’m missing something basic.

    I’d like to use Code Snippet to invoke a simple api that calls the status of a Minecraft server, and outputs the returned values. The api is available here: https://api.mcsrvstat.us/

    I can add a code snippet, which saves and throws no errors. What I’m missing:

    How do I specify a page in WordPress to invoke the code snippet and display the returned information?

    Thanks much!

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hello,

    The best option here would be to add a shortcode snippet; for example:

    add_shortcode( 'shortcode_name_here', function () {
    
    	// PHP API call logic here
    
    	?>
    
    	<!-- static HTML output here -->
    
    	<?php
    } );

    You might also want to have a look at the WordPress HTTP API for some easier ways of interacting with the Minecraft server API.

    Let me know if you would like some more specific (actually usable) examples of how this might work.

Viewing 1 replies (of 1 total)
  • The topic ‘How to invoke code snippet output to display in a page’ is closed to new replies.