Custom WordPress Redirect on Login Fail

I use this snippet to change the default redirect to /wp-login when user authentication fails on attempted login.   //redirects user to the page the login form is on and adds ?login=failed to the url add_action( ‘wp_login_failed’, ‘my_front_end_login_fail’ ); // hook failed login //redirect on login fail (doesn’t work when user clicks empty form. The Read More…

Query posts get post data

You can use this to access the the WordPress posts.  //Reading posts for “Events” category;     $posts = get_posts(“category=” . get_cat_ID(“Events”) .’&orderby=date&order=ASC&numberposts=50′); Then you can create an array and access the post data like this. //Creating drop down item array.     $items = array();     //Adding initial blank value, for a dropdown, or just to Read More…

Get newest post url

You can use this to the the url of the most recent post. <?php //list post title for one post is specified category $cat = 1; //category ID $args=array( ‘category__in’ => array($cat), ‘showposts’=>1, ‘caller_get_posts’=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <p><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link Read More…

WordPress Comments

If you want to modify how the comments # is displayed you can use this code: <?php if ( comments_open() ) : ?> <span class=”post-comment”><?php comments_popup_link( __( ‘Comments <span>0</span>’, ‘base’ ), __( ‘Comments <span>1</span>’, ‘base’ ), __( ‘Comments <span>%</span>’, ‘base’ ) ); ?></span> <?php endif; //post comment ?> As you can see you can add Read More…

Get Sub category ID’s of a post

You can use this code to get the subcategory ID’s of a post. <?php      $categories = get_the_category();      $this_cat_ID = $categories[0]->cat_ID;      $this_cat_name = $categories[0]->cat_name;      $this_cat_url = get_category_link($this_cat_ID);      // get the sub category if we have them      foreach ($categories as $cat) {         $parent Read More…

Custom Registration Emails

I ended up creating a simple plugin based on this tutorial: http://wp.smashingmagazine.com/2011/10/25/create-perfect-emails-wordpress-website/ Plus I had to create a page template for the password reset based on these 2 tutorials: http://www.sutanaryan.com/wordpress/how-to-create-custom-reset-or-forget-password-in-wordpress/ http://www.tutorialized.com/tutorial/Create-a-Wordpress-Custom-Password-Reset-Page-Template/76026

Unique code validation – gravity forms

I used this code to validate a specific unique code that you have to fill out in order to register on the taxlientrainer.com website.   // UNIQUE code validation. Checks to see if a valid promo code was entered // 1 – Tie our validation function to the ‘gform_validation’ hook add_filter(‘gform_validation_3’, ‘validate_code’); function validate_code($validation_result) { Read More…