• I can’t get my shortcode plugin to do anything – it doesn’t show the shortcode in the post itself, but it also doesn’t show anything. Here’s my most basic example.

    1. created a folder “basic” in the plugins folder
    2. created a file “basic.php” in the basic folder
    3. activated the plugin
    4. added the following code to it
    5. <?php
      /*
      Plugin Name: basic
      Description: a shortcode.
      Version: 1.0
      License: GPL2
      */
      add_shortcode('basic',  function () {
      	return "the plugin has been executed";
      });
      
      add_shortcode("basic2", "basic2_handler");
      function basic2_handler() {
        $foo = "basic 2 handler";
        return $foo;
      }
      ?>
    6. edited a post and added [basic] and [basic2] to the entry

    the text [basic] is missing, so I am presuming that shortcodes are working (other peoples plugins work fine enough). But nothing is returned at all in its place.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘can't get a basic shortcode to work’ is closed to new replies.