Little adventures building sites with Wordpress…

Archive for the ‘coding’ Category

How To Control Your List of URL Links or Blogroll

leave a comment »

I read these resouces:

http://www.wpbeginner.com/wp-tutorials/how-to-organize-your-wordpress-blogroll-links/ which shows the actual example code that really works.

http://codex.wordpress.org/Function_Reference/wp_list_bookmarks which made me understand a little bit more of the parameters.

And I came up with these:


It works! I hope this is useful to you guys too! Cheerz!

Written by Yahya Ayob

March 14, 2011 at 1:16 am

Posted in coding, tutorial, WordPress

How to embed videos from Facebook into WordPress

leave a comment »

I’ve seen the embed code before but I just could not remember where. So I searched it again on the web and Shoutpedia has a facebook note that explains how you can embed videos from Facebook into a WordPress post.

I can’t seem to paste the code here. So check out Shoutpedia note in Facebook.

Hope this helps. That’s all. =)

Written by Yahya Ayob

January 7, 2011 at 8:11 pm

How to display post links from WordPress.com to WordPress.org blog

leave a comment »

I needed a way to show post links from my WordPress.com blog into my custom-designed WordPress.org site.

I was searching high and low on the web and finally I managed to read this post. Really help me to understand with his detailed explanation of using the code.

The trick is that if you are inserting this code in an already existing unordered list, it will not work and instead your site will give an error.

Just plainly insert the code without the unordered list


    Hope this helps! Cheerz!

Written by Yahya Ayob

December 6, 2010 at 11:24 am

Posted in coding, tutorial, WordPress

How to display post count from a category

with 4 comments

I am just recording my work right now. I found this to work really well.

function wt_get_category_count($input = '') {
global $wpdb;
if($input == '')
$category = get_the_category();
return $category[0]->category_count;
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->term_taxonomy.term_id=$input";
return $wpdb->get_var($SQL);
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->terms.slug='$input'";
return $wpdb->get_var($SQL);

Place above in your function.php file.

And then add below inside the regular php begin and end to any location you want the count to be displayed.
echo wt_get_category_count(categoryid);

Thanks to WPCode.net for the post here.

Written by Yahya Ayob

December 5, 2010 at 7:48 pm

Posted in coding, tutorial, WordPress

Reusable Code for Custom Categories/Post Template

leave a comment »

I was looking out for WordPress websites from Singapore and somehow this page got my attention. The codes should still be working as it should when creating templates for categories and posts.


Do check it out and see if this works at your side. Enjoy! =)

Written by Yahya Ayob

November 9, 2010 at 11:37 pm

Posted in coding, plugin, WordPress

How To Make WordPress More Social

leave a comment »

Written by Yahya Ayob

November 7, 2010 at 12:06 am

How To Allow Contributor User Role Upload Images

with 6 comments

One of the many questions people asked me is how do you allow a contributor in WordPress to upload images and files.

The Contributor User Role allows you to write a post and submit it for pending review by the Administrator to approve and publish. That’s by default and the big disadvantage here is that you don’t have the ability to upload images or files in the post.

There is a way. Add the following code to the file functions.php:

if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'allow_contributor_uploads');

function allow_contributor_uploads() {
$contributor = get_role('contributor');

That’s it. Now your Contributors should be able to upload images or files in the post and submit it for pending review.

Hope this helps. =D

Written by Yahya Ayob

November 2, 2010 at 7:18 am

Posted in coding, WordPress