• Wish I designed the site recently and not a few years ago. The site has a ton of hard coded html tables with some inline css styles embedded. Using a plugin for mobile theme it doesn’t like the html tables and the content runs off the page. Wptouch has great shortcodes but it will kill me to add the shortcode before and after every table, td, tr, tags.

    I tried the php to strip html tags and would like to replace them with echo <p> or
    <div>.

    This is what I’m using:

    <div class="<?php wptouch_content_classes(); ?>">
    				<?php wptouch_the_content();
    					echo strip_tags('<p>'); ?>
    			</div>

    Is this possible?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yes. Add a filter to the_content conditionally when WP Touch is loaded.

    Thread Starter rwilki

    (@rwilki)

    thanks pdclark… don’t even know where to begin

    A literal interpretation of what you’re describing would go something like this in PHP:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    You would put that in functions.php. It has not been tested.

    Alternatively (and much more simply), you could likely fix it with just CSS. Something like:

    .entry-content {position:relative; display:block}
    .entry-content table { width: 100% !important; }

    A literal interpretation of what you’re describing would go something like this in PHP: https://pastebin.com/rGG3besF

    Thread Starter rwilki

    (@rwilki)

    Wow. What a great concept using a filter in the functions file. I actually made it work with the table width set to 100% but it still looks a little clunky. I might try the filter. I’ll let you know.

    Thank you very much!!!

    Thread Starter rwilki

    (@rwilki)

    Wow. What a great concept using a filter in the functions file. I actually made it work with the table width set to 100% but it still looks a little clunky. I might try the filter. I’ll let you know.

    Thank you very much!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Stripping table tags in content’ is closed to new replies.