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 thsi code into your theme functions.php | |
//Enable shortcode in text widget | |
add_filter('widget_text', 'do_shortcode'); |
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 this code into your theme functions.php file | |
function tt_change_excerpt_readmore_text( $more ){ | |
global $post; | |
return '… <a class="read-more" href="'.get_permalink($post->ID).'" title="'.esc_attr(get_the_title($post->ID)).'">'.'Continue Reading »'.'</a>'; | |
} | |
add_filter('excerpt_more', 'tt_change_excerpt_readmore_text'); |
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 this code into your theme functions.php file | |
add_filter('the_content', 'tt_featured_image_in_rss_feed'); | |
function tt_featured_image_in_rss_feed( $content ) { | |
global $post; | |
if( is_feed() ) { | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$prepend = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 10px;' ) ) . '</div>'; |
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 this code to your theme functions.php | |
// add a favicon | |
function tt_new_favicon() { | |
echo '<link rel="favicon" type="image/x-icon" href="https://www.yoursite.com/wp-content/uploads/2022/09/favicon.ico" />'; | |
} | |
add_action('wp_head', 'tt_new_favicon'); |
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 this code into theme functions.php file | |
if ( current_user_can('contributor') && !current_user_can('upload_files') ) { | |
add_action('admin_init', 'allow_contributor_upload_image'); | |
function allow_contributor_upload_image() { | |
$contributor = get_role('contributor'); | |
$contributor->add_cap('upload_files'); | |
} |
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 this code into your theme functions.php file | |
//step 1: change the admin login logo to the uploaded media image file | |
if ( !function_exists('tt_wp_admin_login_logo') ) : | |
function tt_wp_admin_login_logo() { ?> | |
<style type="text/css"> | |
body.login div#login h1 a { | |
background-image: url('https://www.yoursite.com/wp-content/uploads/2022/09/your-logo.jpg'); |
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 this code into your theme functions.php | |
add_filter( 'excerpt_length', function($length) { | |
return 20; //edit the number to the amount of words you want to show in your excerpts | |
}, PHP_INT_MAX ); |
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 this code into functions.php to disable search | |
function tt_filter_query( $query, $error = true ) { | |
if ( is_search() & !is_admin()) { | |
$query->is_search = false; | |
$query->query_vars['s'] = false; | |
$query->query['s'] = false; | |
// to error |
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 this code into functions.php to disable search | |
function tt_filter_query( $query, $error = true ) { | |
if ( is_search() & !is_admin()) { | |
$query->is_search = false; | |
$query->query_vars['s'] = false; | |
$query->query['s'] = false; | |
// to error |
NewerOlder