Some days ago I have a problem with my server and all my innodb tables were locked. And now I want to tell, how I tried to repair these tables.

First of all, I tried to do force recovery. In mysql config file enable force recovery. Set innodb_force_recovery = 1 and try to do mysqldump. If it not work, try to increase innodb_force_recovery value to 6. Default innodb_force_recovery value is 0. After you change innodb_force_recovery value, restart mysql.

Continue reading

With WordPress, you have the ability to create a network of sites (Multisite). This article is instructions for creating a network (multiple sites).

  1. First of all if you are running not fresh wordpress system, make back up off all you data.
  2. Open your config.php file and paste this above where it says /* That's all, stop editing! Happy blogging. */:
    <define('WP_ALLOW_MULTISITE', true);

    This allow to use multiple sites in your wordpress.

  3. Now install a network. Go to Administration > Tools > Network. Enter all required data ant press install.
    • Back up your old wp-config.php and .htaccess files.
    • Create blogs.dir directory in folder wp-content/
    • Add extra lines to your wp-config.php and replace your .htaccess file rules with new once. These rules are dinamically generated on your network configuration page.
    • Now log in again to system.

More information about this you can find in http://codex.wordpress.org/Create_A_Network.

To add class to wordpress wysiwyg editor copy this php code to your theme function.php file

if ( ! function_exists('tdav_css') ) {
	function tdav_css($wp) {
		$wp .= ',' .get_bloginfo('stylesheet_directory') . '/style_css.css';
	return $wp;
	}
}
add_filter( 'mce_css', 'tdav_css' );

Here you add new style file. In this file create your new css classes. Now go to wysiwyg editor and there you will see your created classes. Use them for table or links. 🙂

Sometimes we need to get depth of posts or pages in wordpress. Now you can do it easy with function


function getDepth($id = '', $depth = '', $i = 0)
{
 global $wpdb;
 global $post;
 if($depth == '')
 {
 if(is_page())
 {
 if($id == '')
 {
 $id = $post->ID;
 }
 $depth = $wpdb->get_var("SELECT post_parent FROM $wpdb->posts WHERE ID = '".$id."'");
 return getDepth($id, $depth, $i);
 }
 }
 elseif($depth == "0")
 {
 return $i;
 }
 else
 {
 $depth = $wpdb->get_var("SELECT post_parent FROM $wpdb->posts WHERE ID = '".$depth."'");
 $i++;
 return getDepth($id, $depth, $i);
 }
}

Copy function getDepth() in your function.php file. Call it from your template, for example <?php echo getDepth($post_ID);?>

and it will return your post depth in your site.

Try, I hope it will help you.

Sometimes it happens that working with WordPress, we need to get children off current page. There is a fairly simple decision to do this. We can use the WordPress function get_pages (). Here is the code example of how this can be done.

<? $pages = get_pages('child_of='.$post->ID.'&sort_column=post_title');
		?>
		<ul><?
		foreach($pages as $page)
		{ ?>
			<li class="page_item"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></li>
		<?php
		}
?></ul>

In this example we get page title and page link.

Sometimes it is necessary to have page content in WordPress. This can be done quite easily. Use this code

 
 $pageId = 68;

			global $wpdb;
			$sql_query = 'SELECT DISTINCT * FROM ' . $wpdb->posts .
			' WHERE ' . $wpdb->posts . '.ID=' . $pageId;
			$posts = $wpdb->get_results($sql_query);
			if(!empty($posts))
			{
				foreach($posts as $post)
				{
					print_r(nl2br($post->post_content)); 
				}
			}

There $pageId, use your page ID, which content you want to see.

Sometimes, creating a two levels menu and adding to site content embed video, submenu disappear under embed videos. A possible solution is add wmode=”opaque”. But what happens when we’re adding embed video dynamically, or we need to change dynamically all embed wmode to opaque. In this case, the possible use of jQuery library, and this script:

$(document).ready(function() {
 var embedTag;
 $(".youtube embed").each(function(i) {
 embedTag = $(this).attr("outerHTML");
 if ((embedTag != null) && (embedTag.length > 0)) {
 embedTag = embedTag.replace(/embed /gi, "embed wmode=\"opaque\" ");
 $(this).attr("outerHTML", embedTag);
 }
 });

Use this for firefox:

$('.youtube embed').attr('wmode','opaque');

Now give for submenu position:relative and indicate z-index (for example z-index:999) to show the submenu above this EMBED video.

There is a posibility to add transparency background with RGBa. You can use this for anything that can take the CSS color property. For example background: rgba(255, 255, 255, 0.5);. 0.5 is alpha. This property works in Firefox, Safari, Chrome, Opera, but nor in IE.

IE uses the syntax filter:alpha(opacity=50). The lower value of this makes the element more transparent.

For example:

.myclass
{
background:#000000;
filter:alpha(opacity=50);
}

There will be black background with 50% transparency.

Creating, editing and deleting the user account is an important thing in any CMS. We can easily manage user in wordpress sites too. There are a lot of plugins which helps us create User profile and manage there profile.

But in wordpress deleting User from wordpress is not easy. Here in this article we will show how can we easily delete the user account without administrator permission.

Using following wordpress plugin we can achieve this functionality.

User Self Delete

This plugin will allow your users to delete their own account without any need for interaction on the administrator’s behalf.

When user want to delete their account, they are taken to page where they must enter the word “yes” . Once they type “yes” and press the delete account button, they are redirected to the login page and they no longer exist as a user in site.