Customer status in WordPress

0

I have a database parallel to the wordpress in which it shows the client a list of their clients. Here everything is perfect. As I work in wordpress, I have created a page called "Client List", the problem is that when I do the list, it shows me in all the pages. How do I see the list on one page?

<?php
$sql = $conn->query("SELECT * FROM clientes");

while ($row = $sql->fetch()) {
 echo 'Cliente '.$row['empresas'];
}
?>
    
asked by 11.06.2018 в 15:07
source

1 answer

1

I understand that you are placing the code in the template template where the page is displayed. Possibly called "page.php".

Once you have placed, you must make a conditional. For example:

<?php 
if (is_page("nombre-de-tu-página")) {
// Aquí se mostrará la información si está dentro de esta página
$sql = $conn->query("SELECT * FROM clientes");
     while ($row = $sql->fetch()) {
           echo 'Cliente '.$row['empresas'];
    }
} 
?>
    
answered by 11.06.2018 / 16:00
source