How to change the position of breadcrumb on the listing category page
There are two hooks which display the position of breadcrumbs:
- posttype_before_container_breadcrumb
- posttype _after_container_breadcrumb
Simply remove and add the hook according to the position of breadcrumb you want to display. Note: “posttype” will be the name of posttype. e.g. listing.
Use this code to remove breadcrumb:
remove_action(‘posttype_before_container_breadcrumb’,’ posttype_before_container_breadcrumb_callback’).
Use this code to add breadcrumb:
add_action(‘posttype_after_container_breadcrumb’,’ posttype_after_container_breadcrumb_callback’) function posttype_befor_container_breadcrumb(){ breadcrumb(); }
How to display additional information on listing category page?
On listing category page fields like “address, date, time etc” are the main information, if you want to display some additional information in this particular section you can use this hook:
do_action(‘posttype_post_info’); add_action(‘listing_post_info’,’templ_custom_listing_info’); function templ_custom_listing_info() { /*do whatever you want*/ echo “Message or text”; }
How to add more sorting options on category page .
Here’s the example code using which you can add a new sorting option on the category page:
add_action(‘tmpl_before_sortby_title_alphabetical,’ ‘tmpl_before_sortby_title_alphabetical_callback’); Function tmpl_before_sortby_title_alphabetical_callback (){ $exclude_arr = apply_filters('exclude_sorting_posttypes',array('event','property','classified')); if(!in_array(get_post_type(),$exclude_arr)){ $sort_post_type_name = 'tevolution'; } else{ $sort_post_type_name = get_post_type(); } $sel_sort_by = isset($_REQUEST[$sort_post_type_name.'_sortby']) ? $_REQUEST[$sort_post_type_name.'_sortby'] : ''; $sel_class = 'selected=selected'; if($sel_sort_by =='reviews'){ $selected =- $sel_class; } Return “<option value="reviews" ‘.$selected.’>Reviews</option>”; }
Note: This code is for “title_alphabetical “ is an existing sorting option, you can take this as an example to add your new sorting option.
So, these are different ways in which you can easily customize the listing category page on your Directory website.