{"id":5491230,"date":"2014-11-18T10:27:23","date_gmt":"2014-11-18T10:27:23","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/try-to-making-custom-short-code\/"},"modified":"2016-08-22T12:41:13","modified_gmt":"2016-08-22T12:41:13","slug":"try-to-making-custom-short-code","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/try-to-making-custom-short-code\/","title":{"rendered":"Try to making Custom Short Code"},"content":{"rendered":"<p>Hello<br \/>\nI am try to making a custom shortcode in using jquery pretty photo plugin. Here is my functions (function.php) <\/p>\n<p>\tfunction img_gallery_blog_house () {<br \/>\n\t\twp_enqueue_script(&#8216;jquery&#8217;);<br \/>\n\t\twp_enqueue_script( &#8216;img_gallery_main&#8217;, get_template_directory_uri() . &#8216;\/imggallery\/js\/jquery.prettyPhoto.js&#8217;, array(&#8216;jquery&#8217;) );<br \/>\n\t\twp_enqueue_script( &#8216;img_gallery_active&#8217;, get_template_directory_uri() . &#8216;\/js\/imggalleryactive.js&#8217;, array(&#8216;jquery&#8217;) );<br \/>\n\t\twp_enqueue_style( &#8216;img-gallery-defalt&#8217;, get_template_directory_uri() . &#8216;\/imggallery\/css\/prettyPhoto.css&#8217; );<br \/>\n\t}<br \/>\n\tadd_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;img_gallery_blog_house&#8217; );<\/p>\n<p>\tfunction img_gallery_loop ($atts, $content = null){<\/p>\n<p>\t\textract ( shortcode_atts ( array (<\/p>\n<p>\t\t), $atts, &#8216;img-gallery&#8217;) );<\/p>\n<p>\t\treturn &#8216;&lt;div class=&#8221;main&#8221;&gt;&#8217; . do_shortcode($content) . &#8216;&lt;\/div&gt;&#8217;;<br \/>\n\t}<br \/>\n\tadd_shortcode (&#8216;img-gallery&#8217;, &#8216;img_gallery_loop&#8217;);<\/p>\n<p>\tfunction gallery_imgs_loop ($atts){<br \/>\n\t extract ( shortcode_atts ( array (<br \/>\n   &#8216;content&#8217; =&gt; &#8216;null&#8217;,<br \/>\n   &#8216;image&#8217; =&gt; &#8221;,<br \/>\n   &#8216;rel&#8217; =&gt; &#8221;,<br \/>\n   &#8216;link&#8217; =&gt; &#8216;http:\/\/&#8217;,<br \/>\n  ), $atts, &#8216;picture&#8217;) );<\/p>\n<p>  return &#8220;<a rel='$rel' href='$link'>&lt;img src=&#8217;$image&#8217; alt=&#8221; \/&gt;<\/a>&#8220;;<br \/>\n }<br \/>\n add_shortcode (&#8216;picture&#8217;, &#8216;gallery_imgs_loop&#8217;);<\/p>\n<p>But this functions is not working and I can&#8217;t fine the bugs. Please, help me<\/p>\n","protected":false},"template":"","class_list":["post-5491230","topic","type-topic","status-closed","hentry","topic-tag-shortcode","topic-tag-wordpress-theme-development"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5491230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5491230\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5491230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}