Web Development Web Server WordPress

Certificates and Mixed Content Errors

When a secure (https enabled) website is displaying a caution on the certificate and warning about mixed content, you need to identify and correct the content on the page that is causing thje warning.

A good check is to  visit and enter the URL of the troublesome site.  It will quickly identify the elements – typically images – that need to be corrected.

If the images are on the same site you can usually just change http:// to https:// in the image URL, or alternatively remove the from the url of the image. If the image or element is on another site you can try changing the protocol to https, but you may have to bring the element onto your own site or live with the warning.  Just just accepting the warning is a bad idea because it caused your audience to lose confidence in your site.

Another good discussion of this with additional options can be found at ManageWP, it's worth a read.


Shortcodes in a WordPress Widget

By default, shortcodes don't work in WordPress widgets.  But a simple one-line code tweak will fix that.

Simply add the following line to functions.php.

add_filter('widget_text', 'do_shortcode');

For details, see the post below.





Must-Have WordPress Plugins

  • Custom Post Limits: This plug-in allows you to set different limits for the number of posts that appear on different pages.

Changing the Number of Search Results Displayed in WordPress

The number of search results displayed in a listing page in WordPress seems to be linked to the Settings > Reading > Blog pages show at most setting in the WordPress dashboard.

This can create a problem, because you likely want to have a greater number of search results displayed on a page than full posts displayed one above another.

If your template has a search.php page they you're in luck.

From your WordPress dashboard, select Appearance > Editor, then under Theme Files select Search Results (search.php). This will open up the search.php code for editing.

Look for the following line;

<?php if (have_posts()) : ?>

and place the following line above it;

<?php query_posts('showposts=20'); ?>

In my template it looked like this;

<div id="content">
<?php query_posts('showposts=20'); ?>
<?php if (have_posts()) : ?>

The number you assign to "showposts=" is, of course, up to you.

Modifying the number of results shown for a Categories listing seems to be a different kettle of fish. For me, as of WordPress 2.9.2, it's linked to the Blog pages show at most setting. Someday I'll figure it out. If you get there first, please leave a comment!


Default Sidebar Widgets in WordPress MU

The following plugin code, placed in the indicated directory, will set the default plugins for any MU blogs created after this plugin is installed. By examining the code you can see that sidebar-1 and sidebar-1 can be controlled separately.

If you don't wish to place anything by default in either of those two sidebars, simply omit any references to it.


function new_blogs_setting( $blog_id ) {
  add_option( 'widget_categories',array( 'title' =--> 'My Categories' ));
    "sidebar-1" =&gt; array("categories","links"),
    "sidebar-2" =&gt; array("tag_cloud"),
    "sidebar-3" =&gt; array("pages"),
    "sidebar-4" =&gt; array("archives")));
add_action('populate_options', 'new_blogs_setting');