View cf7_remove_autop.php
<?php
// Remove auto p from Contact Form 7 shortcode output
add_filter('wpcf7_autop_or_not', 'wpcf7_autop_return_false');
function wpcf7_autop_return_false() {
return false;
}
View custom_post.php
<?php
// event.pt.php
/**
* Use namespace to avoid conflict
*/
namespace PostType;
/**
* Class Portfolio
View social_networks_share_urls.php
<?php
function chaoz_social_share() { ?>
<a href="https://facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="social_facebook"></i></a>
<a href="https://twitter.com/intent/tweet?text=<?php the_permalink(); ?>"><i class="social_twitter"></i></a>
<a href="https://www.pinterest.com/pin/create/button/?url=<?php the_permalink() ?>"><i class="social_pinterest"></i></a>
<a href="https://plus.google.com/share?url=<?php the_permalink() ?>"><i class="social_google_plus"></i></a>
<a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink() ?>"><i class="social_linkedin"></i></a>
<?php
}
View related_posts.php
View get_post_views.php
<?php
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 View";
}
return ($count/2).' Views';
View the_first_category_name.php
<?php
// Get the 1ast category link
function Chaoz_first_category_link() {
$cats = get_the_terms(get_the_ID(), 'category');
$cat = is_array($cats) ? get_category_link($cats[0]->term_id) : '';
echo esc_url($cat);
}
// Get the first category link
function Chaoz_first_category_link() {
View category_array.php
<?php
// Category array
function chaoz_cat_array($term='portfolio_cat') {
$cats = get_terms(array(
'taxonomy' => $term,
'hide_empty' => true
));
$cat_array = array();
$cat_array['all'] = esc_html__('All', 'gullu');
foreach ($cats as $cat) {
View comment_count.php
<?php
// Get comment count text
function prefix_comment_count($post_id) {
$comments_number = get_comments_number($post_id);
if($comments_number==0) {
$comment_text = esc_html__('No comment', 'chaoz');
}elseif($comments_number == 1) {
$comment_text = esc_html__('One comment', 'chaoz');
}elseif($comments_number > 1) {
$comment_text = $comments_number.esc_html__(' Comments', 'chaoz');
View wp_day_link.php
View limit_latter.php
<?php
// Limit latter
function prefix_limit_latter($string, $limit_length) {
if (strlen($string) > $limit_length) {
echo substr($string, 0, $limit_length) . '...';
}
else {
echo $string;
}
}