This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Turn on logging for dev environment | |
define('WP_DEBUG', true); // or false | |
define('WP_DEBUG_LOG', true); | |
@ini_set('display_errors',0); | |
// Add debugging display on demand through a get variable | |
if ( isset($_GET['debug']) && $_GET['debug'] == 'debug') : | |
define('WP_DEBUG_DISPLAY', true); | |
else : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('nav_menu_link_attributes' , 'att_add_menu_id', 3, 10); | |
if ( !function_exists( 'att_add_menu_id') ) { | |
function att_add_menu_id($atts, $item, $args) { | |
if( 'page' == $item->object ){ | |
$id = $item->object_id; | |
$id = 'page-'. esc_attr( basename( get_permalink( $id ) ) ); | |
$atts['id'] = $id; | |
} | |
return $atts; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( 'posts' == get_option( 'show_on_front' ) ) { // if user has selected posts to show on the front page | |
include( get_home_template() ); // use a post enabled home page template | |
} else { | |
// Custom static front-page markup goes here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function post_wordcount($postid) { | |
$content = get_post($postid); | |
$completContent = $content->post_content; | |
$wordsCount = count(explode(" ", $completContent)); | |
return $wordsCount; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function simplePostsCounter($type, $status) { | |
if($type == '') {$type = 'post';} | |
if($status == '') {$status = 'publish';} | |
$foundResults = wp_count_posts($type); | |
return $foundResults->$status; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function posts_in_term($catid, $taxonomy) { | |
$term_query = get_term($catid, $taxonomy); | |
return $term_query->count; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function count_posts_by_user($userID) { | |
$userposts = get_posts('showposts=-1&author='.$userID); | |
return count($userposts); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function count_user_comments($user_email) { | |
$args = array( | |
'author_email' => $user_email | |
); | |
$user_comments_count = get_comments( $args ); | |
return count($user_comments_count); | |
} |
OlderNewer