Supreme (v1) 'Claim Listing ' shortcode or widget required if possible.

This topic contains 18 replies, has 4 voices, and was last updated by  Kiran 1 week ago.

  • Author
    Posts
  • #496774

    Kor
    Moderator
    Post count: 13125

    Hi Ian,

    Thanks for your reply. The code from the Github link is not working on this post https://wpgeodirectory.com/support/topic/supreme-theme-claim-listing/#post-429683 . I will ask a developer about this and will come back to you soonest.

    Thanks!

    #496946

    Kiran
    Moderator
    Post count: 5091

    Hello Ian,

    Please try following PHP snippet.

    //usage editor: [gd_claim_link class="" icon="false"]
    //usage php: echo do_shortcode('[gd_claim_link class="" icon="false"]');
    function geodir_claim_link_sc($atts) {
        if (function_exists('geodir_load_translation_geodirclaim')) {
            global $post, $preview;
    
            $defaults = array(
                'class' => 'supreme-btn supreme-btn-small supreme-edit-btn',
                'icon' => "true",
                'link_text' => __('Claim', 'directory-starter')
            );
            $params = shortcode_atts($defaults, $atts);
    
            ob_start();
    
            $geodir_post_type = array();
            if (get_option('geodir_post_types_claim_listing'))
                $geodir_post_type = get_option('geodir_post_types_claim_listing');
            $posttype = (isset($post->post_type)) ? $post->post_type : '';
            if (in_array($posttype, $geodir_post_type) && !$preview) {
                $is_owned = absint(geodir_get_post_meta($post->ID, 'claimed', true));
                if (get_option('geodir_claim_enable') == 'yes' && empty($is_owned)) {
                    if (is_user_logged_in()) {
                        echo '<div class="geodir-company_info" style="border: none;margin: 0;padding: 0">';
                        echo '<div class="geodir_display_claim_popup_forms"></div>';
                        echo '<a href="javascript:void(0);" class="'.$params['class'].' geodir_claim_enable">';
                        if ($params['icon'] == 'true') {
                            echo '<i class="fa fa-question-circle"></i>';
                        }
                        echo $params['link_text'];
                        echo '</a>';
                        echo '</div>';
                        echo '<input type="hidden" name="geodir_claim_popup_post_id" value="' . $post->ID . '" />';
    
                    } else {
    
                        $site_login_url = geodir_login_url();
                        echo '<a href="' . $site_login_url . '" class="'.$params['class'].'">';
                        if ($params['icon'] == 'true') {
                            echo '<i class="fa fa-question-circle"></i>';
                        }
                        echo $params['link_text'];
                        echo '</a>';
    
                    }
                }
            }
            $output = ob_get_contents();
            ob_end_clean();
            return $output;
        }
    }
    add_shortcode('gd_claim_link', 'geodir_claim_link_sc');

    Add above code via PHP snippet plugin or add in parent theme/child theme functions.php file.

    Use shortcode

    [gd_claim_link class="" icon="false"]

    to show claim link with text.

    Kiran

    #497278

    Ian
    Full Member
    Post count: 135

    Hi Kiran.

    Wow thank you so very much for that huge effort, i really appreciate it, amazing!

    Just added the code and the shortcode to the sidebar and it works 100% perfect ! 🙂

    Thank you once again you are a legend !!!

    Kindest regards,

    Ian

    #497321

    Kiran
    Moderator
    Post count: 5091
    This reply has been marked as private.
Viewing 4 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic.