Hot answers tagged

3

There is indeed an unwanted ; (semicolon) in your function (try to look at line 99 in the twentytwentyone-child/functions.php file) which likely is the cause to the syntax error. So just remove that ; and the error would be gone: function my_service_template_footer_data() { echo "<script type='application/ld+json'> { '@context': 'https://...


2

Did I set up that wp_ajax_nopriv_ hook wrong? No, you did not. But that hook is for logged-out or unregistered users only. For logged-in users, the hook is wp_ajax_<action>. So you just need to change the add_action('get_events' in your code to add_action('wp_ajax_get_events', and the error 400 would be gone: add_action('wp_ajax_get_events', '...


2

If your template file doesn't have the <?php tag at the top, you should add it. <?php /* Template Name: Exhibition - Pilgrims */ ...is how the very top of your template file should look. Your sample should read like this. <?php /* Template Name: Exhibition - Pilgrims */ get_header(); ?> <div class="container fadeIn ...


1

A late reply but I thought I would include a snippet that worked for me. Update $allowed_inner_blocks with your own "block_types" and place the following code inside the parent block template; <?php $allowed_inner_blocks = ['acf/logos']; ?> <InnerBlocks allowedBlocks="<?php echo esc_attr(wp_json_encode($allowed_inner_blocks)); ?>...


1

Yes. Look into Custom Fields, or use the excellent Advanced Custom Fields plugin as Rup mentioned


1

You're generating whitespace because of the blank line between the echo $end block and the endwnile, and because you're switching in and out of PHP which means everything between the ?> and <?php - i.e. all of the whitespace - will get echoed out. (HTML then merges the blank lines and spaces into a single space for display.) You can just do this a ...


1

Perhaps you could consider using WP REST API to get the posts with a XMLHttpRequest in javascript instead of trying to get php work on .html file(s). From the REST handbook, The WordPress REST API provides an interface for applications to interact with your WordPress site by sending and receiving data as JSON (JavaScript Object Notation) objects. And It ...


1

1) Run php code in html files You can't run PHP in .html files because the server does not recognize that as a valid PHP extension unless you tell it to. To do this you need to create a .htaccess file in your root web directory and add this line to it: AddType application/x-httpd-php .htm .html This will tell Apache to process files with a .htm or .html ...


Only top voted, non community-wiki answers of a minimum length are eligible