Generate manifest.json using plugin

1

I am trying to create a simple plugin that generates and loads the manifest.json dynamically with PHP. I have clear how to load the label in the header with

add_action('wp_header', 'mifuncion')

and the function only makes

echo '<link rel="manifest" href="ruta-al-plugin/manifest.json">';

To make it dynamic I call a php instead of a json

echo '<link rel="manifest" href="ruta-al-plugin/manifest.php">';

The manifest.php file contains the following code:

<?php
$manifest = array(
    "name"=> "Progress Web App",
    "version"=> "0.3",
    "short_name"=> "PWA"
);
header('Content-Type: application/json');
echo json_encode($manifest);
?>

I have tried the following with satisfactory results:

  • I have created an html and a php that call manifest.json both in root, and loads it well.
  • I have created an html and a php that call manifest.php both in root, and I dynamically load the information of the manifest well.

The problem I have when I do it with the plugin, which in the source code writes me the meta-tag but I can not get the information either in manifest.php or in the manifest.json that is inside the plugin.

Thank you and greetings.

    
asked by Jandro Oliva 20.02.2018 в 10:45
source

0 answers