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
/* Page with child pages List */ | |
function imediapixel_pagelist($page_name, $num, $orderby="menu_order",$style="2col") { | |
global $post; | |
$page_id = get_page_by_title($page_name); | |
$services_num = ($num) ? $num : 4; | |
$counter = 0; | |
$out = ""; | |
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
/* Posts List base on category*/ | |
function imediapixel_postslist($category, $num, $orderby="date",$style="2col") { | |
global $post; | |
$category_id = get_cat_ID($category); | |
$cat_num = ($num) ? $num : 4; | |
$counter = 0; | |
$out = ""; | |
query_posts('cat='.$category_id.'&showposts='.$cat_num.'&orderby='.$orderby); |
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
//You probably know that WordPress can schedule events. | |
// In this recipe, I’ll show you how you create an event that will be executed once hourly, or daily, etc. | |
if (!wp_next_scheduled('my_task_hook')) { | |
wp_schedule_event( time(), 'hourly', 'my_task_hook' ); | |
} | |
add_action( 'my_task_hook', 'my_task_function' ); | |
function my_task_function() { | |
wp_mail('[email protected]', 'Automatic email', 'Hello, this is an automatically scheduled email from WordPress.'); |
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
function wps_admin_bar() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('wp-logo'); | |
$wp_admin_bar->remove_menu('about'); | |
$wp_admin_bar->remove_menu('wporg'); | |
$wp_admin_bar->remove_menu('documentation'); | |
$wp_admin_bar->remove_menu('support-forums'); | |
$wp_admin_bar->remove_menu('feedback'); | |
$wp_admin_bar->remove_menu('view-site'); | |
} |
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
if ( !current_user_can( 'edit_users' ) ) { | |
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 ); | |
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) ); | |
} |
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
add_action('admin_init', 'slt_lock_theme'); | |
function slt_lock_theme() { | |
global $submenu, $userdata; | |
get_currentuserinfo(); | |
if ($userdata->ID != 1) { | |
unset($submenu['themes.php'][5]); | |
unset($submenu['themes.php'][15]); | |
} | |
} |
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
add_filter('body_class','add_mobile_class'); | |
function add_mobile_class($classes) { | |
$classes[] = 'NEW_CLASS'; | |
return $classes; | |
} |
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 | |
define( 'BLOCK_LOAD', true ); | |
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' ); | |
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' ); | |
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); |
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
jQuery.ajax({ | |
url: '/wp-admin/admin-ajax.php', | |
type: 'GET',//POST, JSON, XML | |
dataType: 'html', | |
data: ({ | |
action: 'MY_AJAX_FUNCTION', | |
state: state, | |
}), | |
success: function(data){ | |
if (data){ |
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
//Paste this in function.php | |
add_action( 'save_post', 'wptuts_save_thumbnail' ); | |
function wptuts_save_thumbnail( $post_id ) { | |
// Get Thumbnail | |
$post_thumbnail = get_post_meta( $post_id, $key = '_thumbnail_id', $single = true ); | |
// Verify that post is not a revision | |
if ( !wp_is_post_revision( $post_id ) ) { |