Category: Wordpress Hacks

get_category_count()

September 21st, 2008

get_category_count() is a Wordpress function to count the posts within a category. It can probably be written in many different ways. Here is my version of the function and should be placed in functions.php in your theme.

Get Depth – like is_child() & is_grandchild()

September 7th, 2008

Is there a function in Wordpress to check the current page depth like is_child(), is_grandchild() or a number for unlimited depth? I could’nt find any so I created one.

Get ID by Page Name

September 2nd, 2008

The function converts a page name to a page ID. You can use it however you like but in the example I used it with the wp_list_pages() function.

Get Permalink by Name

September 2nd, 2008

If you have a post or a page and need the permalink for it there are serveral solutions. Here are one of them. I created a name to permalink converter called “Get Permalink by Name”.

get_the_content() WITH formatting

August 31st, 2008

Normally the get_the_content() tag returns the content without formatting. I found out a solution to make get_the_content() tag return the same content as the_content().

Get Category ID alternative

August 29th, 2008

Wordpress template tag the_category_id has been deprecated and their recommended method is a bit complicated if you only post in one category at the time. There comes a shorter alternative…

Get User Name

August 27th, 2008

Sometimes you might need to check if a current user is logged in or not within your theme. I have created a function to get the userdata as a returned string value.

Delete Post Link

August 25th, 2008

I have created a function called “Delete Post Link”. If you are logged in you will see a link which allows you to delete the current page or post, even without visiting admin.