This file contains 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 ( !class_exists('JMO_Custom_Nav')) { | |
class JMO_Custom_Nav { | |
public function add_nav_menu_meta_boxes() { | |
add_meta_box( | |
'wl_login_nav_link', | |
__('WishList Login'), | |
array( $this, 'nav_menu_link'), | |
'nav-menus', | |
'side', | |
'low' |
This file contains 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 ( !class_exists( 'HijackMe' ) ) { | |
class HijackMe { | |
public function hijack_menu($objects) { | |
/** | |
* If user isn't logged in, we return the link as normal | |
*/ | |
if ( !is_user_logged_in() ) { | |
return $objects; | |
} | |
/** |
This file contains 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 | |
$sql = "SELECT * FROM queried_table"; | |
$query = mysql_query($sql); | |
while ( $results[] = mysql_fetch_object ( $query ) ); | |
array_pop ( $results ); | |
?> |
This file contains 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
<select name="the_name"> | |
<?php foreach ( $results as $option ) : ?> | |
<option value="<?php echo $option->desired_value; ?>"><?php echo $option->desired_label; ?></option> | |
<?php endforeach; ?> | |
</select> |
This file contains 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 Loop ***/ | |
function demo_loop() { | |
$args = array( | |
'cat' => 3, | |
'posts_per_page' => 1 | |
); | |
$demo_posts = new WP_Query($args); |
This file contains 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 | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
/** | |
* Get the event ID | |
*/ | |
$event_id = @$_GET['event_id']; | |
/** | |
* If no event ID or event_id is not an integer, do nothing | |
*/ |
This file contains 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 | |
$arr = array( | |
array('name' => 'John', 'age' => 30, 'website' => 'http://learnphp.co'), | |
array('name' => 'Joe', 'age' => 28, 'website' => 'http://johnmorrisonline.com'), | |
array('name' => 'Amy', 'age' => 32, 'website' => 'http://amy.com'), | |
array('name' => 'Alex', 'age' => 22, 'website' => 'http://thealex.com'), | |
array('name' => 'Pat', 'age' => 40, 'website' => 'http://patsjourney.com'), | |
); | |
?> |
This file contains 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
// Child theme setup function | |
function child_theme_setup() { | |
// Remove the primary navigation from its current location | |
remove_action( 'genesis_after_header', 'genesis_do_nav' ); | |
// Add the primary navigation to the top of the page | |
add_action( 'genesis_before_header', 'genesis_do_nav' ); | |
} | |
// Hook into genesis_setup |
This file contains 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 | |
// PHP 5.3- | |
function birthday($birthday){ | |
$age = strtotime($birthday); | |
if($age === false){ | |
return false; | |
} | |
list($y1,$m1,$d1) = explode("-",date("Y-m-d",$age)); |
This file contains 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 wp_get_thumb_src($post = false, $size = 'thumbnail') { | |
if ( ! $post ) { | |
global $post; | |
} | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size ); | |
$url = $thumb['0']; | |
return $url; | |
} |
OlderNewer