HTML and CMS blog

Drupal 8 Release Party in Kharkiv, Ukraine

We are excited to announce Drupal 8 Release Party in Kharkiv, Ukraine.

The day is finally here: Drupal 8 release will be launched on November 19, 2015!

Join us to play bowling for free with Kharkiv Drupal developers, and let’s raise a glass to the many contributors who made this release happen.

We’ve got limited space, so please register in the form below if you’re planning to attend. (We promise we won’t spam you late).

Your first drink is on HTML and CMS. We look forward to seeing you there!

by coordinator Tags: drupal 8, drupal 8 party
Fix missing body images when site moved in subdirectory
/**
 * When site move to subdirectory, pictures, added in WYSIWYG, return old address
 * this small js fix it.
 */

(function($){
  $(document).ready(function() {
  
    if (Drupal.settings.basePath != '/') {
      $("body.page-node article .entry-content img").each(function() {
        var src = $(this).attr('src');
        $(this).attr('src', Drupal.settings.basePath + src);
      });
    }
  });
})(jQuery.noConflict());
by Anonymous Tags: Drupal, jQuery
Add numerious for each wordpress widget in sidebar
<?php
/**
 * Add numerious for each widget in sidebar
 */
function htmlandcms_widget_classes($params) {
  static $classes;
  if (!isset($classes[$params[0]['id']])) {
    $classes[$params[0]['id']] = 1;
  } else {
    $classes[$params[0]['id']] += 1;
  }
  $params[0]['before_widget'] = "<div id='{$params[0]['id']}-{$classes[$params[0]['id']]}'>" . $params[0]['before_widget'];
  $params[0]['after_widget'] = $params[0]['after_widget'] . "</div>";
  return $params;
}
add_filter('dynamic_sidebar_params', 'htmlandcms_widget_classes');

by Anonymous Tags: Wordpress
Custom rewrite rules with pagination in wordpress

Sometimes we need to use $_GET params in custom pages for something like custom filter.
In my case i must create page with custom query_posts, filter this posts and glossary. In glossary links must look like site.com/glossary/a/ or site.com/glossary/b/

First we need to create page with slug 'glossary' and set permalink to Post name.
In theme directory copy page.php to page-glossary.php and put this code

by Anonymous Tags: Wordpress, rewrite
Add rel="fancybox" to wordpress gallery

If you need to add rel="fancybox" in the standard wordpress gallery, then this is a lesson for you.
Firstly what we need to do, its enqueue fancybox script, add image sizes for thumbnail and big picture and change implementation of gallery shortcode by default.
So let's do it.

by Anonymous Tags: Wordpress, gallery, fancybox
How to create easy antibot registration module for Drupal 7

Any project should be protected from automatic registration, One of wellknown solutions is using CAPTCHA.  There are a lot of kinds of CAPTCHA and most part of them were designed for very big projects wich could be affected by directed spam attack of competitors or other "enthusiasts". On simple sites which are not as famous as facebook or twitter we don't need such difficult protection. 

by Anonymous
Wordpress random comment with link to post

Task to show random comment with link to post. The decision below. First we get all approved comments. If we have comments we get random number among of existing, then we print comment content, and put link to commented post. Thats all, we spent some time to do it and we hope our solution will be useful for you.   

by coordinator
How to save pdf file in public files directory in drupal 7

Sometimes we need to save pdf file in directory. In drupal for this purpose we can use print-email-pdf module wich give us pdf file when we follow url  yoursite.com/printpdf/nid. We can easily grab the content of this file using file_get_contents() function. You should look at code example:

by Anonymous Tags: Drupal

Pages