Load all category posts in one template with format ‘posts-of-category-CatSlug’

To load all the category posts in same template file add the below hook to functions.php file :

function load_cat_parent_template(){
global $post;
$catsArr = array(‘posizioni-aperte’);
$cat = get_the_category($post->ID);
$template = TEMPLATEPATH . “/posts-of-category-“.$cat[0]->slug.”.php”;
load_template( dirname( __FILE__ ) . “/child-of-category-“.$cat[0]->slug.”.php” );


Add page parent class to subpage parent page in nav menu

To add class current to current sub page parent in top nav menu or any other nav menu add the below hook to functions.php file:

function add_class_to_wp_nav_menu($classes){
global $wp_query;
$post = $wp_query->post;
$pageMenuID = $post->post_parent;
$menu_items = wp_get_nav_menu_items(‘top menu’);
foreach($menu_items as $page) {
if( $page->post_parent == $pageMenuID){
$currentMenuItem = $page->ID;
$parentArr = get_page_by_path(‘lavora-con-noi’);
if( $page->post_parent == $parentArr->ID){
$currentMenuItem = $page->ID;

// add the current page class to a specific menu item (replace ###).
if (in_array(‘menu-item-‘.$currentMenuItem, $classes)){
$classes[] = ‘current-menu-item current_page_parent’;
return $classes;

Stop WordPress from adding p tags and removing line break

The hook to keep line break and  convert newline characters to BR tags “<br/>” also keep the redundant BR tags like “<br/> <br/>”  in editor of wordpress, just add the below hook in functions.php :


function tinymce_config( $init ) {
// Don’t remove line breaks
$init[‘remove_linebreaks’] = false;
// Convert newline characters to BR tags
$init[‘convert_newlines_to_brs’] = true;
// Do not remove redundant BR tags
$init[‘remove_redundant_brs’] = false;
// Pass $init back to WordPress
return $init;
add_filter(‘tiny_mce_before_init’, ‘tinymce_config’);


Add custom fields to registration form in Joomla

Finally after long time of search for a solution in how to add custom fields to registration form in Joomla i think there where no solution except change in main core of  joomla but i created a solution by myself i hope it can help you:

1- Download the Chronoforms_V4_RC3.5.2.5_J3.0 Joomla componant from here

2- create a Custome Form you want to be your registration form and click on Forms manger to show the link for front end view

3- Now you need to add the custome field to Database as columns to add the data in form this can do by open database then the users tabel(#__users) and add the fields you need and its type

4- now all you need to add data to 2 tables in database (#__users) and (#__user_usergroup_map ) and you can do this by add some lines of code to 2 functions in the plugin as following:

4.1- open the file : <You project Work space >/components/com_chronoforms/libraries/chronoform.php

4.2-(Note: if you want to add Password Field only use this point) Search for function _set_form_data() add the following lines of code if you want to add password as it is encrypted by MD5 + salt:

/* * Start */

$salt = JUserHelper::genRandomPassword(32); $crypt = JUserHelper::getCryptedPassword($this->data[“password”], $salt); $password = $crypt . ‘:’ . $salt; $this->data[“password”] = $password; /* * End */ 4.3- Search for function process($event = null) and add the following code after the line “$return = $this->_processEvents($event, $events[‘events’]);” /* * Start */ $db =& JFactory::getDBO(); $query = “INSERT INTO `#__user_usergroup_map` (user_id,group_id) VALUES (‘”.$this->data[“chronoform_data”][“id”].”‘, 2)”; $db->setQuery( $query ); $db->query();

/* * End */

Reorder Menu Item In WordPress Admin

You can reorder the Admin menu items in wordpress in 2 cases as following:

1- Current Menu Items:

You can reorder current menu items by Adding the following function to wp-content/themes/Your Theam Folder/functions.php:

   function custom_menu_order($menu_ord) {
       if (!$menu_ord) return true;
       return array(
        'index.php', // this represents the dashboard link
        'edit.php', //the posts tab
        'upload.php', // the media manager
        'edit.php?post_type=page', //the posts tab
   add_filter('custom_menu_order', 'custom_menu_order');
   add_filter('menu_order', 'custom_menu_order');

2- Custome Menu Items Created by Hooks (Add New Menu Item In WordPress Admin):

Add New Menu Item In WordPress Admin

You can add Menu Items to admin in wordpress without use a plugin by using Hooks as following:

1- The function you will use For Menu Item is “add_menu_page();”


add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );


For more details about Function param visit: Add Menu Wordpress Codex

2-  The function you will use For SubMenu Item is “add_submenu_page();”


add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );


For more details about Function param visit: Add Submenu Wordpress Codex


*   Example for menu & submenu Items:

function my_menu_pages(){
add_menu_page(‘My Page Title’, ‘Homepage’, ‘manage_options’, ‘cat9’, ‘my_menu_output’,’/wp-admin/images/generic.png’,’4.1′);
      add_submenu_page(‘cat9’, ‘Homepage Slides’, ‘Homepage Slides’, ‘manage_options’, ‘edit.php?cat=20’);

add_action(‘admin_menu’, ‘my_menu_pages’);


* End


Blackberry shows a battery with a red X

Belive me i can tell you how to fix it with my Curve 8900, that means ur phone is not conecting with the battery, just drop the phone on a carpeted floor face ear side up of course. I know it sounds crazy but it works u must jar it up. don`t drop it any higher than 3 feet. try it a couple of times until it starts chargeing and then once it charges cut it on i promise try it.