How to Remove srcset value that cause image not shown on WordPress

Have you guys able to experienced this problem, this actually happen after you activated your SSL certificate, in other words your site run on https url already. And you’re so happy because you already secured your website connection but found out that urrrrgh the images on your blog posts were broken and then viewed the codes on firebug and there’s a srcset value automatically added and the fact that you don’t have any idea why it was there. So here i found some solution on how to remove those srcset value on your image, hope this will work for you.

On your function.php file, simply add this code.

function crset_disable_srcset( $sources ) {
    return false;
}
 
add_filter( 'wp_calculate_image_srcset', 'crset_disable_srcset' ); 

How to add custom widget to WordPress

Adding widgets to your wordpress site is very simple and super easy. Which means that you can now customize the display of widgets on your wordpress site. WordPress widgets enable users to simply drag and drop elements into their site, and in this simple tutorial i will show you how to simply add custom widgets

First, add this codes to functions.php

if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Custom Widgets',
'id' => 'custom-widgets',
'description' => 'The Custom widgets for your website.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
}

Second, add the codes below to which the area you want the widget to display (eg. header.php)

<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Custom Widgets')) : 
endif; ?>

And that’s it, just navigate to your wordpress admin Appearance>>Widgets and you can see the Custom Widgets title on the dashboard.

How to display code snippet on wordpress blog

I found this best plugin that could be used for displaying code snippet into a wordpress blog. This is suitable for bloggers who are adding programming tutorials to their site. And so i recommend

Syntax Highlighter Evolved

Syntax Highlighter Evolved allows you to easily post syntax-highlighted code to your site without having to modify the code at all. It uses the SyntaxHighlighter JavaScript package by Alex Gorbatchev to do the highlighting and supports all of the package’s parameters via shortcode attributes.

Scroll To Top