Namecheap.com - Cheap domain name registration, renewal and transfers - Free SSL Certificates - Web Hosting

How to use Shadowbox.js on Wordpress Front End



Thickbox is older one now to use at front end of your WordPress site. Be a new one Shadowbox.js is useful to attract your visitors. Here i will guide you to get a shadowbox on your site.



1.  first we need to download the Shadowbox.js script. form their site and unpack the zip file.  Upload the folder within your themes directory.

2. add the following code into your theme file "functions.php" this will help you to add your shadowbox.js into wordpress settings. 



function my_scripts_method() {
    wp_enqueue_script( 'shadowbox', get_template_directory_uri()  . '/includes/shadowbox/shadowbox.js');
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' ); 

function kv_enqueue_style () {
 wp_register_style( 'shadow-style', get_template_directory_uri() . '/includes/shadowbox/shadowbox.css');
  wp_enqueue_style( 'shadow-style' );
}


 3.  add a tiny line of code to your theme directory javascript file. Create a file with extension of "js". add the following code into it. 

<script type="text/javascript">
Shadowbox.init();
</script>

4. Here is a function and sample code to direct you to add a post images to show it on shadowbox window.

<?php $args = array(
'post_type'   => 'attachment',
'numberposts' => -1,
'post_parent' => $post->ID,
'post_mime_type' => 'image'
);

$attachments = get_posts( $args );
if ( $attachments )
{
foreach ( $attachments as $attachment )
{
$image_attributes = wp_get_attachment_image_src( $attachment->ID, full, false );
$small_img = wp_get_attachment_image_src( $attachment->ID, array(120,120)); ?>
<?php //add_thickbox(); ?>
<a href="<?php echo $image_attributes[0] ; ?>" rel="shadowbox[Mixed];" > <img src="<?php echo $small_img[0] ; ?>" alt="Plant 1"/> </a>
<?php }
}
?>

try this to add your post files on front end of your WordPress site or blog. I am not familiar with english.  So use it and comment below.

and my next post  i will guide you to use shadowbox to show div  alert window on front end.


13 Responses to “How to use Shadowbox.js on Wordpress Front End”

Unknown said...
23 December 2014 at 07:55

It’s so extremely useful factors are introduced here. These factors are the fresh and having straight answers are launched here and also is looking for this type of details thanks for personalized.

Wordpress Development Bangalore | Joomla Developers Bangalore


Unknown said...
14 October 2015 at 05:35

Its the best information for web development team so i have a shared to my web design and development team..thank you for sharing the best information...Wordpress Web Design Company Bangalore | Wordpress Website Development Company Bangalore


Unknown said...
28 April 2016 at 00:31 This comment has been removed by a blog administrator.

ULTIMEZ TECHNOLOGY said...
13 June 2016 at 23:04

I like your post and the way you are managing your blog, looking for such other post.keep updating
Website Design Company Bangalore | Website Development Company Bangalore


Mindbusy http://www.mindbusy.com said...
28 July 2016 at 06:45

Nice information,thanks for sharing keep sharing more site list

Ecommerce Development Bangalore | Magento Development Bangalore


Monika sharma said...
22 August 2016 at 08:15

I was looking for this information since morning and finally i got complete information through this post. Ecommerce Development Company Bangalore


Ogen Infosystem said...
13 April 2017 at 23:56

useful information for web development team so i had shared this to my website design and development team..thank you for sharing the best information..
Website Designing Company in Delhi | Website Designing Company in Rohini | Website Designing Company in Kirti Nagar


Unknown said...
25 November 2017 at 02:53

Your website content nice nice and interesting to observe.
ssd festplatte samsung


Unknown said...
29 December 2017 at 02:10

Really awsome
PG medical courses in germany




amorvet said...
11 February 2018 at 22:51

very helpful post.. thanks for sharing the post... keep updating..

http://www.amorvet.com

animal feed supplements | veterinary feed additives | Pig and swine feed additives | Poultry respiratory products | Herbal medicines for pets


ibss said...
25 July 2018 at 23:26

I am very happy when read this blog post because blog post written in good manner and write on
good topic. Thanks for sharing valuable information
Web design company in chennai
Web development company in chennai
Mobile app development company in chennai


sofianan said...
14 August 2018 at 03:25

greet information, if you want more information
manufacturing erp software in chennai


ابو السيد said...
5 February 2019 at 13:35



بسم الله الرحمن الرحيم نحن فى شركة الكمال نقوم بجميع خدمات نقل العفش والاساس بافض الطرق تحت اشراف

فريق كبير مدرب على اعلى مستوى من المستويات مع الفك والتركيب
شركة نقل اثاث بالطائف
شركة نقل اثاث بجازان
شركة نقل اثاث بحائل
شركة نقل اثاث ونقل عفش بحائل
والسلامة عليكم ورحمة الله وبركاته




Post a Comment

Namecheap.com - Cheap domain name registration, renewal and transfers - Free SSL Certificates - Web Hosting