• Resolved tnerb03

    (@tnerb03)


    Hello all,

    I’m having an issue where an embedded PDF is not viewing within Tabby Tabs. Initially the first two or three tabs will open the embedded PDFs, but subsequent tabs only show a little tiny dot. I guess this is because the PDF size is calculated when the tabs are closed, and when the tabs are clicked open it doesn’t resize.

    I found this (link attached) that explains to put this snippet in the (Tabby Responsive Tabs) code that creates the tabbed element. I just don’t know would that be the tabby-responsive-tabs.php, or the tabby.js file. And where in that code to enter it (where in the code the element is called.)

    I am not a programmer and this is a bit new to me. I do know the usual html, css, but if put in simple terms I can add code to php or javascript, etc.

    I’m sorry for not being able to supply a link to the site as it is a non-public site. But just wondering if anyone has had experience with this.

    Any information would be much appreciated.

    Thank you so much,

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter tnerb03

    (@tnerb03)

    I should have included this before, but this is the Tabby Responsive Tabs.php file if it helps. Thanks so much.

    <?php
    /*
    Plugin Name: Tabby Responsive Tabs
    Plugin URI: https://cubecolour.co.uk/tabby-responsive-tabs
    Description: Create responsive tabs inside your posts, pages or custom post types by adding simple shortcodes.
    Author: cubecolour
    Text Domain: tabby-responsive-tabs
    Domain Path: /languages/
    Version: 1.4.1
    Requires at least: 4.9
    Requires PHP: 5.6
    Author URI: https://cubecolour.co.uk
    
    	Tabby Responsive Tabs WordPress plugin Copyright 2013-2022 Michael Atkins
    
    	Licenced under the GNU GPL:
    
    	This program is free software; you can redistribute it and/or modify
    	it under the terms of the GNU General Public License as published by
    	the Free Software Foundation; either version 2 of the License, or
    	(at your option) any later version.
    
    	This program is distributed in the hope that it will be useful,
    	but WITHOUT ANY WARRANTY; without even the implied warranty of
    	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    	GNU General Public License for more details.
    
    	You should have received a copy of the GNU General Public License
    	along with this program; if not, write to the Free Software
    	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    
    	Original version of Responsive Tabs jQuery script by Pete Love:
    	http://www.petelove.co.uk/responsiveTabs/
    	http://codepen.io/petelove666/pen/zbLna
    	MIT license: http://blog.codepen.io/legal/licensing/
    
    	Permission is hereby granted, free of charge, to any person
    	obtaining a copy of this software and associated documentation
    	files (the "Software"), to deal in the Software without restriction,
    	including without limitation the rights to use, copy, modify,
    	merge, publish, distribute, sublicense, and/or sell copies of
    	the Software, and to permit persons to whom the Software is
    	furnished to do so, subject to the following conditions:
    
    	The above copyright notice and this permission notice shall
    	be included in all copies or substantial portions of the Software.
    
    	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    	EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    	OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    	NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    	HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    	WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    	DEALINGS IN THE SOFTWARE.
    */
    
    if ( ! defined( 'ABSPATH' ) ) exit;
    
    function cc_tabby_responsive_tabs_load_textdomain() {
    	load_plugin_textdomain( 'tabby-responsive-tabs', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    }
    add_action( 'plugins_loaded', 'cc_tabby_responsive_tabs_load_textdomain' );
    
    /**
     * Define Constants
     *
     */
    define( 'CC_TABBY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    define( 'CC_TABBY_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    define( 'CC_TABBY_PLUGIN_VERSION', '1.4.1' );
    
    function cc_tabby_plugin_version(){
    	return CC_TABBY_PLUGIN_VERSION;
    }
    
    /**
     * Add Links in Plugins Table
     *
     */
    add_filter( 'plugin_row_meta', 'cc_tabby_meta_links', 10, 2 );
    function cc_tabby_meta_links( $links, $file ) {
    
    	$plugin = plugin_basename(__FILE__);
    
    	//* create the links
    	if ( $file == $plugin ) {
    
    		$supporturl = 'https://wordpress.org/support/plugin/tabby-responsive-tabs';
    		$donateurl = 'https://cubecolour.co.uk/wp';
    		$reviewurl = 'https://wordpress.org/support/view/plugin-reviews/tabby-responsive-tabs?rate';
    		$twitterurl = 'https://twitter.com/cubecolour';
    		$customiserurl = 'https://cubecolour.co.uk/tabby-responsive-tabs-customiser';
    		$adminurl = admin_url( 'options-general.php?page=tabby-settings' );
    
    		$supporttxt = esc_attr__( 'Support', 'tabby-responsive-tabs' );
    		$donatetxt = esc_attr__( 'Donate', 'tabby-responsive-tabs' );
    		$reviewtxt = esc_attr__( 'Review', 'tabby-responsive-tabs' );
    		$twittertxt = esc_attr__( 'Cubecolour on twitter', 'tabby-responsive-tabs' );
    		$admintxt = esc_attr__( 'Settings', 'tabby-responsive-tabs' );
    
    		$iconstyle = 'style="-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;"';
    
    		return array_merge( $links, array(
    			'<a href="' . $supporturl . '"> <span class="dashicons dashicons-lightbulb" ' . $iconstyle . 'title="' . $supporttxt . '"></span></a>',
    			'<a href="' . $twitterurl . '"><span class="dashicons dashicons-twitter" ' . $iconstyle . 'title="' . $twittertxt . '"></span></a>',
    			'<a href="' . $reviewurl . '"><span class="dashicons dashicons-star-filled"' . $iconstyle . 'title="' . $reviewtxt . '"></span></a>',
    			'<a href="' . $donateurl . '"><span class="dashicons dashicons-heart"' . $iconstyle . 'title="' . $donatetxt . '"></span></a>',
    			'<a href="' . $customiserurl . '"><span class="dashicons dashicons-admin-appearance" ' . $iconstyle . 'title="Tabby responsive tabs customiser"></span></a>',
    			'<a href="' . $adminurl . '"><span class="dashicons dashicons-admin-generic" ' . $iconstyle . 'title="' . $admintxt . '"></span></a>',
    		) );
    	}
    
    	return $links;
    }
    
    /**
     * Add the admin page if 'tabby responsive tabs customiser' is not active
     *
     */
    if ( !function_exists( 'cc_remove_tabby_default_css' ) ) {
    	require_once( CC_TABBY_PLUGIN_PATH . 'includes/admin.php' );
    }
    
    /**
     * Register & enqueue the stylesheet
     * To use custom styles, copy the content of the tabby.css into your child theme's stylesheet and edit the styles there
     * Prevent the default styles from loading by deselecting the "Include default tab by stylesheet" checkbox in the tabby settings page at settings/tabby
     * Alternatively use the tabby responsive tabs customiser plugin
     * available from from https:cubecolour.co.uk/tabby-responsive-tabs-customiser
     *
     */
    
    //* Register script & styles
    function cc_tabby_register_cssjs() {
    	wp_register_style( 'tabby', CC_TABBY_PLUGIN_URL . 'css/tabby.css', '', CC_TABBY_PLUGIN_VERSION );
    	wp_register_style( 'tabby-print', CC_TABBY_PLUGIN_URL . 'css/tabby-print.css', '', CC_TABBY_PLUGIN_VERSION, 'print' );
    	wp_register_script( 'tabby', CC_TABBY_PLUGIN_URL . 'js/tabby.js', array('jquery'), CC_TABBY_PLUGIN_VERSION, true );
    
    	//* inline script added at tabbyending
    	$tabbytrigger = "jQuery(document).ready(function($) { RESPONSIVEUI.responsiveTabs(); })";
    	wp_add_inline_script( 'tabby', $tabbytrigger );
    }
    add_action( 'wp_enqueue_scripts', 'cc_tabby_register_cssjs' );
    
    /**
     * Sanitize html element
     *
     */
    function cc_sanitize_html_element( $element ){
    
    	$allowed = array( 'h1','h2','h3','h4','h5','h6','p' );
    
    	if (in_array( $element, $allowed) ) {
    		return $element;
    	} else {
    		return 'h2';
    	}
    }
    
    /**
     * SHORTCODE FOR TABBY
     * use [tabby]
     */
    function cc_shortcode_tabby( $atts, $content = null ) {
    
    	//* initialise $firsttab flag so we can tell whether we are building the first tab
    
    	global $reset_firsttab_flag;
    	static $firsttab = TRUE;
    
    	if ($GLOBALS["reset_firsttab_flag"] === TRUE) {
    		$firsttab = TRUE;
    		$GLOBALS["reset_firsttab_flag"] = FALSE;
    	}
    
    	$args =  shortcode_atts( array(
    		'title'			=> '',
    		'open'			=> '',
    		'icon'			=> '',
    		'ico'			=> '',
    		'class'			=> '',
    		'required'		=> FALSE,
    	), $atts );
    
    	$tabtarget = sanitize_title_with_dashes( remove_accents( wp_kses_decode_entities( $args['title'] ) ) );
    	$tab_title_element = cc_sanitize_html_element( get_option( 'cc_tabby_tab_title_element', 'h2' ) );
    	$class = sanitize_html_class( $args['class'] );
    
    	//* initialise urltarget
    	$urltarget = '';
    
    	//* grab the value of the 'target' url parameter if there is one
    	if ( isset ( $_REQUEST['target'] ) ) {
    		$urltarget = sanitize_title_with_dashes( $_REQUEST['target'] );
    	}
    
    	//* Set Tab Panel Class - add active class if the open attribute is set or the target url parameter matches the dashed version of the tab title
    	$tabcontentclass = "tabcontent";
    
    	if ( $class != '' ) {
    		$class = ' ' . $class;
    		$tabcontentclass .= " " . $class . "-content";
    	}
    
    	if ( ( ( $args['open'] ) && ( $urltarget == '' ) ) || ( isset( $urltarget ) && ( $urltarget == $tabtarget ) ) ) {
    		$tabcontentclass .= " responsive-tabs__panel--active";
    	}
    
    	//* Set the icon style for font awesome
    	switch (  esc_html( get_option( 'cc_tabby_fa_icon_style', 'regular' ) ) ) {
    		case 'solid':
    			$faclass = 'fa-solid';
    			break;
    		case 'thin':
    			$faclass = 'fa-thin';
    			break;
    		case 'light':
    			$faclass = 'fa-light';
    			break;
    		case 'duotone':
    			$faclass = 'fa-duotone';
    			break;
    		default: //* regular
    			$faclass = 'fa';
    	}
    
    	//* Add span for icon if icon (font-awesome) or ico (non-autoprefixed) is present
    	if ( $args['icon'] ) {
    		$addtabicon = '<span class="' . $faclass . ' fa-' . sanitize_html_class( $args['icon'] ) . '"></span>';
    	} elseif ( $args['ico'] ) {
    		$addtabicon = '<span class="' . sanitize_html_class( $ico ) . '"></span>';
    	} else {
    		$addtabicon = '';
    	}
    
    	//* test whether this is the first tab in the group
    	if ( $firsttab ) {
    
    		//* Set flag so we know subsequent tabs are not the first in the tab group
    		$firsttab = FALSE;
    
    		//* Build output if we are making the first tab
    		return '<div class="responsive-tabs">' . "\n" . '<' . $tab_title_element . ' class="tabtitle' . $class . '">' . $addtabicon . wp_kses( $args['title'], array( 'br' => array(), 'strong' => array(), 'em' => array(), 'i' => array() ) ) . '</' . $tab_title_element . '>' . "\n" . '<div class="' . sanitize_text_field( $tabcontentclass ) . '">' . "\n";
    	}
    
    	else {
    		//* Build output if we are making a subsequent (non-first tab)
    		return  "\n" . '</div><' . $tab_title_element . ' class="tabtitle' . $class . '">' . $addtabicon . wp_kses( $args['title'], array( 'br' => array(), 'strong' => array(), 'em' => array(), 'i' => array() ) ) . '</' . $tab_title_element . '>' . "\n" . '<div class="' . sanitize_text_field( $tabcontentclass ) . '">' . "\n";
    	}
    }
    add_shortcode( 'tabby', 'cc_shortcode_tabby' );
    
    /**
     * SHORTCODE TO BE USED AFTER FINAL TABBY TAB
     * use [tabbyending]
     *
     */
    function cc_shortcode_tabbyending( $atts, $content = null ) {
    
    	//* add screen styles, but only if the customiser or a custom styles plugin is not active
    	if ( ( !function_exists( 'cc_remove_tabby_default_css' ) ) && ( !function_exists( 'cc_remove_tabby_default_style' ) ) && ( 1 == get_option( 'cc_tabby_default_styles' ) ) ) {
    		wp_enqueue_style( 'tabby' );
    	}
    
    	//* Add print-only styles
    	wp_enqueue_style( 'tabby-print' );
    
    	//* Add script
    	wp_enqueue_script( 'tabby' );
    
    	//* action hook to add custom styles etc
    	do_action( 'cc_tabby' );
    
    	$GLOBALS["reset_firsttab_flag"] = TRUE;
    
    	return '</div></div>';
    }
    
    add_shortcode( 'tabbyending', 'cc_shortcode_tabbyending' );
    Plugin Author cubecolour

    (@numeeja)

    In the latest version of the plugin, a resize event is already triggered from the tabby.js script when a tab is selected, so it is unlikely that adding the code you have suggested would help.

    Which plugin are you using for embedding PDFs?

    Are the pages edited using the visual editor or the block editor?

    I really need to see the issue on a live page to be able to troubleshoot effectively, so it would help me to help you if you can post a link to a live page on your site where the issue can be seen.

    • This reply was modified 1 year, 6 months ago by cubecolour.
    Thread Starter tnerb03

    (@tnerb03)

    Thank you so much!

    The PDF plugin is called ‘PDF Embedder Premium Secure’.
    https://wp-pdf.com

    It’s using the ‘Classic’ block within the Block editor.

    To gain access, please go to:
    http://hrpbc.ca

    [redacted]

    to get to the page click on the first button “AML”, or the 5th one down “Myeloma/PCD” and then click on the first “More” button. That should take you to the Tabs page with the embedded PDFs.

    Usually, when I click on the first two tabs (any tab) they will open up, but the tabs after that will not open for some reason.

    Any information would be super helpful.

    Thank you so much!

    Plugin Author cubecolour

    (@numeeja)

    Thank you – I have had a look at the /aml-1 page (using macos firefox & chrome) and the issue did not arise for me — each PDF was visible for me once the enclosing tab was selected.

    I suspect the timing of the resize event might be relevant to the issue as reported.

    I do not have a copy of the premium PDF plugin so I am going to install the free version from WordPress.org on a local test site and attempt to reproduce the issue you are seeing.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    @tnerb03  Please don’t offer to send or post logon credentials on these forums: https://wordpress.org/support/guidelines#the-bad-stuff It is not OK to offer, enter, or send site credentials on these forums. Thanks for your cooperation.

    Plugin Author cubecolour

    (@numeeja)

    I have been able to reproduce the issue on my own test sites and there is now an add-on available for Tabby Responsive Tabs which provides a solution for this issue https://cubecolour.co.uk/downloads/tabby-pdf-embedder-fix/

    Thread Starter tnerb03

    (@tnerb03)

    Great, thanks so much! I’ve installed the plugin and everything works beautifully!

    Thanks again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PDF Embedder not showing PDF when in Tabby Tabs’ is closed to new replies.