Handling jQuery Component Collision

My suggestion would be to use a mix of code isolation in an anonymous function and checking if jquery is already present. Here’s an example: (function() { var jQuery; // your jquery variable // check if jquery is present and if it has the version you want if (window.jQuery === undefined || window.jQuery.fn.jquery !== ‘1.8.3’) … Read more

How could I execute my plugin just in frontend (not in backend)

Check the requested URI: if(!is_admin() && strpos($_SERVER[‘REQUEST_URI’], ‘wp-login.php’) === false && strpos($_SERVER[‘REQUEST_URI’], ‘wp-signup.php’) === false) { … } But it’s probably better to use a white-list style: if(is_front_page() || is_singular() || is_archive()) { … } These 3 tags should cover pretty much all of the front-end…

Close the media-upload thickbox right after upload is finished?

This was solved as simply as: Hooking a custom .js script to the media-upload thickbox, so that it runs inside the iFrame: function admin_styles_scripts_media_upload() { wp_register_script(‘mediajs’, get_template_directory_uri().’/js/button.js’, array(‘jquery’), true); wp_enqueue_script(‘mediajs’); } add_action(‘admin_print_scripts-media-upload-popup’,’admin_styles_scripts_media_upload’); ?> Use the script to replace the default Save button with a custom one, and call self.parent.tb_remove from that: jQuery(document).ready(function() { jQuery(‘<a href=”#” … Read more

Frontend editing, Frontend user dashboard

I have Something that i use from time to time when i need something like that: <?php /* Plugin Name: List User Posts Plugin URI: http://en.bainternet.info Description: lists user posts on the front end Version: 0.1 Author: Bainternet Author URI: http://en.bainternet.info */ if (!class_exists(‘list_user_posts’)){ /** * list_user_posts * @author Ohad Raz */ class list_user_posts { … Read more

Create front end link to save post (or unpublish post) as draft

You can use wp_update_post() to change the status of a post. global $current_user; get_currentuserinfo(); $post_id = $_GET[‘post_id’]; $the_post = get_post( $post_id ); if ( $the_post->post_author == $current_user->ID && $the_post ) { $the_post->post_status=”draft”; wp_update_post( $the_post ); } Use wp_insert_post() with post_status => ‘draft’ to save a post.

Custom user profile URLs

Create an endpoint for EP_ROOT named profile. In your callback handler use get_user_by( ‘slug’, get_query_var( ‘profile’ ) ) to find the user data. Create a template file profile.php and use locate_template( ‘profile.php’, TRUE ) to load it. In your template show the user data.

Frontend posting – everything saves other than checkboxes?

Did you check the database for the data? My guess is that the problem is here: echo ‘<input type=”checkbox” name=”cbn[]” id=”‘.$option[‘value’].'”‘,$checkboxes && in_array($option[‘value’], $checkboxes) ? ‘ checked=”checked”‘ : ”,’ /> ‘; should be: echo ‘<input type=”checkbox” name=”cbn[]” id=”‘.$option[‘value’].'”‘.$checkboxes && in_array($option[‘value’], $checkboxes) ? ‘ checked=”checked”‘ : ”.’ /> ‘; Edit: You’re confusing poor PHP. Try enclosing … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)