Syntax Highlighting Plugins and 3.2.1

I use SyntaxHighlighter Evolved on my site which is based on Alex Gorbatchev’s SyntaxHighlighter and used by WordPress.com blogs/sites to get something like this: And i just recently published a plugin named Simple Gist Embed This Plugin allows to embed GitHub Gist to your posts/pages/custom using a simple shortcode and even simpler using a built-in … Read more

Auto add content such as pages upon plugin activation?

You can add those without a button: register_activation_hook( __FILE__, ‘my_plugin_install_function’); function my_plugin_install_function() { //post status and options $post = array( ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’ , ‘post_author’ => 1, ‘post_date’ => date(‘Y-m-d H:i:s’), ‘post_name’ => ‘Checklists’, ‘post_status’ => ‘publish’ , ‘post_title’ => ‘Checklists’, ‘post_type’ => ‘page’, ); //insert page and save the id $newvalue … Read more

Why none of the plugins that have ajax doesn’t work in my website?

Taking a look at your code, I noticed one huge issue (also pointed out by Milo). Your script tags (the ones that pull in jQuery and other scripts) are wrong. For example, this: <script data-djssrc=”http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.min.js” type=”text/djs”></script> <script data-djssrc=”http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.nivo.slider.js” type=”text/djs”></script> <script data-djssrc=”http://2barnamenevis.com/wp-content/themes/mediaflux2/js/mediaflux.js” type=”text/djs”></script> Should really be this: <script src=”http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.min.js” type=”javascript”></script> <script src=”http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.nivo.slider.js” type=”javascript”></script> <script src=”http://2barnamenevis.com/wp-content/themes/mediaflux2/js/mediaflux.js” type=”javascript”></script> … Read more

How can plugins have their own pages?

Believe it or not the WordPress official documentation has a great page covering this topic called Administration Menus. It also provides example code on how to use WordPress hooks in your plugin code to add custom setting pages and other pages like that. The page can be found here. Fire up the kettle and make … Read more

Localiztion in javascript

WordPress has a nice function mainly for that wp_localize_script To use it first queue your script: wp_enqueue_script( ‘My_Script_handle’, ‘path/to/script.js’ ); then create an array of strings you want to localize: $data = array( ‘exit’ => __( ‘Exit’,’my-plugin-domain’ ), ‘open’ => __( ‘Open’,’my-plugin-domain’ ), ‘close’ => __( ‘Close’,’my-plugin-domain’ ), ‘next’ => __( ‘Next’,’my-plugin-domain’ ), ‘previous’ => … Read more

Can a plugin deactivate itself?

As far as I know, a plugin can be deactivated in these conditions: manual deactivation failed plugin upgrade remove or rename the containing folder changing the active plugin list in the database Hopefully someone else will come through and add to this if I missed any.

Is there a plugin to insert pre-defined link into editor?

You can make a button to the Tinymce editor that adds a pre defined link like this youtube button: Put this in your functions.php theme file: // Hook into WordPress add_action(‘init’, ‘mylink_button’); // Create Our Initialization Function function mylink_button() { if ( ! current_user_can(‘edit_posts’) && ! current_user_can(‘edit_pages’) ) { return; } if ( get_user_option(‘rich_editing’) == … Read more