hooks in div.sd-detail-details

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

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #383003

    mrv
    Expired Member
    Post count: 54

    Are there any hooks available for “div.sd-detail-info” and “div.sd-detail-cta” on the detail page of supreme?

    #383044

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    I alerted the developers to have a look at your question and let you know asap.

    Thanks

    #383134

    Giri
    Expired Member
    Post count: 3155

    There is a hook named

    sd_detail_before_cat_links

    available in the section you mentioned.

    If you explain what you are trying to achieve, i can help you better.

    Thanks

    #383158

    mrv
    Expired Member
    Post count: 54

    Hi Giri,

    The hook you mention is what I was looking for in the first div… thank you! Placed “Get Directions” under the address, here is what I used…

    function geodirectory_detail_page_google_map_link() {
    global $post, $preview;

    if ( !$preview && !empty( $post->post_latitude ) && !empty( $post->post_longitude ) ) {
    $maps_url = add_query_arg( array(
    ‘q’ => $post->post_latitude . ‘,’ . $post->post_longitude,
    ), ‘http://maps.google.com/’ );
    ?>
    <p><i class=”fa fa-location-arrow “></i> : ” target=”_blank”><?php echo __( ‘Get Directions’, ‘geodirectory’ ); ?></p>
    <?php
    }
    }
    add_action( ‘sd_detail_before_cat_links’, ‘geodirectory_detail_page_google_map_link’);

    For div “div.sd-detail-cta”, I would like to move the “write a review, send to friend, favorite and social links” to the bottom of the detail sidebar just for mobile devices. The goal is to move the profile accordion feature up so it is under the categories and move the social linking stuff down to the bottom for mobile devices or whenever the accordion is active. I’m in the process of trying to understand the use of hooks so hopefully this makes sense.

    Thanks!
    Mike

    #383159

    Giri
    Expired Member
    Post count: 3155

    Hi mrv,

    That is not possible directly.

    You need to have two copies of cta div.

    One as it is right now, another one in the sidebar bottom.

    You need to hide the sidebar one on desktops and main one on mobile.

    You need to use css to hide them.

    Hope that makes sense.

    Use this code to add the cta in sidebar.

    
    
    
    add_action('geodir_sidebar_detail_bottom_section', 'sd_sidebar_cta');
    function sd_sidebar_cta() {
    	global $preview, $post;
    	
    echo '<div class="sd-detail-cta sd-detail-sidebar-cta">';
    $review_button = '<a class="dt-btn" href="' . get_the_permalink() . '#reviews">' . __('Write a Review', 'supreme-directory') . '</a>';
    echo apply_filters('sd_details_output_review_button',$review_button);
    
    $send_buttons = '<div class="geodir_more_info geodir-company_info geodir_email" style="padding: 0;border: none">';
    
    if (!$preview) {
    	$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" />
                        <div class="geodir_display_popup_forms"></div>';
    	$send_buttons .= $html;
    }
    
    $send_buttons .= '<span style="" class="geodir-i-email">';
    $send_buttons .= '<i class="fa fa-envelope"></i>';
    if (isset($post->geodir_email) && $post->geodir_email) {
    	$send_buttons .= '<a href="javascript:void(0);" class="b_send_inquiry">'.SEND_INQUIRY.'</a> | ';
    }
    $send_buttons .= '<a class="b_sendtofriend" href="javascript:void(0);">'.SEND_TO_FRIEND.'</a></span>';
    $send_buttons .= '</div>';
    
    echo apply_filters('sd_details_output_send_buttons',$send_buttons);
    
    ob_start();
    geodir_favourite_html($post->post_author, $post->ID);
    $fav_html = ob_get_clean();
    echo apply_filters('sd_details_output_fav',$fav_html);
    
    ob_start();
    ?>
    <ul class="sd-cta-favsandshare">
    	<?php if (!$preview) { ?>
    		<li><a rel="nofollow" target="_blank" title="<?php echo __('Share on Facebook', 'supreme-directory'); ?>"
    			   href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>"><i
    					class="fa fa-facebook"></i></a></li>
    		<li><a rel="nofollow" target="_blank" title="<?php echo __('Share on Twitter', 'supreme-directory'); ?>"
    			   href="http://twitter.com/share?text=<?php echo urlencode(get_the_title()); ?>&url=<?php echo urlencode(get_the_permalink()); ?>"><i
    					class="fa fa-twitter"></i></a></li>
    		<li><a rel="nofollow" target="_blank" title="<?php echo __('Share on Google Plus', 'supreme-directory'); ?>"
    			   href="https://plus.google.com/share?url=<?php echo urlencode(get_the_permalink()); ?>"><i
    					class="fa fa-google-plus"></i></a></li>
    	<?php } else { ?>
    		<li><a rel="nofollow" target="_blank" title="<?php echo __('Share on Facebook', 'supreme-directory'); ?>"
    			   href=""><i class="fa fa-facebook"></i></a></li>
    		<li><a rel="nofollow" target="_blank" title="<?php echo __('Share on Twitter', 'supreme-directory'); ?>"
    			   href=""><i class="fa fa-twitter"></i></a></li>
    		<li><a rel="nofollow" target="_blank" title="<?php echo __('Share on Google Plus', 'supreme-directory'); ?>"
    			   href=""><i class="fa fa-google-plus"></i></a></li>
    	<?php } ?>
    </ul>
    <?php
    
    $share_html = ob_get_clean();
    echo apply_filters('sd_details_output_share_links',$share_html);
    echo '</div><!-- sd-detail-cta end -->'; ?>
    
    <?php
    }

    Then use CSS media queries to hide.

    Thanks

    #383230

    mrv
    Expired Member
    Post count: 54

    Giri,

    I came up with this, seems to work and looks logical…

    @media (min-width: 0px) and (max-width: 600px) {
    .sd-detail-cta { display: none; } /* show it on small screens */
    }

    @media (min-width: 601px) and (max-width: 2000px) {
    .sd-detail-cta { display: block; } /* show it on large screens */
    }

    @media (min-width: 0px) and (max-width: 601px) {
    .sd-detail-cta.sd-detail-sidebar-cta { display: block; } /* show it on small screens */
    }

    @media (min-width: 600px) and (max-width: 2000px) {
    .sd-detail-cta.sd-detail-sidebar-cta { display: none; } /* show it on large screens */
    }

    Thank you for the help… greatly appreciated!!
    Mike

    #383350

    Giri
    Expired Member
    Post count: 3155

    You are welcome

Viewing 7 posts - 1 through 7 (of 7 total)

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

Open Support Ticket