Add script from front end editor

Home Forums Legacy Support Support queries Other issues Add script from front end editor

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #51643
    haroon
    Spectator
    Hello   I am trying to add some script in wplms units from front end editor but the editor remove that script and didn't save that script, also the scripts that were added from wp-admin, when we want to edit that script and open that unit in front end editor the editor remove the script. Example: When I want to add below code
    npPlayerInit('npholder1', '', '3gLhooZIkB', 380, 0); The front editor only save
    and other npPlayerInit('npholder1', '', '3gLhooZIkB', 380, 0); is removed. If I add this code from wp-admin back-end editor it is ok and when I edit that unit from front end editor it is only show 
    in editor other script part didn't picked by the front end editor. Can you please help me to fix this issue. Thanks
    #51779
    Anshuman Sahu
    Keymaster
    Please try adding the html with the help of this plguin : https://wordpress.org/plugins/raw-html/ and use it like this :
    [raw]
    <div id="npholder1"></div>
    <script type="text/javascript">npPlayerInit('npholder1', '', '3gLhooZIkB', 380, 0);</script>
    [/raw]
    #51900
    haroon
    Spectator
    Hi, I've tried the above mentioned code and also installed the above mentioned plugin but it displays the code as it is to end users. I don't need this I need the script added by admin to run.   Thanks
    #52054
    Anshuman Sahu
    Keymaster
    Okay i created a shortcode for you to add the script from front end . Please add the given code in your wplms-customizer.php file in wplms customizer plugin : add_shortcode('wplms_raw','wplms_raw_html'); function wplms_raw_html($atts,$content){   $html=html_entity_decode ($content, ENT_COMPAT, 'UTF-8');   $search2=array('″','”');   $search1=array("’","‘");   $html=str_replace($search2,'"',$html);   $html=str_replace($search1,"'",$html);   return $html;   } But there is one problem in your script you have to pass the second parameter in script function " npPlayerInit " with a space between quotes . So add the script like this : [wplms_raw] <div id="npholder1"></div>   <script type="text/javascript">npPlayerInit('npholder1', ' ', '3gLhooZIkB', 380, 0);</script> [/wplms_raw] Note that there is a space between quotes here in second prarmeter : npPlayerInit('npholder1',   ' '   ,   '3gLhooZIkB', 380, 0);
    #53057
    haroon
    Spectator
    Hello Alex, Many thanks for your support
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Add script from front end editor’ is closed to new replies.