{"id":3454,"date":"2026-05-28T11:47:54","date_gmt":"2026-05-28T09:47:54","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=3454"},"modified":"2026-05-28T11:49:12","modified_gmt":"2026-05-28T09:49:12","slug":"php-variables-in-wordpress","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=3454","title":{"rendered":"Php variables in WordPress"},"content":{"rendered":"\n<p>To set a variable, such as an url, you can use the following steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>add to your <strong>wp-config<\/strong> a code with something like <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>require_once ABSPATH . 'wp-settings.php';\n\/** variabili *\/\ndefine('GLOSSARIO_URL', 'yourwebsite\/glossario.php');<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>add to <strong>functions.php<\/strong> (in your wp theme root) something like <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>define('GLOSSARIO_URL', 'yourwebsite\/glossario.php');\n\nfunction glossario_link($atts) {\n    $atts = shortcode_atts(&#91;\n        'id' =&gt; '',\n        'testo' =&gt; ''\n    ], $atts);\n\n    $url = GLOSSARIO_URL . '#' . $atts&#91;'id'];\n\n    return '&lt;a href=\"' . esc_url($url) . '\"&gt;' . esc_html($atts&#91;'testo']) . '&lt;\/a&gt;';\n}\n\nadd_shortcode('glossario', 'glossario_link');<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>in <strong>wp editor<\/strong> you will be able to call that code inserting a text like this:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;glossario id=\"universalismo\" testo=\"universalisticamente\"]<\/code><\/pre>\n\n\n\n<p>where the content of <code>testo=\"\"<\/code> is what will appears in your wp page (while in the <strong>editor<\/strong> you will see that code)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To set a variable, such as an url, you can use the following steps: where the content of testo=&#8221;&#8221; is what will appears in your wp page (while in the editor you will see that code)<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[751,566],"tags":[1014,488],"class_list":["post-3454","post","type-post","status-publish","format-standard","hentry","category-php","category-webmaster","tag-php-variable","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3454"}],"version-history":[{"count":3,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3454\/revisions"}],"predecessor-version":[{"id":3457,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3454\/revisions\/3457"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}