Skip to content
Advertisement

Can I add a button to this area of ​wordpress?

Can I add a button to this area of ​​wordpress?

picture of the section i want to edit

How can I add a button with php to this field where there is a text and page editing screen?

I want to do something like this in the button content:

<a href="http://example.com/get.php?url=<?php echo $geturl; ?>"> Click here </a>

I want to assign the URL of the relevant post/page to the $ geturl variable.

example.com/get.php?url=http://example.com/example-post/

How can I do that ? Thanks

Advertisement

Answer

You can fix it by adding the following code below the Function.php file (I didn’t expect it to be that easy. I didn’t think the url in the text section would be printed with the get_permalink (); variable)

function custom_meta_box_markup()
{
echo get_permalink();
}

function add_custom_meta_box()
{
    add_meta_box("demo-meta-box", "Custom Meta Box", "custom_meta_box_markup", "post", "side", "high", null);
}

add_action("add_meta_boxes", "add_custom_meta_box");
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement