Title: Add new Code Language
Last modified: April 23, 2020

---

# Add new Code Language

 *  Resolved [excalabyte](https://wordpress.org/support/users/excalabyte/)
 * (@excalabyte)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/add-new-code-language/)
 * I would like to add a new code language to this great plugin 🙂
 * [https://codemirror.net/mode/](https://codemirror.net/mode/) , 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadd-new-code-language%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [excalabyte](https://wordpress.org/support/users/excalabyte/)
 * (@excalabyte)
 * [6 years ago](https://wordpress.org/support/topic/add-new-code-language/#post-12781008)
 * 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 ) {
       	$pvars['scripts']['powershell']=get_template_directory_uri().'/js/powershell.js';
       	$array=array(
       			'libs'      => array('powershell'),
       			'mode'      => 'application/x-powershell',
       			);
   
       	$pvars['language_mode']['powershell']=$array;
       	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.

 * ![](https://ps.w.org/pastacode/assets/icon-256x256.png?rev=2819151)
 * [Pastacode](https://wordpress.org/plugins/pastacode/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pastacode/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pastacode/)
 * [Active Topics](https://wordpress.org/support/plugin/pastacode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pastacode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pastacode/reviews/)

## Tags

 * [languages](https://wordpress.org/support/topic-tag/languages/)

 * 1 reply
 * 1 participant
 * Last reply from: [excalabyte](https://wordpress.org/support/users/excalabyte/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/add-new-code-language/#post-12781008)
 * Status: resolved