Details page: How to move rating stars from sidebar to content area?

This topic contains 25 replies, has 5 voices, and was last updated by  Stiofan O’Connor 10 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #16047

    wu
    Free User
    Post count: 41

    Thanks, Stiofan.
    Is the favorite/unfavorite link contained in that list? Judging by the names, it does not look it is.
    Do you have a similar list for the tabs in the content section?
    I am referring to these elements: Profile, More Info, Reviews, …

    #16050

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    That is added via this hook,

    add_action('geodir_after_edit_post_link' , 'geodir_add_to_favourite_link',1) ;

    You can use remove_action to remove it…

    What is it u want to do with the tabs?

    #16057

    wu
    Free User
    Post count: 41

    What is it u want to do with the tabs?

    Mainly extracting the comments from the tabs and display them below the tabs, as I think that they deserve a more prominent placing.
    Also, I would like to reorder the tabs, as I want to have “More Info” as the first tab.

    #16090

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi wu,

    This is how you would remove the reviews tab:(not tested)
    EDIT: There is now an option in GD>design>details>Exclude selected tabs from detail page

    
    
    add_filter('geodir_detail_page_tab_is_display','geodir_detail_page_tab_is_display_filter',10,2);
    function geodir_detail_page_tab_is_display_filter($value,$type){
    if($type=='reviews'){return false;	}
    else{return $value;}
    }

    This is how you would add comments below tabs

    add_action( 'geodir_details_main_content', 'comments_template',65);

    this is how you would sort the tabs,

    
    
    add_filter('geodir_detail_page_tab_list_extend','geodir_detail_page_tab_list_extend_filter',10,1);
    function geodir_detail_page_tab_list_extend_filter($arr_tabs){
    // Do some sorting of the array, maybe user print_r($arr_tabs); to see what is available
    return $arr_tabs;
    }
    #16105

    amolin
    Buyer
    Post count: 161

    I also want add reviews below tabs, but your code

    add_action( 'geodir_details_main_content', 'comments_template',65);

    is not working for me and breaks the layout (the sidebar disappear)

    #16113

    wu
    Free User
    Post count: 41

    Moving the favorite button works for me, thanks.

    Moving the review section breaks the page for me as well.

    #16123

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    sorry i had not tested the code…

    Here is a tested veriosn…

    
    
    add_action( 'geodir_details_main_content', 'comments_template_change_position',65,5);
    function comments_template_change_position(){
    	echo comments_template();
    }

    Stiofan

    #16135

    wu
    Free User
    Post count: 41

    I did not test the ordering part yet, but moving the comments works for me. 🙂

    #16136

    wu
    Free User
    Post count: 41

    Moving the favorite button works for me, thanks.

    Oh, in Safari it seems to break the tabs. All tab contents are visible at once.

    #16232

    JSon
    Free User
    Post count: 22

    Hi, what I’m trying to acomplish is very similar to @wu. I have two things wanting to get clarify.

    #1. Moving the following elements to content area:

    1. Star Ratings
    2. Favorite/Unfavorite
    3. Business Info

    And removed above from sidebar.

    Issue: When moving elements altogether only one element takes effect and not all. For example when moving star rating and business info altogether only one appear in details page. It’s either/or and is not all.

    I have use provided codes as follow:

    
    
    
    /* Add Reviews Below Tabs */
    add_action( 'geodir_details_main_content', 'comments_template_change_position',65,5);
    function comments_template_change_position(){
    	echo comments_template();
    }
    
    // remove star rating from sidebar
    add_filter('geodir_detail_page_sidebar_content', 'geodir_detail_page_sidebar_content_order_myfix',10,1);
    
    function geodir_detail_page_sidebar_content_order_myfix($sort){
    	$elements_to_remove = array('geodir_detail_page_review_rating', 'geodir_add_to_favourite_link', 'geodir_detail_page_more_info');
    	$sort = array_diff($sort,$elements_to_remove);
    	return $sort;
    }
    // add star rating to top of main content
    add_action('geodir_details_main_content', 'geodir_detail_page_review_rating', 'geodir_add_to_favourite_link', 'geodir_detail_page_more_info');
    
    

    I have success adding comments below tabs and removed certain elements from sidebar but can not add wanted elements to content area.

    #2. I tried to rearrange tabs, however, it’s still showing profile tab as default. How to make other tab as default tab? For example, ‘more info’ tab as default.

    Thanks,
    Nak

    #16233

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Nak,

    You are using add_action wrong here is a link to how it should work… http://codex.wordpress.org/Function_Reference/add_action

    for example

    add_action(‘geodir_details_main_content’, ‘geodir_detail_page_review_rating’, 65);
    add_action(‘geodir_details_main_content’, ‘geodir_add_to_favourite_link’, 66);
    add_action(‘geodir_details_main_content’, ‘geodir_detail_page_more_info’, 67);

    the number at the end refers to the priority, so a priority 8 would lkely be at the top and priority 100 would be last.

    People in general struggle with hooks and filters, it’s not just you 🙂

    Stiofan

Viewing 11 posts - 16 through 26 (of 26 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount