Hi francescagr,
the expression ($post_id = “58”) assigns to the variabile $post_id the string value “58” and the assignment is always sucessful so the logical condition is always “true“.
That means that your code is exactly the same of:
if (TRUE) {
echo "post 58";
} else {
echo "Not post 58";
}
and that’s the reason why it always displays “post 58”.
The following code should work:
<?php
$post_id = get_the_ID();
if ($post_id == 58) {
echo "post 58";
} else {
echo "Not post 58";
}
?>
Let us know.
Byez.