Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
Wordpress PHP with Screen Width condition

Hey guys i am trying to foreach array from my table and i want to foreach specific rows that only for mobie if user use mobile, and foreach rows that only for desktop if user screen more than 720px but the first condition only working, and the second one not working. so where is there problem here?

$table_header_name = 'header'; // Table Name
$width = "<script>document.write(screen.width);</script>";

if($width <= 720) { //this for mobile & tablet
  $h_rows = $wpdb->get_results( "SELECT * FROM  $table_header_name WHERE play_mode = 1 AND device_mode = 1 ORDER BY rank_mode ASC", ARRAY_A );
}
elseif($width >= 721) { //this for desktop
 
  $h_rows = $wpdb->get_results( "SELECT * FROM  $table_header_name WHERE play_mode = 1 AND device_mode = 0 ORDER BY rank_mode ASC", ARRAY_A );
}

i use this code in sidebar widget in my plugin files.

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda