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(($count % $number) == 0){ | |
//do something | |
} |
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 | |
function posts_columns_id($defaults){ | |
$defaults['wps_post_id'] = __('ID'); | |
return $defaults; | |
}// end posts_columns_id function | |
function posts_custom_id_columns($column_name, $id){ | |
if($column_name === 'wps_post_id'){ | |
echo $id; | |
} | |
}// end posts_custom_id_columns function |
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 add_nofollow_to_reply_link( $link ) { | |
return str_replace( '")'>', '")' rel='nofollow'>', $link ); | |
} | |
add_filter( 'comment_reply_link', 'add_nofollow_to_reply_link' ); |
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
//start function to add rel attribute to image links | |
function rel_prettyPhoto($link) { | |
global $post; | |
$find ="/<a(.*?)href=('|")(.*?).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i"; | |
$replace = '<a$1href=$2$3.$4$5 rel="prettyPhoto['. $post->ID .']" $6>'; | |
$link = preg_replace($find, $replace, $link); | |
return $link; | |
} //end function to add rel attribute to image links | |
//add rel attribute function to the content filter |
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
// Register the column | |
function METAKEYHERE_column_register( $columns ) { | |
$columns['METAKEYHERE'] = __( 'COLUMNLABEL', 'POSTTYPE' ); | |
return $columns; | |
} | |
add_filter( 'manage_edit-POSTTYPE_columns', 'METAKEYHERE_column_register' ); | |
// Display the column content | |
function METAKEYHERE_column_display( $column_name, $post_id ) { |
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 ChangeMetaKey($old, $new){ | |
global $wpdb; | |
$wpdb->query( " | |
update $wpdb->postmeta | |
set meta_key = '$new' | |
where meta_key = '$old' | |
"); | |
}//end change metakey |
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 CUSTOMPOSTTYPE_change_default_title( $title ){ | |
$screen = get_current_screen(); | |
//only update the title if on CUSTOMPOSTTYPE | |
if ( 'CUSTOMPOSTTYPE' == $screen->post_type ) | |
$title = 'NEW PLACEHOLDER HERE'; | |
return $title; | |
} | |
add_filter( 'enter_title_here', 'CUSTOMPOSTTYPE_change_default_title' ); |
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
add_image_size( 'coupon-thumb', 250, 115, true ); | |
function coupons_shortcode() {//start coupon shortcode function shortcode | |
global $COUPONS_name, $COUPONS_prefix, $post; | |
$args = array( | |
'post_type' => 'attachment', | |
'numberposts' => -1, | |
'post_status' => null, | |
'post_parent' => $post->ID, | |
'post_mime_type' => 'image' |
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
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,'FEEDURL'); | |
curl_setopt($ch, CURLOPT_HEADER, false); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$feed = curl_exec($ch); | |
curl_close($ch); |
OlderNewer