AWS Lightsail WordPress – connect to database on instance using mysqli

//Params to connect to a database $dbHost = “*static ip of wordpress site*”; This should be $dbHost = “localhost”; instead, or “127.0.0.1” (or even “::1”). localhost uses a separate virtual network interface that makes sure traffic between services on your Linux VM doesn’t leave the VM In general it’s safer to use localhost rather than … Read more

Block error message in foreach loop when looping through ACF field

For those who are looking for an answer – after trial and error i found the “if” statement i was looking for. Full code as follows: $variablename = get_field(‘dcfg_global_item_select’); if ( !empty( $variablename ) ) {?> <div class=”container”> <?php foreach($variablename as $variablename2):?> <a href=”<?php echo get_page_link($variablename2 ->ID);?>”> <center> <img src=”<?php echo get_the_post_thumbnail_url($variablename2->ID, ‘medium’);?>”> </center> </a> … Read more

Posts title instead of Pages and Category titles – PHP WordPress

How about extending the if statement to include the pages you require? Your code would look something like this: <?php if( is_front_page() ) { ?> <div class=”bloc-header-home”> <span class=”decouvrez”>Découvrez</span> <h1>La chasse en licence</h1> <span class=”avantages”>La chasse est partie prenante de la gestion durable des forêts, car elle contribue à la conservation des écosystèmes forestiers et … Read more