Blog pagination goes to AB Themes website

Home Forums IncomeUp WordPress Theme Blog pagination goes to AB Themes website

This topic contains 17 replies, has 3 voices, and was last updated by  ab-themes 9 years, 2 months ago.

Viewing 8 posts - 11 through 18 (of 18 total)
  • Author
    Posts
  • #6295

    ab-themes
    Keymaster

    We fixed the permalinks, and 404 page seems to be working, but there is the issue of why the pagination sends you to 404 instead of your second page. We will try to sort this out asap and we’ll get back at you.

    #6296

    ab-themes
    Keymaster

    @julien_gal_78 Can you please open up a new topic? Thank you :)

    #6297

    strategiq
    Participant

    Thanks chaps

    #6320

    ab-themes
    Keymaster

    We still have some issue with the pagination, but we’ll try to fix this today, and we’ll get back to you.

    #6397

    strategiq
    Participant

    Hi guys, any news on this?

    #6412

    ab-themes
    Keymaster

    Hi!

    There is a fix, but it’s more a workaround than a fix. According to this entry, the removing of /category/ won’t improve your SEO results, that’s why originally it’s not working, because wordpress didn’t want to change the core files to accommodate that change.

    The fix you’ll need to do is to copy this code at the end of your functions.php file

    add_filter( 'category_rewrite_rules', 'vipx_filter_category_rewrite_rules' );
    function vipx_filter_category_rewrite_rules( $rules ) {
        $categories = get_categories( array( 'hide_empty' => false ) );
    
        if ( is_array( $categories ) && ! empty( $categories ) ) {
            $slugs = array();
            foreach ( $categories as $category ) {
                if ( is_object( $category ) && ! is_wp_error( $category ) ) {
                    if ( 0 == $category->category_parent ) {
                        $slugs[] = $category->slug;
                    } else {
                        $slugs[] = trim( get_category_parents( $category->term_id, false, '/', true ), '/' );
                    }
                }
            }
    
            if ( ! empty( $slugs ) ) {
                $rules = array();
    
                foreach ( $slugs as $slug ) {
                    $rules[ '(' . $slug . ')/feed/(feed|rdf|rss|rss2|atom)?/?$' ] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
                    $rules[ '(' . $slug . ')/(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
                    $rules[ '(' . $slug . ')(/page/(\d)+/?)?$' ] = 'index.php?category_name=$matches[1]&paged=$matches[3]';
                }
            }
        }
        return $rules;
    }

    And then you’ll need to flush your permalink settings. The way you do that is by going to Settings > Permalinks, and under Common settings select default and save those settings. Then set the permalinks to custom and add /%category%/%postname%/ in the input field. The category base is still just dot.
    Then save those permalink settings and now the pagination should be working.

    This is more of a hack than a fix however. If you ask us, we’d leave /categories/ in the link, since it’s not really hurting anyone :)

    Hope this helps :)

    #6420

    strategiq
    Participant

    Works perfectly, thanks guys for your help!

    #6446

    ab-themes
    Keymaster

    Happy to help :)

Viewing 8 posts - 11 through 18 (of 18 total)

The topic ‘Blog pagination goes to AB Themes website’ is closed to new replies.