3 Added question
source | link

In my plugin, I´ve added shortcodes that display data from the database and adds some buttons. When buttons are pushed, more data is displayed at the end of the page. This works perfectly when no attributes are added in the shortcode, but when they are, all the text disappears after the buttons are pushed.

Why does addition of attributes seem to erase my shortcode-info?

This is what it looks like:

    function my_plugin(){   
        print "HTML-button + hidden_value"; 
        if ( isset( $_POST["button_is_pressed"] ) ) {
            print  do_shortcode($the_shortcode + attributes based on hidden value);
        }   
    }

    add_shortcode('my_shortcode', 'my_shortcode_function');
    function my_shortcode_function(){
         print "A lot of database data + button";

         if ( isset( $_POST["shortcode_button_is_pressed"] ) ) {
             print  "Even more database data";
         }  
    }

So, the info displayed by the shortcode disappears when I add attributes to the shortcode. If no attributes are added, "A lot of database data" + "Even more database data" will be displayed without problems. Why this difference with attributes?

This was added later: Now when I substituted the "print" with Return of a string (not shown), it seems totally logical that my code doesn´t work, because a Return statement exits the shortcode function.

But how do I display extra information when a shortcode button is pressed? At that point, execution of the shortcode is already finished.

In my plugin, I´ve added shortcodes that display data from the database and adds some buttons. When buttons are pushed, more data is displayed at the end of the page. This works perfectly when no attributes are added in the shortcode, but when they are, all the text disappears after the buttons are pushed.

Why does addition of attributes seem to erase my shortcode-info?

This is what it looks like:

    function my_plugin(){   
        print "HTML-button + hidden_value"; 
        if ( isset( $_POST["button_is_pressed"] ) ) {
            print  do_shortcode($the_shortcode + attributes based on hidden value);
        }   
    }

    add_shortcode('my_shortcode', 'my_shortcode_function');
    function my_shortcode_function(){
         print "A lot of database data + button";

         if ( isset( $_POST["shortcode_button_is_pressed"] ) ) {
             print  "Even more database data";
         }  
    }

So, the info displayed by the shortcode disappears when I add attributes to the shortcode. If no attributes are added, "A lot of database data" + "Even more database data" will be displayed without problems. Why this difference with attributes?

In my plugin, I´ve added shortcodes that display data from the database and adds some buttons. When buttons are pushed, more data is displayed at the end of the page. This works perfectly when no attributes are added in the shortcode, but when they are, all the text disappears after the buttons are pushed.

Why does addition of attributes seem to erase my shortcode-info?

This is what it looks like:

    function my_plugin(){   
        print "HTML-button + hidden_value"; 
        if ( isset( $_POST["button_is_pressed"] ) ) {
            print  do_shortcode($the_shortcode + attributes based on hidden value);
        }   
    }

    add_shortcode('my_shortcode', 'my_shortcode_function');
    function my_shortcode_function(){
         print "A lot of database data + button";

         if ( isset( $_POST["shortcode_button_is_pressed"] ) ) {
             print  "Even more database data";
         }  
    }

So, the info displayed by the shortcode disappears when I add attributes to the shortcode. If no attributes are added, "A lot of database data" + "Even more database data" will be displayed without problems. Why this difference with attributes?

This was added later: Now when I substituted the "print" with Return of a string (not shown), it seems totally logical that my code doesn´t work, because a Return statement exits the shortcode function.

But how do I display extra information when a shortcode button is pressed? At that point, execution of the shortcode is already finished.

2 Code added.
source | link

In my plugin, I´ve added shortcodes that display data from the database and adds some buttons. When buttons are pushed, more data is displayed at the end of the page. This works perfectly when no attributes are added in the shortcode, but when they are, all the text disappears after the buttons are pushed.

Why does addition of attributes seem to erase my shortcode-info?

This is what it looks like:

    function my_plugin(){   
        print "HTML-button + hidden_value"; 
        if ( isset( $_POST["button_is_pressed"] ) ) {
            print  do_shortcode($the_shortcode + attributes based on hidden value);
        }   
    }

    add_shortcode('my_shortcode', 'my_shortcode_function');
    function my_shortcode_function(){
         print "A lot of database data + button";

         if ( isset( $_POST["shortcode_button_is_pressed"] ) ) {
             print  "Even more database data";
         }  
    }

So, the info displayed by the shortcode disappears when I add attributes to the shortcode. If no attributes are added, "A lot of database data" + "Even more database data" will be displayed without problems. Why this difference with attributes?

In my plugin, I´ve added shortcodes that display data from the database and adds some buttons. When buttons are pushed, more data is displayed at the end of the page. This works perfectly when no attributes are added in the shortcode, but when they are, all the text disappears after the buttons are pushed.

Why does addition of attributes seem to erase my shortcode-info?

In my plugin, I´ve added shortcodes that display data from the database and adds some buttons. When buttons are pushed, more data is displayed at the end of the page. This works perfectly when no attributes are added in the shortcode, but when they are, all the text disappears after the buttons are pushed.

Why does addition of attributes seem to erase my shortcode-info?

This is what it looks like:

    function my_plugin(){   
        print "HTML-button + hidden_value"; 
        if ( isset( $_POST["button_is_pressed"] ) ) {
            print  do_shortcode($the_shortcode + attributes based on hidden value);
        }   
    }

    add_shortcode('my_shortcode', 'my_shortcode_function');
    function my_shortcode_function(){
         print "A lot of database data + button";

         if ( isset( $_POST["shortcode_button_is_pressed"] ) ) {
             print  "Even more database data";
         }  
    }

So, the info displayed by the shortcode disappears when I add attributes to the shortcode. If no attributes are added, "A lot of database data" + "Even more database data" will be displayed without problems. Why this difference with attributes?

1
source | link

Displayed content disappears when adding attributes to shortcode

In my plugin, I´ve added shortcodes that display data from the database and adds some buttons. When buttons are pushed, more data is displayed at the end of the page. This works perfectly when no attributes are added in the shortcode, but when they are, all the text disappears after the buttons are pushed.

Why does addition of attributes seem to erase my shortcode-info?