User meta needed in query is serialized – how to unserialize safely?
User meta needed in query is serialized – how to unserialize safely?
User meta needed in query is serialized – how to unserialize safely?
//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
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
Seems like you need to change your action to publish_post. publish_post only fires when a post is published. The callback function will only receive only one argument, the post id, with it you can do all your needed checks and update the meta as needed. By the way, update post meta doesn’t play well with … Read more
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
WP query posts BUT show the most recent and one per author
I think the main issue here is that the calling context of hooks (eg. targets of add_action) are not the same as the functions.php inline code. Also, function parameters come from the calling context, not just because there is a variable of that name in the same file. This “function enqueue_product_modals($product) ” will not work. … Read more
Custom search query on WordPress page not working
I don’t fully understand, but: function lw_search_filter_pages ( $query ) { // … } if ( is_front_page () || is_home () ) {} else { add_filter ( ‘pre_get_posts’, ‘lw_search_filter_pages’ ); } Another: function lw_search_filter_pages ( $query ) { // … } // https://yoursite.tld/blog $uri = $_SERVER [ ‘REQUEST_URI’ ]; // $uri = ‘/blog’; if ( … Read more
A simple google search led me to this: You can’t run PHP with javascript. JavaScript is a client side technology (runs in the users browser) and PHP is a server side technology (run on the server). If you want to do this you have to make an ajax request to a PHP script and have … Read more