add_rewrite_rule and custom variable

Hi @westondeboer: Since you are saying your post type is ‘portfolio’ here’s what works on my WordPress v3.0.4 test site with a ‘portfolio’ custom post type defined. It replaces all the code you have: add_action(‘init’,’yoursite_init’); function yoursite_init() { global $wp,$wp_rewrite; $wp->add_query_var(‘view’); $wp_rewrite->add_rule(‘portfolio/([^/]+)/all’, ‘index.php?view=all&post_type=portfolio&name=$matches[1]’, ‘top’); // Once you get working, remove this next line $wp_rewrite->flush_rules(false); } … Read more

Force core to use .dev JavaScript files

I use a combination of constants on my local install. define(‘CONCATENATE_SCRIPTS’, false); define(‘COMPRESS_SCRIPTS’, false); // <— this is likely the one you’re after define(‘COMPRESS_CSS’, false); define(‘SCRIPT_DEBUG’, true); I’d imagine the second constant listed above is the one you’re after.

How to add checkbox and radio button in Profile Page

You are missing the “checked” value for the inputs <input type=”checkbox” name=”language” <?php if (get_the_author_meta( ‘language’, $user->ID) == ‘Mandarin’ ) { ?>checked=”checked”<?php }?> value=”Mandarin” /> Mandarin<br /> Also, the usermeta is dealing but your are checking for $_POST[‘gender’] Finally, you should have one usermeta for English and other for Mandarin, as they are not mutually … Read more

Change admin startpage to Pages-page?

This should work for you if you put it in your themes functions.php file, but you may want to modify the conditions, and the url to redirect to depending on your set up. function loginRedirect( $redirect_to, $request, $user ){ if( is_array( $user->roles ) ) { // check if user has a role return “/wp-admin/edit.php?post_type=page”; } … Read more

Creating a rotating header /image slider using theme customization

We can do that! First, you’ll need to add a custom section on the Theme Customizer, containing all the image uploads (we’ll use 3 for this example): add_action( ‘customize_register’, ‘themename_customize_register’ ); function themename_customize_register($wp_customize) { $wp_customize->add_section( ‘slides’, array( ‘title’ => ‘Slides’, ‘priority’ => 25, ) ); $wp_customize->add_setting( ‘first_slide’, array( ‘default’ => ”, ) ); $wp_customize->add_control( new … Read more

Modify search function in WordPress (TwentyTwelve)

Modify the searchform.php, or create one in a child theme (recommended), and you should be able to modify the form all you want. This is the file that get_search_form looks for and is the file used by the default search widget, though it is not listed in the Template Hierarchy. Reference: http://codex.wordpress.org/Function_Reference/get_search_form

Redirect After Delete User in Backend

You could also do this, function mod_redirect_subscriber_delete($user_id) { $user = get_user_by(‘id’, $user_id); $role = $user->roles[0]; if ($role == ‘subscriber’) { add_action(“deleted_user”, function(){ wp_redirect( admin_url(‘/index.php’) ); exit; }); } } add_action(“delete_user”, “mod_redirect_subscriber_delete”); Anonymous functions (closures), available in PHP 5.3+. Benefits: No need to remove the initial hook on delete_user No need to re-run wp_delete_user() You still … Read more

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