if you need to limit the creator of posts in the number of selected categories to one then I have good news for you.
NOTE: This code just change checkbox to radio in category form and doesn't validate it in backend!
if you need to limit the creator of posts in the number of selected categories to one then I have good news for you.
NOTE: This code just change checkbox to radio in category form and doesn't validate it in backend!
/** * 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());
<?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');
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
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.
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.
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.
To move file we need to have file object. We can get it using file_load(fid) function wich need file id as argumnet
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:
Hi everybody, recently faced with the fact that you need to update thousands of aliases to content, taxonomy terms, and users.
Everything is good only if it did not have to do for Drupal 6.
The solution was found immediately.
Download and install the module and create three views_bulk_operations display.
The first and the second is the list of contents and a list of users, respectively. In the display settings set bulk operations and select "Update URL alias" and set to use the batch api.
But for taxonomy terms no field update paths aliases.