Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • iwanttobelieve

    (@iwanttobelieve)

    I have safe mod turned on too, but that fixes my problem. I don’t have any idea if WP Total Cache might interfere with it. Btw, you are installing two minifying plugin at the same time o.o?

    This is caused by the b=wp/ GET var. In order to fix this, you can:

    1. specify b=wp in “Extra arguments to pass to minify engine” in the Setting Pages of WP Minify

    2. Open wp-minify.php and find get_base_from_siteurl(), change the first line to $site_url = get_option(‘siteurl’);

    The author should fix this ??

    Thread Starter iwanttobelieve

    (@iwanttobelieve)

    Thank you!

    The new version has also fixed this issue, excellent work!

    It actually depends on your installation, however that should be fine in most cases. You can either put them both in functions.php or filter in functions.php and add_filter in template, it will work :).

    First of all, in order to make this work, you must hack into the core file wp-includes/link-template.php. Find $posts_in_ex_cats_sql = “AND tt.taxonomy = ‘category'”; and change it to: $posts_in_ex_cats_sql = ”; It’s not that we can’t create a filter, it’s just too troublesome to do so, trust me. Also, this filter is designed for ppl who don’t have excluded_categories, if you have, tell me and I will provide another filter.

    Okay, we need 1 filter, assuming that you have already been familiar with creating plugin, I will just post the filter, ok?

    function get_custom_adjacent_post_join($join, $in_same_cat)
    		{
    			global $post, $wpdb;
    
    			// we don't process empty post and default post types
    			if (empty($post) || in_array($post->post_type, array('post', 'page', 'attachment', 'revision', 'nav_menu_item')))
    				return $join;
    
    			// here we specify custom post types and their corresponding taxonomies
    			$taxonomies = array(
    				'your_custom_post_type'	=> 'your_taxonomy'
    			);
    
    			$current_taxonomy = $taxonomies[$post->post_type];
    
    			if ($in_same_cat) {
    			$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";
    
    			if ( $in_same_cat ) {
    				$cat_array = wp_get_object_terms($post->ID, $current_taxonomy, array('fields' => 'ids'));
    				$join .= " AND tt.taxonomy = '$current_taxonomy' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
    			}
    			}
    			return $join;
    		}

    In somewhere of your plugin, type:
    add_filter(‘get_previous_post_join’, ‘get_custom_adjacent_post_join’, 10, 2);
    add_filter(‘get_next_post_join’, ‘get_custom_adjacent_post_join’, 10, 2);

    Please note this line:
    $taxonomies = array(‘your_custom_post_type’ => ‘your_taxonomy’);

    If you would like a movie post type and a Director as taxonomy, you would change it to:
    $taxonomies = array(‘movie’ => ‘director’);
    In case you need to add more, simply add another item for that array.

    Hope that will help!

    I think I have found the solution, it looks like WordPress developers didn’t add a custom post type check to get_adjacent_post. We might get around using filter fortunately. If anyone’s interested I will post the filter.

    I have to second this, I can’t make this to work either. When I turn on the debug, there’s an SQL error reported by WordPress made by those two functions. The feed does not list items having custom post type either…

    Thread Starter iwanttobelieve

    (@iwanttobelieve)

    Hmm, now it works perfectly. Maybe there’s something wrong in my part. Thanks for replying!

    Thread Starter iwanttobelieve

    (@iwanttobelieve)

    Yes, I love the way this plugin works. I will wait for your update then. Thanks for replying!

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