Shortcode to include PHP file, pass various parameters to include?

Thanks for your comments and guidance. I implemented solutions which didn’t reinvent the wheel. The complication was finding a way to remove the [insert_php][/insert_php] wrapped code from pages and posts and still preserve the content and user experience. Custom Template Pages Pages and Posts which were almost entirely PHP were made into custom template files. … Read more

How to dynamically change webcam photo timestamps

to generate the galerie, you can put this shortcode in the file functions.php of your theme (create a child theme if the theme can be updated) add_shortcode(“webcamPictures”, function ($attr, $content, $tag) { $picturesByLine = 5; $directoryBase = realpath(__DIR__ . “/../../../images”); $urlBase = home_url(“/images”); // reading pictures $picturesRaw = glob(“$directoryBase/{$attr[“type”]}*”); $pictures = []; foreach ($picturesRaw as … Read more

Adding slides to an existing carousel manually

No it would not be a viable solution. Never hard-code content like that. Assuming you have a slider, you should create a custom post type (or use a plugin like ACF to create a repeater field. Then you’d query a loop of either said posts or fields, and create the appropriate html markup. That way … Read more

Check radio get value to array

First, let’s put all the “payvalue” radio options into an array. This will allow us to then display them all using a foreach loop to reduce redundancy and the chance to make a mistake: $payValueOptions = [126500000, 252000000, 503000000]; Now, let’s render the fields in a foreach loop: $selectedPayValue = $_GET[‘price’]; foreach ($payValueOptions as $option): … Read more

How to show value from ACF plugin field in e-mail?

It was the thing in the order of functions, and the check : if(is_user_logged_in()){ $current_user = wp_get_current_user(); } else { $user_id = get_post_field( ‘post_author’, $post_id ); $current_user = get_userdata($user_id); }

how to iterate through xml data?

Looks like you would need to loop the XML object results, eg: $comments = array(); foreach ($object->survey as $index => $survey) { if (is_string($survey->comments)) {$comments[$index] = $survey->comments;} } print_r($comments); // to see comments