WordPress.org

Support

Support » Plugins and Hacks » Jetpack by WordPress.com » [Resolved] Jetpack Like button not working

[Resolved] Jetpack Like button not working

Viewing 15 replies - 16 through 30 (of 37 total)
  • Plugin Author Jeremy Herve

    @jeherve

    Jetpack Mechanic

    I noticed a Javascript error, caused by a call to the now deprecated Twitter API v1. Does the Portfolium theme include some kind of Twitter widget? If so, could you try to disable it, and let me know if it helps?

    Thanks Jeremey,

    the Twitter widget is something which I added to my customised version of the theme.

    The original WPShower Portfolium theme does not include a Twitter (or other) widget. As mentioned before, even if I go back to this original theme, the Jetpack like button is not loading.

    Plugin Author Jeremy Herve

    @jeherve

    Jetpack Mechanic

    Thanks for the additional details.

    Another Javascript error seems to be caused by the jQuery Cycle library added by your theme to all pages. The error only appears on single posts, where the Like button is displayed and where you probably don’t need this library.

    Could you try to locate the function that is loaded this library into your theme, and make sure it’s not executed on article pages. You can do so by wrapping the function in a !is_single() conditional tag, like so:

    if( !is_single() ) {
    /* Call to the jQuery Cycle library */
    }

    Let me know if it helps.

    Thanks Jeremy!

    I looked at my code and cleaned it up a bit. It was a bit messy indeed. However, I did not manage to work in your suggestion – it would break my jQuery gallery, but this might be a problem of my limited coding skills.

    Here is my header.php which calls the jQuery libraries.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php bloginfo('text_direction'); ?>" xml:lang="<?php bloginfo('language'); ?>">
        <head>
    
    <!-- in --!>
    
    	<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1"><![endif]-->
        <!--[if IE 6]>
            <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/ie6.css" type="text/css" media="screen" />
        <![endif]-->
        <!--[if IE 7]>
            <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/ie7.css" type="text/css" media="screen" />
        <![endif]-->
        <!--[if IE 8]>
            <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/ie8.css" type="text/css" media="screen" />
        <![endif]-->
        <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
     	<?php wp_head(); ?>
    
        <script src="<?php bloginfo('template_url'); ?>/js/columnizer.js" type="text/javascript"></script>
        <script src="<?php bloginfo('template_url'); ?>/js/columnize.js" type="text/javascript"></script>
    	<script type='text/javascript' src='<?php bloginfo('template_url'); ?>/js/menu.js'></script>
    
    <!-- out --!>
    
    <style type="text/css">
    #images { height: 300px; width: 900px; padding:0; margin:0; overflow: hidden;}
    #images img { border:none;}
    </style>
    
            <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
            <title><?php
                global $page, $paged;
                wp_title('|', true, 'right');
    
                $site_description = get_bloginfo('description', 'display');
                if ( $site_description && ( is_home() || is_front_page()))
                    echo " | $site_description";
                if ($paged >= 2 || $page >= 2)
                    echo ' | ' . sprintf( __('Page %s'), max($paged, $page));
    
                ?></title>
    
            <meta http-equiv="Content-language" content="<?php bloginfo('language'); ?>" />
            <link rel="profile" href="http://gmpg.org/xfn/11" />
    	<link href="http://www.marcelmuench.de/favicon.ico" rel="shortcut icon" />
            <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
            <!--[if IE]><link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_url'); ?>/ie.css" /><![endif]-->
            <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
            <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
            <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>"/>
            <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    
    <?php
    			wp_enqueue_script('jquery');
    
    			if ( is_singular() ) wp_enqueue_script('slideshow', get_template_directory_uri() . '/js/jquery.cycle.all.min.js', 'jquery', false);
    			wp_enqueue_script('lazyload', get_template_directory_uri() . '/js/jquery.lazyload.mini.js', 'jquery', false);
    			wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', 'jquery', false);
    		?>
            <?php wp_head(); ?>
            <?php if ( is_singular() ) : ?>
                <script type="text/javascript">
                    jQuery(document).ready(function() {
                        jQuery('#show').after('<div id="show_nav">').cycle({
                            fx:     'fade',
                            speed:  500,
                            next: '#show',
                            timeout: 0,
                            pager:  '#show_nav'
                        });
                    });
                </script>
    	<?php endif; ?>
    
        </head>
        <body>
            <div class="wrapper">
                <div class="header clear">
                    <h1 class="logo"><a href="<?php bloginfo('home'); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo.jpg" alt="<?php bloginfo('name'); ?>" /></a>
    </h1>
                    <?php wp_nav_menu(array('menu' => 'Header', 'theme_location' => 'Header', 'depth' => 2, 'container' => false, 'menu_class' => 'nav jsddm', 'walker' => new extended_walker())); ?>
                </div>
                <div class="middle clear">

    When I put the !is_single() conditional tag instead of ‘if ( is_singular() )’ the jQuery gallery stopped working. How to do it correctly?

    Thanks!

    Plugin Author Jeremy Herve

    @jeherve

    Jetpack Mechanic

    Should there be a slideshow on your article pages? I do not see any at the moment, nor in Firefox nor in Chrome.

    This code seems to indicate that the slideshow should only appear on article pages.

    The code I proposed does actually remove the slideshow code from the article pages, because I didn’t think it would be necessary there since I didn’t see any slideshow on these pages. It also creates a javascript error that may be what’s causing the issue with Likes.

    You’re right, there is no need for a gallery in the articles pages!

    I left the code (as pasted in here) unchanged, since otherwise it breaks the galleries of the portfolio pages. I also find it confusing that the code should indicate that the slideshow only appears on article pages, whereas the opposite is the case. However, I can’t fully get a grasp of how the developer built the theme.

    Plugin Author Jeremy Herve

    @jeherve

    Jetpack Mechanic

    Could you point me to one of the pages that includes a slideshow?

    Thanks!

    http://www.marcelmuench.de/portfolio/myanmar/

    This and any other picture gallery that you can find from the main page http://www.marcelmuench.de/

    Thanks!

    Plugin Author Jeremy Herve

    @jeherve

    Jetpack Mechanic

    These galleries are on Pages, not on Posts, am I correct?

    If that’s the case, could you try to change is_singular by is_page in the code loading that library?

    Thanks Jeremy,

    I did that. Unfortunately, it brakes my photo galleries, the jQuery Cycle doesn’t work anymore.

    Firebug: “TypeError: jQuery(…).after(…).cycle is not a function

    pager: ‘#show_nav'”

    It also doesn’t make the like button work. Still greyed out and “loading”.

    I am not sure how the template is built, never saw this portfolio option in another template before. Therefore I am not sure if it is a page or a post or something different.

    In the jetpack option I see the following options:

    “Show buttons on

    Front Page, Archive Pages, and Search Results
    Posts
    Pages
    Media
    Portfolio”

    Could this mean that “Portfolio” is something completely different than a post or page?

    Plugin Author Jeremy Herve

    @jeherve

    Jetpack Mechanic

    Could this mean that “Portfolio” is something completely different than a post or page?

    That’s exactly it! Your Portfolio items use a Custom Post Type. You probably have a “Portfolio” menu in your dashboard, under Posts and Pages.

    In this case, you will have to target that Custom Post Type. Try replacing is_singular by is_singular( 'portfolio' ) (assuming the Custom Post Type name is “Portfolio”.

    Thanks, my code now looks like this:

    <?php
    			wp_enqueue_script('jquery');
    
    			if ( is_singular( 'portfolio' ) ) wp_enqueue_script('slideshow', get_template_directory_uri() . '/js/jquery.cycle.all.min.js', 'jquery', false);
    			wp_enqueue_script('lazyload', get_template_directory_uri() . '/js/jquery.lazyload.mini.js', 'jquery', false);
    			wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', 'jquery', false);
    		?>
            <?php wp_head(); ?>
            <?php if ( is_singular( 'portfolio' ) ) : ?>
                <script type="text/javascript">
                    jQuery(document).ready(function() {
                        jQuery('#show').after('<div id="show_nav">').cycle({
                            fx:     'fade',
                            speed:  500,
                            next: '#show',
                            timeout: 0,
                            pager:  '#show_nav'
                        });
                    });
                </script>
    	<?php endif; ?>

    GOOD NEWS: My gallery is still working! Thanks!

    BAD NEWS: The jetpack button is still stuck “loading..”

    I also disabled the twitter json call for the moment, so now there is no error on my page when I use Firebug. Not sure how to get the like button to work though..

    just to let you know: I did another round of disabling Jetpack, disabling all plug-ins, changing back to the twenty-twelve theme. Re-enabled Jetpack. (Like button worked). Changed to my current theme (Button stopped working). Re-enabled all plug-ins. Status quo: Button doesn’t load.

    Plugin Author Jeremy Herve

    @jeherve

    Jetpack Mechanic

    Thanks for bearing with me.

    Re-enabled Jetpack. (Like button worked). Changed to my current theme (Button stopped working)

    Something else in your theme must be conflicting with the Likes.

    Could you try to disable the lazyload jQuery plugin that’s added to your header, and let me know if it helps?

    Thank YOU for bearing with me, Jeremy.

    Unfortunately, disabling the lazyload jQuery didn’t do the trick. The gallery wouldn’t work afterwards and the wordpress like button was still greyed-out. (I tried different browser).

    Could the “Follow this Blog” widget be a problem? I will have a look if I can remove it and what the effects on the like button are …

Viewing 15 replies - 16 through 30 (of 37 total)
  • The topic ‘[Resolved] Jetpack Like button not working’ is closed to new replies.
Skip to toolbar