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

WP Customer Reviews – shortcodes

The plugin registrer some shortcodes in wp-custom-reviews.php: add_shortcode( ‘WPCR_INSERT’, array(&$this, ‘shortcode_wpcr_insert’) ); add_shortcode( ‘WPCR_SHOW’, array(&$this, ‘shortcode_wpcr_show’) ); Try: [WPCR_INSERT] and [WPCR_SHOW]

Advanced Custom Fields/User Role Editor – how to hide ACF for certain users?

The admin_menu action will hide the ACF menu, in this example for not-admins. And admin_head will block the access if the URL is accessed directly. E.g.: http://example.com/wp-admin/edit.php?post_type=acf and http://example.com/wp-admin/edit.php?post_type=acf&page=acf-settings add_action( ‘admin_menu’, ‘wpse_59032_remove_acf_menu’, 9999 ); add_action( ‘admin_head-edit.php’, ‘wpse_59032_block_acf_screens’ ); add_action( ‘admin_head-custom-fields_page_acf-settings’, ‘wpse_59032_block_acf_screens’ ); function wpse_59032_remove_acf_menu() { /* if not our allowed users, hide menu */ if … Read more

Display comments of users on single page

You can use the get_comments function to retrieve comments from a specific user. $comments = get_comments( array( ‘user_id’ => 1 ) ); foreach( $comments as $comment ) { $post_id = $comment->comment_post_ID; $post = get_post( $post_id ); setup_postdata( $post ); echo ‘<a href=”‘ . get_permalink() . ‘”>’ . get_the_title() . ‘</a>’; echo $comment->comment_author . ‘<br />’ … Read more