Skip to content

Instantly share code, notes, and snippets.

Avatar
💙
👨‍💻

Łukasz Kliś lukaszklis

💙
👨‍💻
View GitHub Profile
@lukaszklis
lukaszklis / functions.php
Created Sep 21, 2011
Check if current post in the loop is a specified post type
View functions.php
<?php
/* Your functions.php content */
function is_current_post_type($post_type) {
global $post, $wpdb;
$current_post = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_type = '" . $post_type . "' AND ID = " . $post->ID);
return $current_post;
}