This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
# Check for mime types commonly accepted by mobile devices | |
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC] | |
RewriteCond %{REQUEST_URI} ^/$ | |
RewriteRule ^ http://m.domain.com%{REQUEST_URI} [R,L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Create order dynamically | |
*/ | |
function create_order_dynamically() { | |
$customer_email = '[email protected]'; | |
$customer_address = array( | |
'first_name' => 'Peter', | |
'last_name' => 'Parker', | |
'company' => '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo get_twitter_user_data('Khokan', 'name') . ' has ' . | |
get_twitter_user_data('Khokan', 'followers_count') . ' followers after ' . | |
get_twitter_user_data('Khokan', 'statuses_count') . ' updates.'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_twitter_user_data( $username, $field, $display = false ) { | |
$interval = 3600; | |
$cache = get_option('get_twitter_user_data'); | |
$url = 'http://api.twitter.com/1/users/show.json?screen_name='.urlencode($username); | |
if ( false == $cache ) | |
$cache = array(); | |
// if first time request add placeholder and force update | |
if ( !isset( $cache[$username][$field] ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Dynamic Titles **/ | |
// This sets your <title> depending on what page you're on, for better formatting and for SEO | |
// You need to set the variable $longd to some custom text at the beginning of the function | |
function dynamictitles() { | |
$longd = __('Enter your longdescription here.', 'texdomainstring'); | |
if ( is_single() ) { | |
wp_title(''); | |
echo ' | '.get_bloginfo('name'); | |
} else if ( is_page() || is_paged() ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_custom_search($query) { | |
// Check to verify it's search page | |
if( is_search( ) { | |
$post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects'); | |
$searchable_types = array(); | |
// Add available post types | |
if( $post_types ) { | |
foreach( $post_types as $type) { | |
$searchable_types[] = $type->name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getPostViews($postID){ | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==''){ | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, '0'); | |
return "0 View"; | |
} | |
return $count.' Views'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_loginlogo() { | |
echo '<style type="text/css"> | |
h1 a {background-image: url('.get_bloginfo('template_directory').'/images/login_logo.png) !important; } | |
</style>'; | |
} | |
add_action('login_head', 'custom_loginlogo'); |
NewerOlder