My listings Link

This topic contains 3 replies, has 2 voices, and was last updated by  Giri 7 years, 11 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #206070

    Sara Graybill
    Buyer
    Post count: 18

    Is there a link or shortcode I can use to create a link to the My Listings page? I don’t really want to use the sidebar widget, I’d like to include the link in the page content.

    #206080

    Giri
    Expired Member
    Post count: 3155

    Hello Sara, As far as I know we don’t have any existing shortcode to display my listing link.

    But don’t worry. I have created one for you. just place this in your child theme and then use this shortcode in your editor.

    [gd_my_listings_link]
    
    
    function gd_add_my_listings_sc($atts) {
        $defaults = array(
            'stype' => 'gd_place',
        );
    
        $params = shortcode_atts($defaults, $atts);
        if (is_user_logged_in()) {
            global $current_user;
    
            $author_link = get_author_posts_url($current_user->data->ID);
            $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
            $listing_link = geodir_getlink($author_link, array('stype' => $params['stype']), false);
            $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $params['stype'], $current_user->ID);
            return $listing_link;
        }
        return "";
    }
    add_shortcode('gd_my_listings_link', 'gd_add_my_listings_sc' );

    Let me know how that goes.

    #206089

    Sara Graybill
    Buyer
    Post count: 18

    Thank you! That placed the link on the page but didn’t make it clickable. You can see it here: http://utilitymarketconnections.com/dev/user-dashboard/

    How do I make it a clickable link?

    #206098

    Giri
    Expired Member
    Post count: 3155

    Hope this works for you

    
    
    
    function gd_add_my_listings_sc($atts) {
        $defaults = array(
            'stype' => 'gd_place',
        );
    
        $params = shortcode_atts($defaults, $atts);
        if (is_user_logged_in()) {
            global $current_user;
    
            $author_link = get_author_posts_url($current_user->data->ID);
            $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
            $listing_link = geodir_getlink($author_link, array('stype' => $params['stype']), false);
            $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $params['stype'], $current_user->ID);
            return '<a href="'.$listing_link.'">My Listings</a>';
        }
        return "";
    }
    add_shortcode('gd_my_listings_link', 'gd_add_my_listings_sc' );
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