Archive for the ‘wordpress’ Category

wordpress | No Comments | March 18th, 2011

I can’t upload .3gp to wordpress.
Solution:
Edit wp-includes/functions.php,
search for:
1
‘mp4|m4v’ => ‘video/mp4′,
add a line after it:
1
‘3gp’ => ‘video/3gpp’,
Done!
You may want to add other filetypes you also enjoy here.

wordpress | No Comments | November 20th, 2010

show the subcategories for a given category on it’s category page .Basically you need to check whether there are any children, and if there are, list the categories with the current category as a parent or grandparent. The following code does just that:

if (is_category()) {
  $this_category = get_category($cat);
  if (get_category_children($this_category->cat_ID) != "") {
    echo "<h1>Subcategories</h1>";
    echo "<ul>";
    wp_list_categories('orderby=id&show_count=0&title_li=
&use_desc_for_title=1&child_of='.$this_category->cat_ID);
    echo "</ul>";
  }
}

wordpress | No Comments | September 10th, 2010

After my latest WordPress update (which as a manual one, with a whole lot of  mysql issues!) I finally got my blog up and running again, only to find all my apostrophes appearing as “â€TM” –stupid junk characters. After going into panic mode for about two minutes, I figured out the solution, at least in my case.
It was quite simple, jump in my wp-config, and comment out two lines.
# define(‘DB_CHARSET’, ‘utf8?);
# define(‘DB_COLLATE’, ”);
And just like that, all was normal again. Hope this helps someone.

After my latest WordPress update (which as a manual one, with a whole lot of  mysql issues!) I finally got my blog up and running again, only to find all my apostrophes appearing as “â€TM” –stupid junk characters. After going into panic mode for about two minutes, I figured out the solution, at least in my case.

It was quite simple, jump in my wp-config, and comment out two lines.

# define(‘DB_CHARSET’, ‘utf8?);

# define(‘DB_COLLATE’, ”);

And just like that, all was normal again. Hope this helps someone.

wordpress | No Comments | February 1st, 2010

just add this

<?php wp_get_archives(‘title_li=&type=postbypost&limit=10′); ?>

it will add title with link inside <li></li>

wordpress | No Comments | January 26th, 2010

Add this function to function.php file

function getImage($num) {
global $more;
$more = 1;
$link = get_permalink();
$content = get_the_content();
$count = substr_count($content, ‘
$start = 0;
for($i=1;$i<=$count;$i++) {
$imgBeg = strpos($content, ”);
$postOutput = substr($post, 0, $imgEnd+1);
$postOutput = preg_replace(‘/width=”([0-9]*)” height=”([0-9]*)”/’, ‘/width=”117″ height=”68″/’,$postOutput);
$postOutput = preg_replace(‘/alignright/’, ‘alignleft’,$postOutput);

$image[$i] = $postOutput;
$start=$imgEnd+1;
}
if(stristr($image[$num],’‘.$image[$num].”“; }
$more = 0;
}

and call it as where you want to show image <?php getImage(‘1′); ?>  .. inside loop.