get_term_link stops rest of website from loading
-
I’ve been searching for the best part of a day on the forums but just cannot understand why this is happening…
I have created a “Portfolio” custom post in which I wish to insert posts under different categories (or “type” as I’ve called it). It’s a photography website and I currently have just two categories for testing purposes: “landscape” and “cityscape”. I want to put links to each post manually (i.e. outside of any loop) in a menu or on a page. I understand that I need to use the get_term_link() function but if I put the below in my menu then the page loads without any errors but only loads up until the third list item (where I use the get_term_link function). The forth list item does not display and, more strangely, if I click on the ‘home’ link the blog page does not load (page just reloads as is). If I remove the get_term_link item from the menu, the page loads completely and the ‘home’ takes me to the blog page as I would expect.
I have no idea why this is happening since I think the code is right — any help/suggestions would be very much appreciated!!
<div id="menu"> <ul id="menu"> <li><a>">Blog</a></li> <li><a>">Gallery</a></li> <li><a>">Landscapes</a></li> <li><a href="?page_id=13">Guide</a></li> </div><!-- #menu --> --------------------------------- //In function.php file... add_action('init', 'portfolio_register'); function portfolio_register() { $labels = array( 'name' => _x('Portfolio', 'post type general name'), 'singular_name' => _x('Portfolio Item', 'post type singular name'), 'add_new' => _x('Add New', 'portfolio item'), 'add_new_item' => __('Add New Portfolio Item'), 'edit_item' => __('Edit Portfolio Item'), 'new_item' => __('New Portfolio Item'), 'view_item' => __('View Portfolio Item'), 'search_items' => __('Search Portfolio'), 'not_found' => __('Nothing found'), 'not_found_in_trash' => __('Nothing found in Trash'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 5, 'supports' => array('title','editor','thumbnail'), 'has_archive' => true, ); register_post_type( 'portfolio' , $args );} register_taxonomy("Type", array("portfolio"), array("hierarchical" => true, "label" => "Type", "singular_label" => "Type", "rewrite" => true));
- The topic ‘get_term_link stops rest of website from loading’ is closed to new replies.