Custom Fields
Re-Envisioned
Support General Custom_html callback markup is broken

  • Creator
    Topic
  • #4958
    Jackky
    Participant

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



    It appears outside .rwmb-field wrapper

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #4969
    Anh Tran
    Keymaster

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

    #4971
    Anh 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
    Jackky
    Participant

    Give me an example please

    #4997
    Anh Tran
    Keymaster

    Here it is:

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

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

    #5031
    Anh 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 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.