Checking if Tablepress cell output contains text string
-
Hi all, any help in this will be greatly appreciated. I think if you are familiar with PHP it shouldn’t be too much trouble? I have some code in my wordpress template that I’d like to add an ‘if’ condition to. The code is currently as follows…
// to get the table location
<?php
$geturl=”http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
?>// to output the specific table cell value
<?php echo do_shortcode(‘[table id=1 filter=”‘.$geturl.'” hide_columns=”0,2-10″ /]’);?>This code works fine, however I would like to add a condition so that if the above cell output is a certain text string (‘film’ for example) then it goes onto fetch data based a certain set of shortcodes, e.g
<?php echo do_shortcode(‘[table id=1 filter=”‘.$geturl.'” hide_columns=”0-2,4-10″ /]’);?>
<?php echo do_shortcode(‘[table id=1 filter=”‘.$geturl.'” hide_columns=”0-3,5-10″ /]’);?>rather than a set of slightly different shortcodes, e.g
<?php echo do_shortcode(‘[table id=1 filter=”‘.$geturl.'” hide_columns=”0-4,6-10″ /]’);?>
<?php echo do_shortcode(‘[table id=1 filter=”‘.$geturl.'” hide_columns=”0-5,7-10″ /]’);?>Any good suggestions on how I could make this work?
The topic ‘Checking if Tablepress cell output contains text string’ is closed to new replies.