Direct Links to pages

This topic contains 3 replies, has 3 voices, and was last updated by  hacaro 8 years, 10 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #39781

    will-wink
    Expired Member
    Post count: 33

    Hi, I’m looking to put direct links to some of the key pages in my geodirectory site. I’ve worked out the urls for adding a listing and adding an event, but i also wanted to create a link for “my events” and “my listings” (which would show all the listings i’ve added and all the events ive added) though i can only get the url when logged in as it requires the user role eg. my dashboard page is at: /author/admin/?geodir_dashbord=true&stype=gd_event

    Is there a way to create these 2 links so i can add them to a menu?, as a lot of people didn’t think it was obvious enough using the default widget where you have to select the drop down, thanks

    #39792

    Simone
    Expired Member
    Post count: 3515

    Hello, this is a dynamic url, the structure is

    author/admin/?geodir_dashbord=true&stype=gd_event

    for events, and as you can see it changes based on the username (in the example, you can see the admin)

    You can do that adding the following code in your functions.php

    
    
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_my_event' );
    
    function my_nav_menu_my_event($menu) {      
    global $wpdb,$current_user;
     get_currentuserinfo();
     $username= $current_user->user_login;
          if (!is_user_logged_in())
                    return $menu;
            else
    
                    $menuextra = '<li><a href="/author/' . $username . '/?geodir_dashbord=true&stype=gd_event">' . __('My Events') . '</a></li>';
                    
                                    $menuextra2 = '<li><a href="/author/' . $username . '/?geodir_dashbord=true&stype=gd_place">' . __('My Listings') . '</a></li>';
                    $menu = $menu . $menuextra . $menuextra2;
                    return $menu;
    }

    change gd_place or gd_event if your evnts/listings have a different post type name

    #39795

    will-wink
    Expired Member
    Post count: 33

    Hi thanks, though will that not add 2 links into the main menu? this wouldn’t really work as i’m using the ubermenu plugin and the width of the menu is already full of links. What i’m really wanting to do is have a widget that i can add in the sidebar which will contain 4 links (image or otherwise)

    • Add a Listing
    • Add an event
    • View my Listings
    • View my events

    and also where do i change the text that appears in the my dashboard widget – the one in the screenshot attached previously?, as i’d like to make it more simple to understand for some people, thanks again

    #43974

    hacaro
    Buyer
    Post count: 54

    have you found a solution ? i’m really intersted too.

    Thanks in advance

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