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 | |
add_filter('wp_get_attachment_link', 'rc_add_rel_attribute'); | |
function rc_add_rel_attribute($link) { | |
global $post; | |
return str_replace('<a href', '<a rel="prettyPhoto[pp_gal]" href', $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
<?php | |
function list_thumbnail_sizes(){ | |
global $_wp_additional_image_sizes; | |
$sizes = array(); | |
foreach( get_intermediate_image_sizes() as $s ){ | |
$sizes[ $s ] = array( 0, 0 ); | |
if( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) ){ | |
$sizes[ $s ][0] = get_option( $s . '_size_w' ); | |
$sizes[ $s ][1] = get_option( $s . '_size_h' ); | |
}else{ |
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 | |
add_filter( 'login_headertitle', 'my_login_headertitle' ); | |
/** | |
* Replaces the login header logo title | |
* | |
*/ | |
function my_login_headertitle( $title ) { | |
$title = get_bloginfo( 'name' ); | |
return $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
<?php | |
add_action( 'login_head', 'namespace_login_style' ); | |
/** | |
* Replaces the login header logo | |
*/ | |
function namespace_login_style() { | |
echo '<style>.login h1 a { background-image: url( ' . get_template_directory_uri() . '/images/logo.png ) !important; }</style>'; | |
} | |
?> |
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 | |
add_filter( 'the_search_query', 'add_custom_post_type_to_search' ); | |
/** | |
* Make Custom Post Type searchable | |
* | |
*/ | |
function add_custom_post_type_to_search( $query ) { | |
if ( $query->is_search ) { $query->set( 'post_type', array( 'site', 'plugin', 'theme', 'person' )); } | |
return $query; |
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 | |
add_filter( 'user_contactmethods', 'hide_profile_fields', 10, 1 ); | |
/** | |
* Remove default author profile fields | |
* | |
*/ | |
function hide_profile_fields( $contactmethods ) { | |
unset($contactmethods['aim']); | |
unset($contactmethods['jabber']); |
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 | |
add_filter( 'user_contactmethods', 'my_new_contactmethods', 10, 1 ); | |
/** | |
* Add custom fields to the author profile fields | |
* | |
*/ | |
function my_new_contactmethods( $contactmethods ) { | |
$contactmethods['twitter'] = 'Twitter'; // Add Twitter |
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 | |
/** | |
* Get the [gallery] shortcode from the post content and display it on index page. It require | |
* gallery ids [gallery ids=1,2,3,4] to display it as thumbnail slideshow. If no ids exist it | |
* just display it as standard [gallery] markup. | |
* | |
* If no [gallery] shortcode found in the post content, get the attached images to the post and | |
* display it as slideshow. | |
* | |
* @since 2.1 |
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 | |
$comments = get_comments( array( | |
'number' => 5, | |
'status' => 'approve', | |
'post_status' => 'publish' | |
) ); | |
?> | |
<?php if ( $comments ) : ?> | |
<ul> | |
<?php foreach( $comments as $comment ) : ?> |
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 | |
/** | |
* Control excerpt length. | |
*/ | |
function prefix_excerpt_length( $length ) { | |
return 20; | |
} | |
add_filter( 'excerpt_length', 'prefix_excerpt_length', 999 ); |
OlderNewer