
-
AuthorPosts
-
February 4, 2019 at 7:29 pm #1062808
Hi,
i have created a own plugin with the following simple function:
function nb_get_infos()
{
?>
<form method=”post” action=”?register=1″>
<label for=”Name”><b>Name:</b></label><br>
<input type=”text” id=”Name” name=”Name”><br><br>
<input type=”submit” name=”submit”>
</form>
<?php
global $wpdb;
if(isset($_GET[‘register’])) {
$nb_Name = $_POST[‘Name’];
if($nb_Name != “TEST”)
{
$user_daten = $wpdb->get_row(“SELECT * FROM wp_users WHERE ID = 1”);
return “User Display Name: “.$user_daten->display_name; //display_name
}
}
}
add_shortcode( ‘nb_infos’, ‘nb_get_infos’ );when i use the shotcode [nb_info] within the ALB textfield the preview looks as expected but when i load the page the formular field is on top of the page (and not on the position of the textfile where i have placed it within ALB).
Also all styles are missing ect.
Can somebody give me a hint what i should do to make this work.
(The query within the function is not what i’m looking for it is just a test case)Thanks
-
This topic was modified 6 years ago by
nibaer.
February 5, 2019 at 12:00 am #1062928well – where did you get the code for it?
there are so many different quotes and double quotes!
i can not say if your code will do what you want but this is it with correct signsTry to copy/paste this :
function nb_get_infos(){ ?> <form method="post" action="?register=1"> <label for="Name"><b>Name:</b></label><br> <input type="text" id="Name" name="Name"><br><br> <input type="submit" name="submit"> </form> <?php global $wpdb; if(isset($_GET['register'])) { $nb_Name = $_POST['Name']; if($nb_Name != "TEST") { $user_daten = $wpdb->get_row("SELECT * FROM wp_users WHERE ID = 1"); return "User Display Name: ".$user_daten->display_name; //display_name } } } add_shortcode( 'nb_infos', 'nb_get_infos' );
February 6, 2019 at 7:21 pm #1063728Hi
It is not a problem regarding the code (but thanks I will use always the same quotes).
The shortcode function itself is working but it is not integrated to the Stylesheet (not sure how to describe it better).
For example:
I create a page with the enfold advanced layout builder.
At the top of the page I place a picture and after the picture I place a textfield.
Within the textfield I write „hello world“.
In the next line I add the shortcode.I expect that the input field of the shortcode is placed after the text hello world but it isn’t.
The input fiel from the shortcode I displayed at the top of the page.I assume it is because the input field is not using the Stylesheet or Stylesheet function from the enfold alb. I have no idea how I can do this and I hope somebody can give me a hint.
Can you understand my example and my problem ?
Thanks you so much for help.
February 8, 2019 at 4:00 pm #1064616Hi,
i tested some more things and i hope with the following description somebody can help me.
My easy function looks like the follwing.function nb_example()
{
echo “<b>Hello World echo</b>”;
return “Hello World return”;
}
add_shortcode( ‘nb_example’, ‘nb_example’ );when i use the shortcode [nb_example] within a text-block the string from the return comand “hello world return” is displayed at the correct position on my page.
The string from the echo command “Hello world echo” is displayed outside the <section class=”av_textblock_section ” but inside the <div id=’main’.
It would be great if somebody can help me out with this.Thanks very much
February 8, 2019 at 4:57 pm #1064649Hi nibaer,
Have you seen these threads?
https://kriesi.at/support/topic/avia-page-builder-with-own-custom-shortcode/If you need further assistance please let us know.
Best regards,
Victoria -
This topic was modified 6 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.