Creating your first template in drupal


Coming Shortly…

Advertisements

Removing plus sign in user login wordpress


/* to allow the user to regiter with email ids containing + */
add_filter( 'sanitize_user', 'plus_sanitize_user', 10, 3);
function plus_sanitize_user($username, $raw_username, $strict) {
 $new_username = strip_tags($raw_username);
 // Kill octets
 $new_username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $new_username);
 $new_username = preg_replace('/&.?;/', '', $new_username); // Kill entities

// If strict, reduce to ASCII for max portability.
 if ( $strict )
 $new_username = preg_replace('|[^a-z0-9 _.\-@+]|i', '', $new_username);

return $new_username;
}

Display posts/pages



<?php
 $args = array('numberposts' => '50', 'offset' => '',
 'category' => 'product_type', 'orderby' => 'post_date',
 'order' => 'DESC',
 'include' => '', 'exclude' => '',
 'meta_key' => '','meta_value' => '',
 'post_type' => 'product', 'post_mime_type' => '', 'post_parent' => '',
 'post_status' => 'publish', 'suppress_filters' => true
 );
 $products = get_posts($args);
 foreach($products as $product) {
 echo $product->post_title; // display product title
 echo get_the_post_thumbnail( $product->ID); // display product image
 echo $product->post_content; // display product description
 }
?>