by Willy Bahuaud
4.9 (14 reviews)
Pastacode
Use Pastacode to add code into your posts with the awesome PrismJs coloration library. So, past'a code!
Tested up to WP 6.1 (Current: 6.9)
v3.0.1
Current Version v3.0.1
Updated 3 years ago
Last Update on 24 Nov, 2022
Synced 8 hours ago
Last Synced on
Rank
#9,359
-6 this week
Active Installs
500+
-7.7%
KW Avg Position
15
—
No change
Downloads
24.8K
+2 today
Support Resolved
0%
—
No change
Rating
98%
Review 4.9 out of 5
4.9
(14 reviews)
Next Milestone 600
500+
600+
440
Ranks to Climb
-
Growth Needed
8,000,000
Active Installs
Pro
Unlock Exact Install Count
See the precise estimated active installs for this plugin, calculated from real-time ranking data.
- Exact install estimates within tiers
- Track install growth over time
- Milestone progress predictions
Need 69 more installs to reach 600+
Rank Changes
Current
#9,359
Change
Best
#
Downloads Growth
Downloads
Growth
Peak
Upgrade to Pro
Unlock 30-day, 90-day, and yearly download history charts with a Pro subscription.
Upgrade NowReviews & Ratings
4.9
14 reviews
Overall
98%
5
13
(93%)
4
1
(7%)
3
0
(0%)
2
0
(0%)
1
0
(0%)
Tracked Keywords
Showing 1 of 1| Keyword | Position | Change | Type | Updated |
|---|---|---|---|---|
| sourcecode | 15 | — | Tag | 9 hours ago |
Unlock Keyword Analytics
Track keyword rankings, search positions, and discover new ranking opportunities with a Pro subscription.
- Full keyword position tracking
- Historical ranking data
- Competitor keyword analysis
Track This Plugin
Get detailed analytics, keyword tracking, and position alerts delivered to your inbox.
Start Tracking FreePlugin Details
- Version
- 3.0.1
- Last Updated
- Nov 24, 2022
- Requires WP
- 4.0+
- Tested Up To
- 6.1
- PHP Version
- 7.0 or higher
- Author
- Willy Bahuaud
Support & Rating
- Rating
- ★ ★ ★ ★ ★ 4.9
- Reviews
- 14
- Support Threads
- 0
- Resolved
- 0%
Keywords
Upgrade to Pro
Unlock keyword rankings, search positions, and detailed analytics with a Pro subscription.
Upgrade NowSimilar Plugins
WP Adminify – White Label WordPress, Admin Menu Editor, Login Customizer
7K+ installs
#2,736
Master Addons For Elementor - White Label, Free Widgets, Hover Effects, Conditions, & Animations
40K+ installs
#929
Qi Addons For Elementor
200K+ installs
#253
MW
MW WP Form
200K+ installs
#262
WPFront Scroll Top
200K+ installs
#270
Frequently Asked Questions
Common questions about Pastacode
HTML
CSS
JavaScript
PHP
C
C#
C++
Java
Sass
Python
SQL
Ruby
CoffeeScript
Bash
Apache
Less
HAML
Git command line
Haskell
Markdown
Typescript
Treeview (directory structure)
If you use another syntax highligther plugins, migration scripts are available :)
What is the Treeview language?
You can use it to display a directory structure. Use pipes, backticks and hyphens like this:
root_folder/
|-- a first folder/
| |-- holidays.mov
| |-- javascript-file.js
| `-- some_picture.jpg
|-- documents/
| |-- spreadsheet.xls
| |-- manual.pdf
| |-- document.docx
| `-- presentation.ppt
| `-- test
`-- README.md
CSS
JavaScript
PHP
C
C#
C++
Java
Sass
Python
SQL
Ruby
CoffeeScript
Bash
Apache
Less
HAML
Git command line
Haskell
Markdown
Typescript
Treeview (directory structure)
If you use another syntax highligther plugins, migration scripts are available :)
What is the Treeview language?
You can use it to display a directory structure. Use pipes, backticks and hyphens like this:
root_folder/
|-- a first folder/
| |-- holidays.mov
| |-- javascript-file.js
| `-- some_picture.jpg
|-- documents/
| |-- spreadsheet.xls
| |-- manual.pdf
| |-- document.docx
| `-- presentation.ppt
| `-- test
`-- README.md
add_filter( 'option_pastacode_cache_duration', 'my_pastacode_cache_duration' );
function my_pastacode_cache_duration( $duration ) {
$duration = DAY_IN_SECOND*3; // 3 days
return $duration;
}
function my_pastacode_cache_duration( $duration ) {
$duration = DAY_IN_SECOND*3; // 3 days
return $duration;
}
You can also build yours:
Paste these lines into your functions.php theme file:
add_action( 'wp_enqueue_scripts', 'custom_enqueue_script', 11 );
function custom_enqueue_script() {
$urlofmynewscheme = get_stylesheet_directory_uri() . '/prism-okaida-willy.css'; //this is an example
wp_deregister_style( 'prismcss' );
wp_register_style( 'prismcss', $urlofmynewscheme, false, '1', 'all' );
}
Get inspired of the default scheme to build your schemes
How to filter supported languages ?
Paste these lines into your functions.php theme file:
//If you just want php, html, css and javascript support
add_filter( 'pastacode_langs', '_pastacode_langs' );
function _pastacode_langs( $langs ) {
$langs = array(
'php' => 'PHP',
'markup' => 'HTML',
'css' => 'CSS',
'javascript' => 'JavaScript', );
return $langs;
}
Ajax compatibility
To enable Pastacode on ajax based websites, it need two steps:
Turn on Legacy support in the settings panel
Paste this line into your functions.php theme file: add_filter( 'pastacode_ajax', '__return_true' );
After each change on your DOM, you will have to run this javascript function: Prism.highlightAll();
Paste these lines into your functions.php theme file:
add_action( 'wp_enqueue_scripts', 'custom_enqueue_script', 11 );
function custom_enqueue_script() {
$urlofmynewscheme = get_stylesheet_directory_uri() . '/prism-okaida-willy.css'; //this is an example
wp_deregister_style( 'prismcss' );
wp_register_style( 'prismcss', $urlofmynewscheme, false, '1', 'all' );
}
Get inspired of the default scheme to build your schemes
How to filter supported languages ?
Paste these lines into your functions.php theme file:
//If you just want php, html, css and javascript support
add_filter( 'pastacode_langs', '_pastacode_langs' );
function _pastacode_langs( $langs ) {
$langs = array(
'php' => 'PHP',
'markup' => 'HTML',
'css' => 'CSS',
'javascript' => 'JavaScript', );
return $langs;
}
Ajax compatibility
To enable Pastacode on ajax based websites, it need two steps:
Turn on Legacy support in the settings panel
Paste this line into your functions.php theme file: add_filter( 'pastacode_ajax', '__return_true' );
After each change on your DOM, you will have to run this javascript function: Prism.highlightAll();
//Take WordPress SVN, for example
//register a provider
add_filter( 'pastacode_services', '_pastacode_services' );
function _pastacode_services( $services ) {
$services['wordpress'] = 'core.svn.wordpress.org';
return $services;
}
//Define pastabox lightbox inputs
add_action( 'pastacode_fields', '_pastacode_fields' );
function _pastacode_fields( $fields ) {
$fields['wordpress'] = array( // 'wordpress' or 'whatever'
'classes' => array( 'wordpress' ), // same value as the key
'label' => sprintf( __('File path relative to %s', 'pastacode'), 'http://core.svn.wordpress.org/' ),
'placeholder' =>'trunk/wp-config-sample.php', //if placeholder isn't defined, it will be a textarea
'name' => 'path_id' //these value return shortcode attribute (path_id, repos, name, user, version)
);
$fields['pastacode-lines']['classes'][] = 'wordpress'; // Add ability to select lines
$fields['pastacode-highlight']['classes'][] = 'wordpress'; // Add ability to highlight somes
return $fields;
}
//Build the function to retrieve the code
// "pastacode_wordpress" hook name (1st param) = "pastacode_" + "wordpress" or "whatever"
add_action( 'pastacode_wordpress', '_pastacode_wordpress', 10, 2 );
function _pastacode_wordpress( $source, $atts ) {
extract( $atts );
if( $path_id ) {
$req = wp_sprintf( 'http://core.svn.wordpress.org/%s', str_replace( 'http://core.svn.wordpress.org/', '', $path_id ) );
$code = wp_remote_get( $req );
if( ! is_wp_error( $code ) && 200 == wp_remote_retrieve_response_code( $code ) ) {
$data = wp_remote_retrieve_body( $code );
$source[ 'url' ] = $req; //url to view source
$source[ 'name' ] = basename( $req ); //filename
$source[ 'code' ] = esc_html( $data ); //the code !!
//$source[ 'raw' ] contain raw source code. But there are no raw source code delivered by Wordpress SVN
}
}
return $source;
}
//register a provider
add_filter( 'pastacode_services', '_pastacode_services' );
function _pastacode_services( $services ) {
$services['wordpress'] = 'core.svn.wordpress.org';
return $services;
}
//Define pastabox lightbox inputs
add_action( 'pastacode_fields', '_pastacode_fields' );
function _pastacode_fields( $fields ) {
$fields['wordpress'] = array( // 'wordpress' or 'whatever'
'classes' => array( 'wordpress' ), // same value as the key
'label' => sprintf( __('File path relative to %s', 'pastacode'), 'http://core.svn.wordpress.org/' ),
'placeholder' =>'trunk/wp-config-sample.php', //if placeholder isn't defined, it will be a textarea
'name' => 'path_id' //these value return shortcode attribute (path_id, repos, name, user, version)
);
$fields['pastacode-lines']['classes'][] = 'wordpress'; // Add ability to select lines
$fields['pastacode-highlight']['classes'][] = 'wordpress'; // Add ability to highlight somes
return $fields;
}
//Build the function to retrieve the code
// "pastacode_wordpress" hook name (1st param) = "pastacode_" + "wordpress" or "whatever"
add_action( 'pastacode_wordpress', '_pastacode_wordpress', 10, 2 );
function _pastacode_wordpress( $source, $atts ) {
extract( $atts );
if( $path_id ) {
$req = wp_sprintf( 'http://core.svn.wordpress.org/%s', str_replace( 'http://core.svn.wordpress.org/', '', $path_id ) );
$code = wp_remote_get( $req );
if( ! is_wp_error( $code ) && 200 == wp_remote_retrieve_response_code( $code ) ) {
$data = wp_remote_retrieve_body( $code );
$source[ 'url' ] = $req; //url to view source
$source[ 'name' ] = basename( $req ); //filename
$source[ 'code' ] = esc_html( $data ); //the code !!
//$source[ 'raw' ] contain raw source code. But there are no raw source code delivered by Wordpress SVN
}
}
return $source;
}