How To Use Custom Fields in Posts?

How do I activate and use Custom Fields within pages, I have a HTML block on a page but the fields will not activate?

I would like to use something like this: {profile_name} thank you for joining {site_name} your site URL is: {profile_url} and then enable copy to cilpboard using a script in a HTML block on the page, where the value="<a href="{profile_url}?utm_source=testing&utm_medium=web&utm_campaign=marketing&utm_term=Mar2021&utm_content=UNA">{profile_name}</a>"

Here is the sample code, can anyone help?

<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.tooltip {
  position: relative;
  display: inline-block;
}


.tooltip .tooltiptext {
  visibility: hidden;
  width: 140px;
  background-color: #555;
  color: ;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 150%;
  left: 50%;
  margin-left: -75px;
  opacity: 0;
  transition: opacity 0.3s;
}


.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}


.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
</style>
</head>
<body>


<p>Click on the button to copy the text from the text field. Try to paste the text (e.g. ctrl+v) afterwards in a different window, to see the effect.</p>
<p>{profile_name} thank you for joining {site_name} your site URL is: {profile_url}</p>


<input type="text" value="Hello World" id="myInput">


<div class="tooltip">
<button onclick="myFunction()" onmouseout="outFunc()">
  <span class="tooltiptext" id="myTooltip">Copy to clipboard</span>
  Copy text
  </button>
</div>


<script>
function myFunction() {
  var copyText = document.getElementById("myInput");
  copyText.select();
  copyText.setSelectionRange(0, 99999);
  document.execCommand("copy");
  
  var tooltip = document.getElementById("myTooltip");
  tooltip.innerHTML = "Copied: " + copyText.value;
}


function outFunc() {
  var tooltip = document.getElementById("myTooltip");
  tooltip.innerHTML = "Copy to clipboard";
}
</script>
  • 1447
  • More
Replies (0)
Login or Join to comment.