Custom_html callback markup is broken

Support General Custom_html callback markup is broken

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #4958
    JackkyJackky
    Participant

    With std option all going good, but thats, what is going on, when I using callback:



    It appears outside .rwmb-field wrapper

    #4969
    Anh TranAnh Tran
    Keymaster

    Hi Jackky, let me check and fix that. Thanks for reporting!

    #4971
    Anh TranAnh Tran
    Keymaster

    Just looked at the code again and found that you "echo" the content instead of returning it. The callback function "must" return the content.

    If your content is complicated, you should use output buffering to return it.

    #4994
    JackkyJackky
    Participant

    Give me an example please

    #4997
    Anh TranAnh Tran
    Keymaster

    Here it is:

    function hello() {
        return '<b style="color:red;">Hello</b>';
    }
    #5027
    JackkyJackky
    Participant

    So the callback tries to print content anyway? Why you chose this solution?

    #5031
    Anh TranAnh Tran
    Keymaster

    If you want the callback print the content, you can try output buffering, like this:

    function hello() {
         ob_start();
         echo 'Your content';
         return ob_get_clean();
    }

    This makes the logic of the plugin consistent ('std' vs 'callback').

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.