Support » Plugin: Pastacode » Add new Code Language

  • Resolved excalabyte


    I would like to add a new code language to this great plugin 🙂 , I see Codemirror has the libraries .js

    Would I just need to add to the eixsting arrays , $pvars[‘scripts’], language_mode, $pvars[‘language_mode’] and $langs

    Using functions.php

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter excalabyte


    For anyone else the following needs to go in your functions

    /** pastcode plugin */
    add_filter( 'pastacode_langs', '_pastacode_langs' );
    function _pastacode_langs( $langs ) {
    	$langs['powershell'] = 'Powershell';
    	return $langs;
    add_filter( 'pastacode_tinymcevars', '_pastacode_tinymcevars' );
    function _pastacode_tinymcevars( $pvars ) {
    			'libs'      => array('powershell'),
    			'mode'      => 'application/x-powershell',
    	return $pvars;
    add_action('wp_enqueue_scripts', 'mytheme_scripts');
    function mytheme_scripts() {
      wp_dequeue_script( 'prismjs' );
      wp_deregister_script( 'prismjs' );
      wp_enqueue_script( 'prismjs',  get_template_directory_uri().'/js/prism.js', false,PASTACODE_VERSION, true );

    Along with prism.js and code library file (e.g. powershell.js ) in a js folder in your these

Viewing 1 replies (of 1 total)
  • The topic ‘Add new Code Language’ is closed to new replies.