CD autorun

You can use this code to launch an html file with autorun. Save the text file as .inf The shellexecute is how you run the file and I used a 64X64 icon for the .ico file. [autorun] shellexecute=ondemand.html label=On Demand Training icon= icon.ico

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…

Read Only Textarea

Use this in your functions.php file to change a textarea to readonly. // update ‘2’ to the ID of your form add_filter(‘gform_pre_render_2’, ‘add_readonly_script’); function add_readonly_script($form){     ?>     <script type=”text/javascript”>         jQuery(document).ready(function(){             jQuery(“li.gf_readonly textarea”).attr(“readonly”,”readonly”);         });     </script>     <?php     return $form; } Then add  the .gf_readonly class to your textarea in the 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…