Custom Tab and Reorder Tabs conflict?

This topic contains 3 replies, has 2 voices, and was last updated by  Alex Rollin 6 years, 6 months ago.

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #436146

    Benjamin
    Full Member
    Post count: 67

    I can’t seem to get both a custom tab and reordering tabs to work, as shown on these pages:
    https://wpgeodirectory.com/add-a-new-tab-in-the-listing-detail-page/
    https://wpgeodirectory.com/re-order-tabs-in-a-listing-detail-page/

    When trying to use just one of them in my functions.php it works fine, and I can add a new tab or reorder existing tabs. Trying to reorder existing tabs AND have a custom tab added results in a fatal error though:
    “Fatal error: Cannot redeclare geodir_detail_page_tab_list_extend() (previously declared in /app/public/wp-content/themes/SWLTheme/functions.php:31) in /app/public/wp-content/themes/SWLTheme/functions.php on line 64”
    What code could I use to have both a new custom tab, and reorder the tabs so I can make the new tab first?

    #436155

    Alex Rollin
    Moderator
    Post count: 27815

    Make sure the snippets you use unique names for each function.

    You can also try using the code snippets plugin instead of placing them in functions.php

    https://wpgeodirectory.com/docs/useful-plugins/#snippets

    If you need help customizing snippets you can contact a GD Expert here:

    http://geodirectoryexperts.com

    #436249

    Benjamin
    Full Member
    Post count: 67

    Thank you for the guidance! I figured that I’d have to change the function name, but doing so still wasn’t working before. I’m not super well versed in Javascript yet so I missed the fact that the second part of the ‘add_filter’ section is the function name too, since the first and second sections within it were the same in the example. It now works when I have it set like this:

    // this is the snippet that adds the filter, calling the function below.
    add_filter(‘geodir_detail_page_tab_list_extend’, ‘geodir_detail_page_tab_list_reorder’) ;

    // this is the function that does the re-ordering that we call with the add filter snippet above.
    function geodir_detail_page_tab_list_reorder($tab_array)

    For reference, in case someone else needs it.

    May I suggest a change to one of the originally mentioned articles though? Personally it seems a little odd that two tutorials that should be compatible have conflicting functions like that.

    Thanks again!

    #436253

    Alex Rollin
    Moderator
    Post count: 27815

    Hey! Glad you got it working!

    We are all in luck because GDV2 has a totally new UI for re-rdering tabs and fields.

    Read more about it here: https://wpgeodirectory.com/geodirectory-v2-first-beta-release/

Viewing 4 posts - 1 through 4 (of 4 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