determine whether content is of type Page or a Post and display accordingly

The wordpress way solution is // put this in header.php var ajax_url =”<?php echo admin_url(‘admin-ajax.php’);?>” // in js file $(‘a:not([href^=”#”])[href]’).click(function(e) { e.preventDefault(); var $this = $(this); var lnk = $this.attr(‘href’); var jqxhr = $.post(ajax_url, {‘action’:’list_content’, url: lnk}); jqxhr.done(function(data) { if(data === ‘post’) { $.prettyPhoto.open(lnk + ‘?iframe=true&width=80%&height=80%’); } }); }); // functions.php add_action(‘wp_ajax_nopriv_list_content’, ‘list_content’); add_action(‘wp_ajax_list_content’, ‘list_content’); … Read more

How to add a lightbox to class mix?

If you only need to add a “lightbox” class to each element you just need to change this : echo'<div class=”mix ‘.$item_classes.'”>’.get_the_post_thumbnail().'</div>’; to this : echo'<div class=”mix lightbox ‘.$item_classes.'”>’.the_post_thumbnail(‘thumbnail’, array(‘class’ => ‘lightbox’)) .'</div>’; And if you want to add the full size image to be opened, try this : $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),’full’); echo'<div class=”mix lightbox … Read more

Whitespace between product image and gallery on initial load of lightbox product page

Ok, so eventually managed to figure out that it was due to a couple of optimization plugins that were interfering with WooCommerce’s image slider: JetPack’s lazy loading and SG Optimizer. Deactivated SG Optimizer and added the following to my child theme’s functions.php: function is_lazyload_activated() { $condition = is_product(); if ($condition) { return false; } return … Read more

How can I integrate Fancybox 3 in WordPress properly

There should be no real problems doing it this manner, but there is a more correct way, namely using wp_add_inline_script, which is exactly meant for situations where you want to append something to a script file. You would use it like this: add_action (‘wp_enqueue_scripts’, ‘wpse302588_enqueue_add_script’); function wpse302588_enqueue_add_script() { $add_script = “jQuery(document).ready(function($){ …. });”; // your … Read more

Pre-styling post content to display in lightbox

Create your own child theme containing a functions.php and style.css so if your third party theme gets updated, you do not loose any work you put into it. In the functions.php enqueue your stylesheet. function enqueue_my_style() { wp_enqueue_style( ‘xtheme-custom’, get_stylesheet_uri() ); } add_action( ‘wp_enqueue_scripts’, ‘enqueue_my_style’ ); In your style.css write down your CSS mark-up of … Read more

Can I open a Nextgen gallery into a lightbox from an album listing page

Under Gallery Settings, set “Number of images per page” to 1. Then check the box for “Add hidden images.” This should display just the first thumbnail in you gallery, and when you click on it, you can navigate through them in a lightbox. Then you have to remove the page navigation at the bottom of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)