Title: biochip's Replies | WordPress.org

---

# biochip

  [  ](https://wordpress.org/support/users/biochip/)

 *   [Profile](https://wordpress.org/support/users/biochip/)
 *   [Topics Started](https://wordpress.org/support/users/biochip/topics/)
 *   [Replies Created](https://wordpress.org/support/users/biochip/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/biochip/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/biochip/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/biochip/engagements/)
 *   [Favorites](https://wordpress.org/support/users/biochip/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Manager - Calendar, Bookings, Tickets, and more!] [categories_list] disappears on categories page paged](https://wordpress.org/support/topic/categories_list-disappears-on-categories-page-paged/)
 *  Thread Starter [biochip](https://wordpress.org/support/users/biochip/)
 * (@biochip)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/categories_list-disappears-on-categories-page-paged/#post-6467454)
 * not yet… I’m working on local machine.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Manager - Calendar, Bookings, Tickets, and more!] Diferent page desing for each category](https://wordpress.org/support/topic/diferent-page-desing-for-each-category/)
 *  Thread Starter [biochip](https://wordpress.org/support/users/biochip/)
 * (@biochip)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/diferent-page-desing-for-each-category/#post-6466214)
 * Ok, I think is resolved for me… I have the $categories_events variable to control
   some things in the template.
 *     ```
       global $EM_Category;
       $arrCategory = get_terms(EM_TAXONOMY_CATEGORY,array('parent'=>0,'hide_empty'=>0) );
       foreach($arrCategory as $arrterm) {
       	$child = get_term_children($arrterm->term_id,EM_TAXONOMY_CATEGORY);
       	foreach($child as $term_child_id) {
       		$term_child = get_term_by('id',$term_child_id,EM_TAXONOMY_CATEGORY);
       		if ( $term_child->name == $EM_Category->name ){
       			$categories_events = $arrterm->slug;					}
       }
       }//fi foreach
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Can’t exclude a category from the previous_post_link and next_post_link](https://wordpress.org/support/topic/cant-exclude-a-category-from-the-previous_post_link-and-next_post_link/)
 *  [biochip](https://wordpress.org/support/users/biochip/)
 * (@biochip)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/cant-exclude-a-category-from-the-previous_post_link-and-next_post_link/page/2/#post-1360776)
 * For me is working another way without hacking the core: Duplicating, renaming
   and hacking the functions involved to **functions.php** from your template.
 * Only need to insert “_2” to each function & the hack suggest by _vtxyzzy_ in 
   the “get_adjacent_post” function (our get_adjacent_post_2).
 *     ```
       function previous_post_link_2($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
       	adjacent_post_link_2($format, $link, $in_same_cat, $excluded_categories, true);
       }
       function next_post_link_2($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
       	adjacent_post_link_2($format, $link, $in_same_cat, $excluded_categories, false);
       }
       function adjacent_post_link_2($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
       	if ( $previous && is_attachment() )
       		$post = & get_post($GLOBALS['post']->post_parent);
       	else
       		$post = get_adjacent_post_2($in_same_cat, $excluded_categories, $previous);
   
       	if ( !$post )
       		return;
   
       	$title = $post->post_title;
   
       	if ( empty($post->post_title) )
       		$title = $previous ? __('Previous Post') : __('Next Post');
   
       	$title = apply_filters('the_title', $title, $post);
       	$date = mysql2date(get_option('date_format'), $post->post_date);
       	$rel = $previous ? 'prev' : 'next';
   
       	$string = '<a href="'.get_permalink($post).'" rel="'.$rel.'">';
       	$link = str_replace('%title', $title, $link);
       	$link = str_replace('%date', $date, $link);
       	$link = $string . $link . '</a>';
   
       	$format = str_replace('%link', $link, $format);
   
       	$adjacent = $previous ? 'previous' : 'next';
       	echo apply_filters( "{$adjacent}_post_link", $format, $link );
       }
       function get_adjacent_post_2($in_same_cat = false, $excluded_categories = '', $previous = true) {
       	global $post, $wpdb;
   
       	if ( empty($post) || !is_single() || is_attachment() )
       		return null;
   
       	$current_post_date = $post->post_date;
   
       	$join = '';
       	$posts_in_ex_cats_sql = '';
       	if ( $in_same_cat || !empty($excluded_categories) ) {
       		$join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
   
       //the hack
       if ( $in_same_cat ) {
          $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
          if ( !empty($excluded_categories) ) {
             $temp_excluded_categories = array_map('intval', explode(' and ', $excluded_categories));
             $new_cat_array = array_diff($cat_array, $temp_excluded_categories);
          }
          $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $new_cat_array) . ")";
       }
   
       		$posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";
       		if ( !empty($excluded_categories) ) {
       			$excluded_categories = array_map('intval', explode(' and ', $excluded_categories));
       			if ( !empty($cat_array) ) {
       				$excluded_categories = array_diff($excluded_categories, $cat_array);
       				$posts_in_ex_cats_sql = '';
       			}
   
       			if ( !empty($excluded_categories) ) {
       				$posts_in_ex_cats_sql = " AND tt.taxonomy = 'category' AND tt.term_id NOT IN (" . implode($excluded_categories, ',') . ')';
       			}
       		}
       	}
   
       	$adjacent = $previous ? 'previous' : 'next';
       	$op = $previous ? '<' : '>';
       	$order = $previous ? 'DESC' : 'ASC';
   
       	$join  = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_cat, $excluded_categories );
       	$where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories );
       	$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );
   
       	$query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort";
       	$query_key = 'adjacent_post_' . md5($query);
       	$result = wp_cache_get($query_key, 'counts');
       	if ( false !== $result )
       		return $result;
   
       	$result = $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
       	if ( null === $result )
       		$result = '';
   
       	wp_cache_set($query_key, $result, 'counts');
       	return $result;
       }
       ```
   
 * And the call in the template
 *     ```
       <div class="alignleft"><?php previous_post_link_2('%link', '<', TRUE,'3,10') ?></div>
       <div class="alignright"><?php next_post_link_2('%link', '>', TRUE,'3,10'); ?></div>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [language server problem wordpress 2.1.2](https://wordpress.org/support/topic/language-server-problem-wordpress-212/)
 *  Thread Starter [biochip](https://wordpress.org/support/users/biochip/)
 * (@biochip)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/language-server-problem-wordpress-212/#post-544674)
 * uops, it’s not working 4 me…
    but thank’s a lot!
 * any new idea?
 *   Forum: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
   
   In reply to: [Security problems for the folders with chmod 777](https://wordpress.org/support/topic/security-problems-for-the-folders-with-chmod-777/)
 *  Thread Starter [biochip](https://wordpress.org/support/users/biochip/)
 * (@biochip)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/security-problems-for-the-folders-with-chmod-777/#post-276719)
 * & for upload images from admin?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [“Internal Server Error”](https://wordpress.org/support/topic/internal-server-error-2/)
 *  [biochip](https://wordpress.org/support/users/biochip/)
 * (@biochip)
 * [21 years ago](https://wordpress.org/support/topic/internal-server-error-2/page/2/#post-129013)
 * The letters nc unites also cause the Internal Server Error, posting posts and
   comments.
 * How can I activate mod_security, or what can I do to solve the problem?
 * Thanak’s

Viewing 6 replies - 1 through 6 (of 6 total)