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 numeric pagination to your theme | |
* ------------------------------------------------------------------------- */ | |
function numeric_posts_nav() { | |
if( is_singular() ) | |
return; |
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 | |
// Let’s instantiate this class in our functions.php file: | |
if( is_admin() ) { | |
require 'simple_settings_page.php'; | |
new simple_settings_page(); | |
} |
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 | |
/* ---------------------------------------------------------------------------- | |
* Create custom WordPress dashboard widget | |
* ------------------------------------------------------------------------- */ | |
function dashboard_widget_function() { | |
echo ' | |
<h2>Custom Dashboard Widget</h2> | |
<p>Custom content here</p> | |
'; |
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 | |
/* ---------------------------------------------------------------------------- | |
* Remove default image sizes | |
* ------------------------------------------------------------------------- */ | |
function remove_default_image_sizes( $sizes ) { | |
/* Default WordPress */ | |
unset( $sizes['thumbnail'] ); // Remove Thumbnail (150 x 150 hard cropped) | |
unset( $sizes['medium'] ); // Remove Medium resolution (300 x 300 max height 300px) |
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 the support for your CPT in the widget activity of the admin dashboard | |
* ------------------------------------------------------------------------- */ | |
add_filter( 'dashboard_recent_posts_query_args', 'add_page_to_dashboard_activity' ); | |
function add_page_to_dashboard_activity( $query_args ) { | |
// Return all post types | |
$query_args['post_type'] = 'any'; | |
// Or return post types of your choice | |
// query_args['post_type'] = array( 'post', 'foo', 'bar' ); |
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 | |
/* ---------------------------------------------------------------------------- | |
* Change more excerpt | |
* ------------------------------------------------------------------------- */ | |
function custom_more_excerpt( $more ) { | |
return '...'; | |
} | |
add_filter( 'excerpt_more', 'custom_more_excerpt' ); |
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 | |
/* ---------------------------------------------------------------------------- | |
* Modify excerpt length | |
* ------------------------------------------------------------------------- */ | |
function custom_excerpt_length( $length ) { | |
return 25; | |
} | |
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); |
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 | |
/* ---------------------------------------------------------------------------- | |
* Switch default core markup to output valid HTML5 | |
* ------------------------------------------------------------------------- */ | |
add_theme_support( 'html5', array( | |
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', | |
) ); |
NewerOlder