Passing URL for shortcode
-
Hi,
Great plugin!
I had a page with several items i’d like to share. I made a change to the shortcode code, so you can pass the url attribute to set the url shared, for example:
[ngfb buttons=”facebook, linkedin, twitter” url=”http://www.uol.com.br”%5D
--- ngfb.php.orig 2013-06-19 22:35:58.999505171 -0300 +++ ngfb.php 2013-06-19 22:35:51.207557720 -0300 @@ -42,6 +42,7 @@ 'buttons' => null, 'css_class' => 'button', 'css_id' => 'shortcode', + 'url' => $this->ngfb->util->get_sharing_url( 'notrack', null, $use_post ), ), $atts ) ); global $post; @@ -50,19 +51,20 @@ if ( ! empty( $buttons ) ) { $ids = array_map( 'trim', explode( ',', $buttons ) ); // trim white spaces during explode - $cache_salt = __METHOD__ . '(post:' . $post->ID . '_buttons:' . ( implode( '_', $ids ) ) . '_css:' . $css_class . '_' . $css_id . ')'; + $cache_salt = __METHOD__ . '(post:' . $post->ID . '_buttons:' . ( implode( '_', $ids ) ) . '_css:' . $css_class . '_' . $css_id . '_url:' . $url . ')'; $cache_id = 'ngfb_' . md5( $cache_salt ); $cache_type = 'object cache'; $html = get_transient( $cache_id ); $this->ngfb->debug->log( $cache_type . ' : shortcode transient id salt "' . $cache_salt . '"' ); if ( $html !== false ) { $this->ngfb->debug->log( $cache_type . ' : html retrieved from transient for id "' . $cache_id . '"' ); } else { $html .= "\n<!-- " . $this->ngfb->fullname . " shortcode BEGIN -->\n"; $html .= $this->ngfb->social->get_js( 'pre-shortcode', $ids ); $html .= "<div class=\"" . $this->ngfb->acronym . "-shortcode-buttons\">\n" . - $this->ngfb->social->get_html( $ids, array( 'css_class' => $css_class, 'css_id' => $css_id ) ) . "</div>\n"; + $this->ngfb->social->get_html( $ids, array( 'css_class' => $css_class, 'css_id' => $css_id, 'url' => $url ) ) . "</div>\n"; $html .= $this->ngfb->social->get_js( 'post-shortcode', $ids ); $html .= "<!-- " . $this->ngfb->fullname . " shortcode END -->\n";
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Passing URL for shortcode’ is closed to new replies.