Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter erinanne

    (@erinanne)

    Thanks so much for the suggestion, Tobias. I didn’t even think of that as a solution…doh! It does work exactly as expected. I’m trying another idea now, too, so we’ll see which one we settle on. I’m really happy to have this for my “toolkit” nonetheless.

    Cheers!

    ea/

    Hi Tobias,

    I’m working on a responsive site as well, at https://www.surreycares.org. The theme is responsive, but the plugin that is blocking the site, as exemplified by the header, from responding nicely is, well, it’s WP-Table Reloaded. ??

    I’m really keen to see what you suggest. I tried what you suggested in another, similar, thread today, but it didn’t make any difference (so I undid it all…).

    Thanks for your help.

    ea/

    Thread Starter erinanne

    (@erinanne)

    Terrific! Thx, zoonini!

    ??

    ea/

    Thread Starter erinanne

    (@erinanne)

    Thank you for your help, Tobias!

    ??

    ea/

    Thread Starter erinanne

    (@erinanne)

    Hi Tobias,

    Sorry to create such a puzzle for you!

    Now the error has moved to Line 12, so I’ll drop you a note.

    Thanks for your help!

    (Let’s post the solution here when we solve it?)

    ea/

    Thread Starter erinanne

    (@erinanne)

    Oops… sorry, missed the beginning of the error message in my copy-paste (although I’m sure you can figure it out still):

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected T_FUNCTION in /home6/letaloui/public_html/kianglecom/wp-content/plugins/wp-table-reloaded-extensions.php on line 16

    Sorry.

    ea/

    Thread Starter erinanne

    (@erinanne)

    Hi Tobias,

    I’m afraid I’m getting this message when I try to activate the plugin:

    se error: syntax error, unexpected T_FUNCTION in /home6/letaloui/public_html/kianglecom/wp-content/plugins/wp-table-reloaded-extensions.php on line 16

    This is what the full code looks like, and line 16 starts with “function”

    <?php
    /*
    Plugin Name: WP-Table Reloaded Extensions
    Plugin URI: https://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/extensions/
    Description: Custom Extensions for WP-Table Reloaded
    Version: 1.0
    Author: Tobias Baethge
    */
    
    /*
    * Extension: Check for $ in cell to tag cell as currency-class value
    */
    
    //
    
    function wp_table_reloaded_cell_class_currency_value( $class, $table_id, $row, $column, $cs, $rs, $cell_content ) {
    	if ( false !== strpos( $cell_content, '$' ) )
    		$class .= ' currency-value';
    	return $class;
    }
    add_filter( 'wp_table_reloaded_cell_css_class', 'wp_table_reloaded_cell_class_currency_value', 10, 7 );
    
    ?>

    I’ve looked through this guide on PHP, https://www.brandonsavage.net/how-to-write-a-function-in-php/, but still can’t figure out what the syntax error is.

    Please advise!

    Getting close…

    ??

    Many thanks,

    ea/

    Thread Starter erinanne

    (@erinanne)

    Hi Tobias,

    I’m really grateful for your help. However, I seem to be missing something, as the numbers are not yet right-aligning in my practice post (scroll down to the second and third tables):

    https://www.kiangle.com/demo-right-justify-a-column-in-wp-table-reloaded/

    Here is what I did.

    1. Went to your post on creating an extension file for wp-table-reloaded, https://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/extensions/

    2. I created a new document in TextEdit called wp-table-reloaded-extensions.php, with this “assembled” code in it (select-all-copy-paste):

    <?php
    /*
    Plugin Name: WP-Table Reloaded Extensions
    Plugin URI: https://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/extensions/
    Description: Custom Extensions for WP-Table Reloaded
    Version: 1.0
    Author: Tobias Baethge
    */
    
    // 
    
    function wp_table_reloaded_cell_class_currency_value( $class, $table_id, $row, $column, $cs, $rs, $cell_content ) {
    	if ( false !== strpos( $cell_content, '$' ) )
    		$class .= ' currency-value';
    	return $class;
    }
    add_filter( 'wp_table_reloaded_cell_css_class', 'wp_table_reloaded_cell_class_currency_value', 10, 7 );
    
    ?
    ?>

    3. I saved the file and uploaded it to the plugins folder on my server ( /wp-content/plugins ), and not into the wp-table-reloaded folder, as per the instructions in your post on creating extensions.

    4. Then I went into Plugins Options for wp-table-reloaded. I copy-pasted the following into the Custom CSS box and selected the checkbox:

    .wp-table-reloaded .currency-value {
    	text-align: right !important;
    }

    I must be missing something, even after triple-checking it. Can you see where I may be going wrong?

    Thanks so much! (Hoping this will be helpful for others, too!)

    ea/

    Thread Starter erinanne

    (@erinanne)

    Hi TobiasBg,

    Thank you for your response; I appreciate you answering my question.

    No, the tables in the site are in different formats. Some of them provide an index to publications that can be downloaded, with no currency values included. Therefore, adding one-size-fits-all-tables CSS isn’t an option.

    So, on to option two: adding a filter hook that triggers right-align when the cell contains a $ symbol. That sounds like something that could work. How do I do that?

    Thanks!

    ea/

Viewing 9 replies - 1 through 9 (of 9 total)