1st December 2016
Add this to your functions.php
function my_init()
{
if (!is_admin())
{
wp_deregister_script('jquery');
// Load a copy of jQuery from the Google API CDN
// The last parameter set to TRUE states that it should be loaded
// in the footer.
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', FALSE, '1.11.0', TRUE);
wp_enqueue_script('jquery');
}
}
add_action('init', 'my_init');
30th November 2016
Add this to functions.php
// Pick out the version number from scripts and styles
function remove_version_from_style_js( $src ) {
if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_version_from_style_js');
add_filter( 'script_loader_src', 'remove_version_from_style_js');
24th October 2016
Use the PHP in the query below – and then the HTML example below to echo the URL out.
the_post_thumbnail_url(); // without parameter -> 'post-thumbnail'
the_post_thumbnail_url( 'thumbnail' ); // Thumbnail (default 150px x 150px max)
the_post_thumbnail_url( 'medium' ); // Medium resolution (default 300px x 300px max)
the_post_thumbnail_url( 'large' ); // Large resolution (default 640px x 640px max)
the_post_thumbnail_url( 'full' ); // Full resolution (original size uploaded)
the_post_thumbnail_url( array(100, 100) ); // Other resolutions
6th October 2016
Add to functions.php
// REMOVE WP EMOJI
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
4th October 2016
30th September 2016
Add to functions.php file.
function ld_new_excerpt_more($more) {
global $post;
return '...';
}
add_filter('excerpt_more', 'ld_new_excerpt_more');
Add this to the functions.php file.
add_theme_support( 'post-thumbnails' );
Create a file named searchform.php and place this in the root of the theme folder. This will replace the default WordPress search form.
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
<input type="text" placeholder="<?php echo esc_attr_x( 'Search website...', 'placeholder' ) ?>"
value="<?php echo get_search_query() ?>" name="s"
title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>"/>
</form>
18th August 2016
Display taxonomy term name
Two functions that you can add to the functions.php file to show the taxonomy name with or without a link. Use the call attachedĀ to display this on the page.
17th August 2016
Get the current page ID and use that in the WordPress query to exclude that post from displaying.
<?php $currentID = get_the_ID();?>
<?php $args = array(
'post_type' => 'post',
'post__not_in' => array($currentID)
);
$query = new WP_Query($args);
$i = 1;
while ( $query->have_posts() ) : $query-> the_post(); ?>