How to get the the top-level parent of a custom taxonomy term?

Posted by Jessica Taylor | Updated on | WordPress


If you want to get the the top-level parent of a custom taxonomy term? The first function below, get_term_top_most_parent, accepts a term and taxonomy and returns the the term’s top-level parent (or the term itself, …

How to highlight search terms without plugin?

Posted by Jessica Taylor | Updated on | WordPress


Want to highlight search terms without plugin in WordPress? Use following code in your theme’s functions.php file OR in site specific plugin.

How to add class to anchors in WordPress menu?

Posted by Jessica Taylor | Updated on | WordPress


If you want to add class to anchors in WordPress menu? Use following code in your theme’s functions.php file OR in site specific plugin. To avoid using the WordPress menu UI to add classes to …

Showing custom taxonomy column in custom posts type listings

Posted by Jessica Taylor | Updated on | WordPress


In this example, I have share how to showing custom taxonomy column in custom posts type listings in WordPress. You can use the manage_post-type_custom_column and manage_edit_post-type_columns filters to add your taxonomy column to the post …

How to sort View results programmatically in Drupal?

Posted by Jessica Taylor | Updated on | Drupal


In this answer, I have shared how to sort View results programmatically in Drupal? The views module provides some hooks for ‘external’ manipulations, just like Drupal core. You can implement hook_views_pre_render(&$view) within a custom module …

How to remove the throbber from Drupal Ajax link?

Posted by Jessica Taylor | Updated on | Drupal


If you want to remove the throbber from Drupal Ajax link? Use the below custom Drupal code to remove the throbber from Drupal Ajax link. When you build your form item you need to define …

How to set Drupal Module Weight?

Posted by Jessica Taylor | Updated on | Drupal


Want to set Drupal Module Weight? Use the below custom code to set Drupal module weight. The standard way is to do it in a query in the install hook.

How to print a custom menu in Drupal 7?

Posted by Jessica Taylor | Updated on | Drupal


Want to print a custom menu in Drupal 7? Berdir answer is correct. Drupal 7 theme_links function also more vastly uses arrays. For example if you would like to add another class name to the …

Drupal Override Custom Menu Template

Posted by Jessica Taylor | Updated on | Drupal


In this example, I have shared Drupal Override Custom Menu Template. Use Drupal 7 uses theme_menu_link() instead of theme_menu_item().

Handle multiple submit buttons in Drupal form API

Posted by Jessica Taylor | Updated on | Drupal


IF you want to handle multiple submit buttons in Drupal form API? The best thing to do if you have two submit buttons on a form and want them to do different things, is to …

How to log error message in Drupal?

Posted by Jessica Taylor | Updated on | Drupal


Want to log error message in Drupal? You can use the watchdog function: Quoting the manual, the parameters are: $type The category to which this message belongs. $message The message to store in the log. $variables Array of variables to …

How to get the full URL of a Drupal page?

Posted by Jessica Taylor | Updated on | Drupal


If you want to get the full URL of a Drupal page? The drupal_get_destination() has some internal code that points at the correct place to getthe current internal path. To translate that path into an …

How to convert a String to an InputStream object in Java?

Posted by Jessica Taylor | Updated on | Java


How to convert a String to an InputStream object in Java? We can convert a String to an InputStream object by using the ByteArrayInputStream class. Use the below Java example to convert a String to …