get_adjacent_post not working
-
Hi,
Before I was using Polylang, I was using functions like:
get_adjacent_post
get_previous_post
get_next_postI use this in single custom posts to create navigation on the bottom of the page.
However, with Polylang activated the previous post can never be found, but the next post can.This is the creation of my custom post in functions.php:
// MY EXTRA POST TYPE (PORTFOLIO ITEM)
function create_portfolio_items_post_type () {
register_post_type(‘portfolio_items’,
array( ‘labels’ =>
array(
‘name’ => __(‘Portfolio Items’),
‘singular_name’ => __(‘Portfolio Item’),
‘add_new’ => __( ‘Add New Item’ ),
‘add_new_item’ => __( ‘Add New Item’ ),
‘edit’ => __( ‘Edit’ ),
‘edit_item’ => __( ‘Edit Portfolio Item’ ),
‘new_item’ => __( ‘New Portfolio Item’ ),
‘view’ => __( ‘View Item’ ),
‘view_item’ => __( ‘View Portfolio Item’ ),
‘search_items’ => __( ‘Search Portfolio Items’ ),
‘not_found’ => __( ‘No Portfolio Items Found’ ),
‘not_found_in_trash’ => __( ‘No Portfolio Items Found In Trash’ ),
‘parent’ => __( ‘Parent Item’ ),
),
‘supports’ => array(
‘title’,
‘editor’,
),
‘taxonomies’ => array(),
‘public’ => true,
‘description’ => ‘A portfolio item’,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘has_archive’ => true,
‘menu_position’ => 3,
‘menu_icon’ => ‘dashicons-format-video’,
‘rewrite’ => array(‘slug’ => ‘project’)
)
);
}
add_action(‘init’, ‘create_portfolio_items_post_type’);The page I need help with: [log in to see the link]
- The topic ‘get_adjacent_post not working’ is closed to new replies.