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
// Add this to your wordpress themes functions.php to register widget with bootstrap's jumbotron styling | |
register_sidebar( array( | |
'name' => __( 'Featured below navigation', 'twentytwelve' ), | |
'id' => 'sidebar-featured', | |
'before_widget' => '<div class="jumbotron"><aside id="%1$s" class="container %2$s">', | |
'after_widget' => '</aside></div>', | |
'before_title' => '<h1>', |
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
<!-- add this code in page.php to display Next page and Previous page link below pages in WordPress | |
this will display next and previous page link not next previous post link | |
http://codex.wordpress.org/Next_and_Previous_Links#The_Next_and_Previous_Pages --> | |
<?php | |
$pagelist = get_pages('sort_column=menu_order&sort_order=asc'); | |
$pages = array(); | |
foreach ($pagelist as $page) { | |
$pages[] += $page->ID; | |
} |
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
// Open you functions.php file and paste the following code: | |
// Save the file and open your blog homepage to run the code. Once done, there’s no need to keep the code snippet in your | |
// functions.php file, as it will always delete all post revisions. So simply remove it. | |
// http://www.wprecipes.com/easily-delete-wordpress-post-revisions-using-your-fuctions-php-file | |
$wpdb->query( " | |
DELETE FROM $wpdb->posts | |
WHERE post_type = 'revision' | |
" ); |
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
// Source : http://wordpress.stackexchange.com/questions/1567/best-collection-of-code-for-your-functions-php-file | |
// unregister all default WP Widgets | |
function unregister_default_wp_widgets() { | |
unregister_widget('WP_Widget_Pages'); | |
unregister_widget('WP_Widget_Calendar'); | |
unregister_widget('WP_Widget_Archives'); | |
unregister_widget('WP_Widget_Links'); | |
unregister_widget('WP_Widget_Meta'); | |
unregister_widget('WP_Widget_Search'); | |
unregister_widget('WP_Widget_Text'); |
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
// Wordpress Custom Admin Footer | |
// customize admin footer text. Add this to functions.php | |
// Source http://wordpress.stackexchange.com/posts/6005/revisions | |
// Modified by Tahir Taous | |
// customize admin footer text Will be visible in Dashboard | |
function custom_admin_footer() { | |
echo 'Created By <a href="//tahirtaous.com/contact">Tahir Taous</a> '; | |
} |
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
// Source http://wordpress.stackexchange.com/posts/28530/revisions | |
// Tested and worked on WordPress 4.1 Beta | |
//REMOVE VERSION STRING FROM HEADER | |
remove_action('wp_head', 'wp_generator'); | |
//HIDE LOGIN ERROR MESSAGES (Wrong Password, No Such User etc.) | |
add_filter('login_errors',create_function('$a', "return null;")); | |
// Remove admin name in comments class | |
// Source: http://www.wprecipes.com/wordpress-hack-remove-admin-name-in-comments-class |
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
// Reference : https://www.cms2cms.com/blog/6-useful-yet-relatively-unknown-wordpress-functions/ | |
// add this code to sidebar.php or anywhere you want to display email addess | |
// remove <?php and ?> if you are going to paste this in functions.php | |
// Tested WordPress 4.1 Jan 25 2015 | |
<?php | |
$email = '[email protected]'; | |
echo 'You can contact me at ' . antispambot( $email ) . ' any time'; |
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
// Source: https://www.cms2cms.com/blog/6-useful-yet-relatively-unknown-wordpress-functions/ | |
// This function will generate something like this | |
// This post was published 2 weeks ago | |
// Tested : WordPress 4.1 | |
<?php | |
echo 'This post was published ' . human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' ago'; | |
?> |
OlderNewer