functions - Only display table in the_content() in canonical page

admin2025-06-05  3

please help me to display only tables on a canonical page

main page

    <table style="height: 198px; width: autopx;">
<tbody>
<tr style="height: 20.8px;">
<td style="width: 333.283px; height: 20.8px; text-align: center;"><strong>Filename</strong></td>
<td style="width: 56.7167px; height: 20.8px; text-align: center;"><strong>Size</strong></td>
<td style="width: 195px; height: 20.8px; text-align: center;"><strong>Download</strong></td>
</tr>
  </tbody>
</table>

want to display table content only on the download page

now using <?php the_content(); ?>

which shows full content

please help

please help me to display only tables on a canonical page

main page https://www.printerdriverforwindows/hp-deskjet-ink-advantage-3700-driver

    <table style="height: 198px; width: autopx;">
<tbody>
<tr style="height: 20.8px;">
<td style="width: 333.283px; height: 20.8px; text-align: center;"><strong>Filename</strong></td>
<td style="width: 56.7167px; height: 20.8px; text-align: center;"><strong>Size</strong></td>
<td style="width: 195px; height: 20.8px; text-align: center;"><strong>Download</strong></td>
</tr>
  </tbody>
</table>

want to display table content only on the download page

now using <?php the_content(); ?>

which shows full content

please help

Share Improve this question asked Dec 25, 2018 at 3:07 Ashija PramodAshija Pramod 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can try this. Let put the following code at the end of file functions.php on the theme or child theme.

add_action('wp_head', 'custom_show_table_on_download_page', 20);
function custom_show_table_on_download_page() { 
    if(is_single()){
        echo '<style type="text/css">.dpage {display: none !important;}</style>';
    }
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749069668a316092.html

最新回复(0)