a blog about handmade code

wordpress

WordPress is web software you can use to create a beautiful website or blog. We like to say that WordPress is both free and priceless at the same time.

The core software is built by hundreds of community volunteers, and when you’re ready for more there are thousands of plugins and themes available to transform your site into almost anything you can imagine. Over 25 million people have chosen WordPress to power the place on the web they call “home” — we’d love you to join the family.

Getting categories for a post

For more control over the post's category, use wp_get_post_categories function. It is a simple solution than doing a custom query. It requies passing a post id and arguments. To understand the arguments read about it from wp_get_object_terms. For information see wp_get_object_terms at http://codex.wordpress.org/Function_Reference/wp_get_object_terms

Grabbing Custom Fields and Values

Getting the custom field can be fast. Here's an example.

Getting a Post Count in Wordpress

Finding the total post can be grueling. The easiest way is to find the post count from the query. Here's the code:

$total_post = $wp_query->post_count;

Read more about the wp_query at http://codex.wordpress.org/Class_Reference/WP_Query.

Using part of a Menu as aWidget or on the Page

Reusing the  primary, secondary, or just a menu as part of page, widget, or theme can be complex. With the Gecka submenu, you can pull part of the menu and reuse it somewhere else.

For example, you have the following menu:

  • About Us
  • Category
    • News
    • Entertainment
    • Events
  • Contact

You can pull just the submenu of category into the theme, widget, etc. This way you can have a submenu that is insync with your main menu.

Event Manager Extended Template and Theme Through PHP

I have installed Events Manager Extended and had issues with having the content layout exactly the same as ics file.  After a little research, I found a way to seperate the two contents.

Here's what I've been able to do:

  • Reformat the single events theme and layout using php
  • Display the events variable from the Events Manager
  • The Default single event format  in the admin will be the content format for the ics file

In your theme folder, open up page.php. Insert the following code.

Subscribe to RSS - wordpress
©2012 Tranzic Media / Portfolio of Vasna Sdoeung