Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • <strike>Update: If you go to ‘Tools > Redirection > Modules’ and completely delete that WordPress module, it seems to fix the bug.</strike>

    Nevermind, that didn’t work really. Now you can’t create redirects… bah!

    Yup, I’m having the same issue on a couple of sites I work with. Anytime a new page or new custom post type is created (does not occur with new posts).

    A new row is added to the wp_redirection_items table where the ‘URL’ is ‘/’ and the ‘action data’ is the slug to the new page.

    Also, you can get the Root parent by adding this snippet to your functions.php:

    function get_root_parent($page_id) {
    global $wpdb;
    	$parent = $wpdb->get_var("SELECT post_parent FROM $wpdb->posts WHERE post_type='page' AND ID = '$page_id'");
    	if ($parent == 0) return $page_id;
    	else return get_root_parent($parent);
    }

    then use this in your template:

    $root_parent = get_root_parent($post->ID);

    adding a get_post() seems to make it work:

    <?php
    $current = $post->ID;
    $parent = $post->post_parent;
    $grandparent_get = get_post($parent);
    $grandparent = $grandparent_get->post_parent;
    
    echo 'current: '.$current.'<br />';
    echo 'parent: '.$parent.'<br />';
    echo 'grandparent: '.$grandparent;
    ?>

    I totally know what you mean robertm, I would like to see a way to class the current page number. I mean heck, even these forums do it:

    View screen grab: http://www.flickr.com/photos/2is3/2984968936/

    <p id="pages"><span class='page-numbers current'>1</span>
    <a class='page-numbers' href='/support/forum/3/page/2'>2</a>
    <a class='page-numbers' href='/support/forum/3/page/3'>3</a>
    <span class='page-numbers dots'>...</span>
    <a class='page-numbers' href='/support/forum/3/page/3298'>3298</a>
    <a class='next page-numbers' href='/support/forum/3/page/2'>Next &raquo;</a>
Viewing 5 replies - 1 through 5 (of 5 total)