• I’m converting a site from static HTML to WP and ran into this issue that has me completely stumped. I have two custom post types, news and games:

    register_post_type( 'cw_games', array(
    	'labels' => array( #various labels# ),
    	'supports' => array('title', 'editor', 'thumbnail'),
    	'public' => true,
    	'rewrite' => array('slug' => 'games', 'with_front' => false),
    	'menu_position' => 5,
    ));
    register_post_type( 'cw_news', array(
    	'labels' => array( #various labels# ),
    	'supports' => array('title', 'custom-fields'),
    	'public' => true,
    	'rewrite' => array('slug' => 'news', 'with_front' => false),
    	'menu_position' => 7,
    ));

    Because the current CPT implementation (as of 3.0.4) does not provide archive pages, I’m using this plugin https://www.thinkoomph.com/plugins-modules/wordpress-custom-post-type-archives/ The archive (overview) pages are implemented as type-cw_news.php and type-cw_games.php. Because it’s a multilingual site, I’m also using the qTranslate plugin https://www.qianqin.de/qtranslate/

    Almost everything works fine – except that on the news page, paginate_links() returns NULL (tested with gettype) even when run with defaults (no args). posts_nav_link() works fine and allows me to page through the news posts. And here is the next weird thing: On every following page (page# >=2), the language selector on top, which should always point to the equivalent page in another language, returns e.g. cywee.com/cn when it should be sth like cywee.com/cn/news/page/2/ Notice also the missing slash at the end of the URL. It normally ends every URL with a slash, even the homepage would be cywee.com/cn/.

    The strange thing is that pagination with paginate_links() and the language selector both work perfectly fine on games, even on pages >= 2. But both are set up almost identically: registration, template file, the way the Loop is set up. I even reduced the type-cw_news.php file to get_header(); get_footer(); because that’s where the language selector is and it still gives me the broken links if I manually type in a paged URL.

    I think paginate_links() returning NULL and the language selector issue may be related, but I can’t figure out what could possibly be wrong. Any ideas?

    Welcome to check out the site, URLs above.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘paginate_links() returns NULL more’ is closed to new replies.