• Resolved riseofaryan

    (@riseofaryan)


    I was building a wordpress website for my client and it needed the TablePress plugin. I installed the plugin correctly but the CSS for the table doesn’t seem to be working. I tried activating other themes (twentytwelve) and it worked but didn’t work in my theme. I couldn’t figure out what went wrong with my theme.

    Here is the link to the page where I used table
    https://dev.riseofaryan.com/shadowtrademe/

    And here is the debug and version information

    · Website: https://dev.riseofaryan.com/shadowtrademe
    · TablePress: 1.4
    · TablePress (DB): 24
    · TablePress table scheme: 3
    · Plugin installed: 2014/05/14 16:29:52
    · WordPress: 3.9.1
    · Multisite: no
    · PHP: 5.4.25
    · mysqli Extension: false
    · mySQL (Server): 5.1.73-cll
    · mySQL (Client): 5.1.73
    · ZIP support: no
    · UTF-8 conversion: yes
    · WP Memory Limit: 40M
    · Server Memory Limit: 256M
    · Magic Quotes: off
    · WP_DEBUG: false
    · WP_POST_REVISIONS: true

    Not sure but I doubt in my function.php file, and here is my code for function.php

    <?php
    
    add_action( 'after_setup_theme', 'riseofaryan_setup' );
    if ( ! function_exists( 'riseofaryan_setup' ) ):
    	function riseofaryan_setup() {	
    
    		add_editor_style();
    		add_theme_support( 'automatic-feed-links' );
    		add_theme_support( 'menus' );
    		add_theme_support( 'post-thumbnails' );
    		if(function_exists('register_nav_menus')) {
    			register_nav_menus(array(
    				'main-menu' => __( 'Main Menu' ),
    				'footer-menu' => __( 'Footer Menu' )
    			));
    		}
    	}
    endif; // riseofaryan_setup
    
    // Register Custom Navigation Walker
    require_once('wp_bootstrap_navwalker.php');
    
    define('THEME_URL', get_template_directory_uri());
    define('PARENT_DIR', get_template_directory() );
    
    /* -- Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link -- */
    function riseofaryan_page_menu_args( $args ) {
    	$args['show_home'] = true;
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'riseofaryan_page_menu_args' );
    
    function riseofaryan_widgets_init() {
    
    	register_sidebar( array(
    		'name' => __( 'Bottom Bar Widgets', $short_name ),
    		'before_widget' => '<div class="width25"><div class="bottom-wdgt">',
    		'after_widget' => "</div></div><!-- .width25 -->",
    		'before_title' => '<h2>',
    		'after_title' => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'riseofaryan_widgets_init' );
    
    function buttombar_widget() {
    	if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Bottom Bar Widgets' ) );
    }
    
    function excerpt($limit) {
      $excerpt = explode(' ', get_the_excerpt(), $limit);
      if (count($excerpt)>=$limit) {
        array_pop($excerpt);
        $excerpt = implode(" ",$excerpt).'...';
      } else {
        $excerpt = implode(" ",$excerpt);
      }
      $excerpt = preg_replace('<code>\[[^\]]*\]</code>','',$excerpt);
      return $excerpt;
    }
    function content($limit) {
      $content = explode(' ', get_the_content(), $limit);
      if (count($content)>=$limit) {
        array_pop($content);
        $content = implode(" ",$content).'...';
      } else {
        $content = implode(" ",$content);
      }
      $content = preg_replace('/\[.+\]/','', $content);
      $content = apply_filters('the_content', $content);
      $content = str_replace(']]>', ']]>', $content);
      return $content;
    }
    
    function get_thumb($width, $height){
    	global $post;
    	$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' );
    	if (has_post_thumbnail()){
    		echo '<img src="'.get_template_directory_uri().'/timthumb.php?src='.$src[0].'&a=t&w='.$width.'&h='.$height.'&zc=1&q=100" alt="'.get_the_title().'" title="'.get_the_title().'" />';
    	} else {
    		echo '<img src="'.get_template_directory_uri().'/timthumb.php?src='.get_template_directory_uri().'/images/no-img.jpg&w='.$width.'&h='.$height.'&zc=1&q=100" />';
    	}
    }
    
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thanks in advance.

    Regards,
    Aryan

    https://www.ads-software.com/plugins/tablepress/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    From what I can see, your theme is missing a call to

    wp_head();

    right before the closing </head> tag in the header.php. That’s however required in WordPress themes.

    Regards,
    Tobias

    Thread Starter riseofaryan

    (@riseofaryan)

    Thanks a lot sir,
    I fixed the CSS issue but I still don’t see the ‘dataTables_length’ thing. Something like ‘show # entries’.

    https://dev.riseofaryan.com/shadowtrademe/

    Did I still miss something?

    Would appreciate your help.

    Regards

    Thread Starter riseofaryan

    (@riseofaryan)

    Hello Tobias,
    No worries I have fixed the ‘dataTables_length’ thing too. Thanks a lot for your exceptional support.

    You really have a great plugin. Thanks again.

    Regards
    Aryan

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Thread Starter riseofaryan

    (@riseofaryan)

    Hello Tobias,
    Sorry to bother. Its me again with one more issue. I am nearly finished with my wordpress website with the issue of CSS fixed. But when I uploaded the theme to the website I still got one more issue. TablePress CSS is working but I don’t still see the ‘dataTables_length’ thing. This was working fine in my localhost but when I uploaded the theme I got this issue.

    My website with TablePress table can be viewed here
    https://shadowtrademe.com/

    Hope to get this solved too. Thanks in advance.

    Regards

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    the reason for this is some other JavaScript code.
    In the page, there’s this line

    jQuery(function() {jQuery("#mm-payment-options-dialog").dialog({autoOpen: false});jQuery("#mm-payment-confirmation-dialog").dialog({autoOpen: false}); });

    that calls the jQuery “Dialog” component. That is however not really loaded, or it’s “unloaded” again, because something on the site is loading a second copy of jQuery from the Google CDN. That’s bad and should be removed. Loading the copy of jQuery that comes with WordPress is enough.

    Regards,
    Tobias

    Thread Starter riseofaryan

    (@riseofaryan)

    Thanks a lot for your quick support. I have rated this plugin a 5 star.

    Regards

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks! ?? I really appreciate it!

    Best wishes,
    Tobias

    Hi,

    How did you solve the CSS not working problem?

    Regards.

    Thread Starter riseofaryan

    (@riseofaryan)

    It was not actually an error. I just missed the calls wp_head(); and wp_footer(); I simply put them back and it worked. And next thing is if you have linked the jquery.js file in your theme, you might want to remove that too since jquery file that wordpress have is enough.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, a common reason for CSS not being applied is the missing wp_head(); call in the theme. The TablePress CSS file is then not loaded.
    Other reasons can be that the theme is already using CSS for tables with a higher priority.

    To find out more, it would be great, if you could post a link to the page with the table that is not working for you, marcohageman.

    Regards,
    Tobias

    Hi,

    I’m using the Avada theme and in the head.php I can see the wp_head there.

    I think the problem is in the priority of the CSS for tables.

    The link is https://www.hoofakker.nl/wp/?page_id=4998
    .
    The tables are on the tab page. The first one is the TablePress table. The other ones are the default Avada tables.

    Regards,
    Marco

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for the link!

    Yes, the wp_head() is there, and the default CSS file is loaded.
    However, there doesn’t seem to be any Custom CSS in the page. What exactly did you enter into the “Custom CSS” textarea on the “Plugin Options” screen of TablePress?

    Regards,
    Tobias

    Hi,

    This is the css code I used. I’ve tried it in the plugin options and also in the default style sheet of the Avada theme.

    When I’m saving this code in plugin options I’ve receiving a warning about the customized css can’t be saved into a file.

    Regards,

    Marco
    .tablepress,
    .tablepress tr,
    .tablepress tbody td,
    .tablepress thead th,
    .tablepress tfoot th {
    border: 1;
    }

    #content .tablepress-id-2 .row-1 td {
    background-color: #ffffff;
    }

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, ok. That CSS is incomplete (for the border) and can be shortened, and the CSS for the background color needs to use th instead of td:

    .tablepress td,
    .tablepress th {
      border: 1px solid #cccccc;
    }
    
    #content .tablepress-id-2 th {
      background-color: #ffffff;
    }

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘TablePress CSS is not working with custom theme’ is closed to new replies.