• Hey Hi!

    First of all, super plug-in you just save the life of thousands of Users ??

    ..

    Well I would like to know if it’s possible to add an custom field that add the Table ID to the post …

    I’m newbie in this of PHP but I trying to add a custum field in Function.php that add this option…

    I’m trying:

    function spec_id($key) {
    	global $post;
    	$custom_field = get_post_meta($post->ID, $key, true);
    
    	if($custom_field){
    		echo '<?php wp_table_reloaded_print_table("id= '.$custom_field.'&use_tablesorter=false&print_name=false&datatables_info=false&datatables_paginate=false"); ?>';
    
    	}
    	else {
    		return;
    	}
    }

    obviously , this doesn’t work :))

    Is there a way to solve this?

    also , how do I add the PDF property as in your site tobias?

    Well in advance thanks, and again great plug in.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    sure that should work.

    Only thing is that you can’t be echoing PHP code and then hope that it is still executed. That will not work.

    I assume that your function spec_id which you have in your functions.php is called somewhere from the page TEMPLATE (not from witin the content of a post). Then, you should only need to modify your code to

    function spec_id($key) {
    	global $post;
    	$custom_field = get_post_meta($post->ID, $key, true);
    
    	if($custom_field){
    		wp_table_reloaded_print_table("id=" . $custom_field . "&use_tablesorter=false&print_name=false&datatables_info=false&datatables_paginate=false");
    	}
    }

    Best wishes,
    Tobias

    Hi,

    oh, just saw that I forgot to answer your second question:

    What PDF property are you talking about here? The one in the long list of buttons to those social networks? That’s a plugin called “Sociable”.

    Best wishes,
    Tobias

    Thread Starter LockeAG4

    (@lockeag4)

    tremendous, working like charm , thanks Tobias

    and sorry I was wrong about the PDF … waas CVS and Print te table option in your demo page….

    I mean will be a great idea to save as PDF ??

    But anyway, thanks very much.

    Hi,

    no problem ??

    To get that CSV and Print button, just select the JavaScript library “DataTables+TableTools” on the “Plugin Options” screen of WP-Table Reloaded.
    Then, on the table’s “Edit” screen, enable the usage of the TableTools script for that table (a checkbox).

    Saving to PDF is not possible unfortunately, as it is a totally different method of storing content, compared to CSV or XLS, that can not be done with JavaScript on the client side.

    Best wishes,
    Tobias

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP-Table Reloaded] : Custom Field as ID’ is closed to new replies.