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
/* Get Latest post from all blogs */ | |
function recent_mu_posts( $howMany = 10 ) { | |
global $wpdb; | |
global $table_prefix; | |
// get an array of the table names that our posts will be in | |
// we do this by first getting all of our blog ids and then forming the name of the | |
// table and putting it into an array | |
$rows = $wpdb->get_results( "SELECT blog_id from $wpdb->blogs WHERE | |
public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0';" ); |
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
/* Get featured image */ | |
if( !function_exists( 'get_the_post_thumbnail_by_blog' ) ) { | |
function get_the_post_thumbnail_by_blog($blog_id=NULL,$post_id=NULL,$size='post-thumbnail',$attrs=NULL) { | |
global $current_blog; | |
$sameblog = false; | |
if( empty( $blog_id ) || $blog_id == $current_blog->ID ) { | |
$blog_id = $current_blog->ID; | |
$sameblog = true; | |
} |
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 rh_get_widget_data_for($sidebar_name) { | |
global $wp_registered_sidebars, $wp_registered_widgets; | |
// Holds the final data to return | |
$output = array(); | |
// Loop over all of the registered sidebars looking for the one with the same name as $sidebar_name | |
$sibebar_id = false; | |
foreach( $wp_registered_sidebars as $sidebar ) { | |
if( $sidebar['name'] == $sidebar_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 | |
/** | |
* parse path to get from clean URL | |
* @return [array] [array of requested uri] | |
*/ | |
function parse_path() { | |
$path = array(); | |
if (isset($_SERVER['REQUEST_URI'])) { | |
$request_path = explode('?', $_SERVER['REQUEST_URI']); |
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 filter_content_match_protocols( $content ) { | |
$search = $replace = get_bloginfo( 'home' ); | |
if ( ! preg_match( '|/$|', $search ) ) | |
$search = $replace = "$search/"; | |
if ( is_ssl() ) { | |
$search = str_replace( 'https://', 'http://', $search ); | |
$replace = str_replace( 'http://', 'https://', $replace ); | |
} |
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 | |
/* | |
Plugin Name: Custom table example | |
Description: example plugin to demonstrate wordpress capatabilities | |
Plugin URI: http://mac-blog.org.ua/ | |
Author URI: http://mac-blog.org.ua/ | |
Author: Marchenko Alexandr | |
License: Public Domain | |
Version: 1.1 | |
*/ |
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 | |
/** | |
* Batch Add user to buddypress group | |
*/ | |
add_action('load-users.php',function() { | |
if(isset($_POST['action']) && ($_POST['action'] == 'groupadd') && isset($_POST['bp_gid']) && isset($_POST['allusers'])) { | |
// print_r($_POST); exit(); | |
$group_id = $_POST['bp_gid']; |
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 | |
/** | |
* Plugin Name: MHT Domain Search | |
* Description: Page template domain registration for mega high tech. | |
* Author: Lafif Astahdziq | |
* Author URI: http://astahdziq.in/ | |
* Version: 1.0 | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by |
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 | |
/** | |
* Custom metabox to change priority displaying courses | |
* ==================================================== | |
*/ | |
add_action( 'add_meta_boxes', 'tj_amb_priority_courses' ); | |
function tj_amb_priority_courses() { | |
add_meta_box( 'tj_mb_priority_courses', 'Display Priority', 'tj_mb_priority_courses_cb', 'sfwd-courses', 'side', 'high' ); | |
} |
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 | |
/** | |
* Custom wordpress error database connection page | |
* @put this file on your wp-content/ folder. | |
* @name file : db-error.php | |
* | |
*/ | |
header('HTTP/1.1 503 Service Temporarily Unavailable'); | |
header('Status: 503 Service Temporarily Unavailable'); |