Insert PHP code into the Visual Composer

后端 未结 2 571
予麋鹿
予麋鹿 2021-01-07 09:23

I have the php code (ACF Pro plugin code). How can I insert this code into my Visual Composer? Can\'t find the solution for a long time but now it\'s critical for me.

相关标签:
2条回答
  • 2021-01-07 09:49

    Just put your php code inside a function and create shortcode

    function vComp(){
    **PHP CODE**
     }
    add_shortcode( 'vShortcode', 'vComp' );
    

    Goto Visual Composer- Shortcode Mapper - Map Shortcode - then Enter valid shortcode (Example: [vShortcode]).

    0 讨论(0)
  • 2021-01-07 09:49

    Create function in functions.php page .

    function shortcode (){
    }
    add_shortcode('shortcode-name',shortcode );
    
    0 讨论(0)
提交回复
热议问题