• Resolved FrankG2013

    (@frankg2013)


    Guys,

    I have the following issue:

    On my normal pages/posts, the easy fancybox plugin is working just fine, but when I want to open the search results with a fancybox this will not open. can anyone tell me what I’m doing wrong?

    The code I use for the normal page/post is:

    <?php
    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    $wp_query = new WP_Query( array(
    'post_type' => 'shop',
    'posts_per_page' => '5',
    'orderby' => 'rand',
    'order' => 'DESC',
    'cat' => get_query_var('cat'),
    'paged' => $paged
    )); ?>
    
    <?php if ($wp_query ->have_posts()) : while ( $wp_query ->have_posts() ) :$wp_query ->the_post(); ?>
    
    <!--Start Shop-->
    <li>
    <a href="#post-<?php the_ID(); ?>" title="<?php the_title(); ?>" class="fancybox-inline" id="inline"><?php if ( has_post_thumbnail()) { the_post_thumbnail('shops_post_thumbnail', array('class' => 'shops')); } ?></a>
    </li>
    
    <div class="fancybox-hidden">
    <div id="post-<?php the_ID(); ?>" style="height:auto; width:600px;">
     <?php the_content(); ?>
    </div>
    </div><!--End Shop-->

    and the code for the search results, it is almost the same:

    <?php  if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <!--Start Shop-->
    <li>
    <a href="#post-<?php the_ID(); ?>" title="<?php the_title(); ?>" class="fancybox-inline" id="inline"><?php if ( has_post_thumbnail()) { the_post_thumbnail('shops_post_thumbnail', array('class' => 'shops')); } ?></a>
    </li>
    
    <div class="fancybox-hidden">
    <div id="post-<?php the_ID(); ?>" style="height:auto; width:600px;">
     <?php the_content(); ?>
    </div>
    </div><!--End Shop-->

    This worked for a while, but one way or another it stopped working!
    I’ve tried with all other plugins disabled, butt no result.

    Any help will be appreciated in fixing this issue.

    Thanks!

    https://wordpress.org/plugins/easy-fancybox/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Source looks the similar so in theory it should work on both pages. There must be something else interfering. Do you get any errors in the browser script console?

    Can you share a link to your search page?

    Thread Starter FrankG2013

    (@frankg2013)

    RavanH,

    This is the link to the website http://www.webshopwereld.nl

    The searchform I use is the one on the right top (Direct naar:)
    When u search for something like TV there appear some shops.
    On this page is the fancybox plugin not working.

    On the home-page or category-page there are no problems.

    I did have some errors in the browser script,I’m going to try to solve that.

    (ps. sorry for my English 😉

    Hoi Frank, ziet er goed uit die site 😉

    I think your search template is missing the obligatory <?php wp_footer(); ?> call. There is some script missing that normally loads at the end of the page source.

    By the way, when visiting a sub-page I get these errors in console:

    GET http://www.webshopwereld.nl/Wereld_W/wp-content/themes/webshopwereld/js/jquery.tipsy.js?ver=3.9 404 (Not Found) (index):34
    GET http://www.webshopwereld.nl/Wereld_W/wp-content/plugins/search-permalink.php?out=js 404 (Not Found) (index):39

    Another tip: your home page source shows a blank line before the doctype declaration. Normally not a problem but in IE it might cause weird issues for FancyBox. If you can find out where this blank line comes from (and remove it) then you’ll be safer 🙂

    Thread Starter FrankG2013

    (@frankg2013)

    HavanH,

    Thanks for you’re reply, and liking my site!

    That was indeed the problem with the search page, it’s fixed now… thank you very much! I was looking for weeks, but the footer I have always overlooked.

    I think I solved the

    GET http://www.webshopwereld.nl/Wereld_W/wp-content/themes/webshopwereld/js/jquery.tipsy.js?ver=3.9 404 (Not Found) (index):34
    GET http://www.webshopwereld.nl/Wereld_W/wp-content/plugins/search-permalink.php?out=js 404 (Not Found) (index):39

    issues, would/can you check that for me?

    The problem with the blank line before the doctype declaration I cant find at this time, do you have any suggestions, maybe a specific plug in?

    Again thanks a lot!

    Thread Starter FrankG2013

    (@frankg2013)

    The problem with the blank line before the doctype declaration is also solved….!

    … would/can you check that for me?

    Yes, all is well now 🙂

    The problem with the blank line before the doctype declaration I cant find at this time, do you have any suggestions, maybe a specific plug in?

    Cannot be your header.php or wp-config.php (sometimes a blank line appears there after editing) because then it would show on every page. However, I notice the blank line appears on other pages like /shop-toevoegen/ or /adverteren/ but not on archives. Is your front page using a page.php or home.php template?

    Thread Starter FrankG2013

    (@frankg2013)

    this is also solved, the problem was a blank line between the template part en the header part.

    <?php
    
    /**
    
     * The template for displaying all pages.
     */
    
    ?>
    <?php get_header(''); ?>

    again thanks a lot! I put this topic on resolved!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘easy fancybox inline is working on normal page but not working in search result’ is closed to new replies.