Try to making Custom Short Code
-
Hello
I am try to making a custom shortcode in using jquery pretty photo plugin. Here is my functions (function.php)function img_gallery_blog_house () {
wp_enqueue_script(‘jquery’);
wp_enqueue_script( ‘img_gallery_main’, get_template_directory_uri() . ‘/imggallery/js/jquery.prettyPhoto.js’, array(‘jquery’) );
wp_enqueue_script( ‘img_gallery_active’, get_template_directory_uri() . ‘/js/imggalleryactive.js’, array(‘jquery’) );
wp_enqueue_style( ‘img-gallery-defalt’, get_template_directory_uri() . ‘/imggallery/css/prettyPhoto.css’ );
}
add_action( ‘wp_enqueue_scripts’, ‘img_gallery_blog_house’ );function img_gallery_loop ($atts, $content = null){
extract ( shortcode_atts ( array (
), $atts, ‘img-gallery’) );
return ‘<div class=”main”>’ . do_shortcode($content) . ‘</div>’;
}
add_shortcode (‘img-gallery’, ‘img_gallery_loop’);function gallery_imgs_loop ($atts){
extract ( shortcode_atts ( array (
‘content’ => ‘null’,
‘image’ => ”,
‘rel’ => ”,
‘link’ => ‘https://’,
), $atts, ‘picture’) );return “<img src=’$image’ alt=” />“;
}
add_shortcode (‘picture’, ‘gallery_imgs_loop’);But this functions is not working and I can’t fine the bugs. Please, help me
- The topic ‘Try to making Custom Short Code’ is closed to new replies.