Skip to content

Instantly share code, notes, and snippets.

@krishaamer
Created April 28, 2016 18:01
Show Gist options
  • Save krishaamer/1a316d64032bef5ad774806005de5aad to your computer and use it in GitHub Desktop.
Save krishaamer/1a316d64032bef5ad774806005de5aad to your computer and use it in GitHub Desktop.
add_shortcode('register', function () {
if(!function_exists("pll_current_language"))
return;
if(pll_current_language() == "pt") {
$post = get_post(493);
$register_form_id = "tickets_pt";
} else {
$post = get_post(495);
$register_form_id = "tickets_en";
}
$post_title = $post->post_title;
$post_content = do_shortcode($post->post_content);
ob_start();
echo '<div class="ui container" id="' . pll__("Register") . '">
<div class="ui basic center aligned section segment" id="' . pll__("Register") . '">
<div class="ui text">
<h1>' . pll__("Page Tickets") . '</h1>
</div>
</div>
<div class="ui basic segment" id="register-inner">
<div class="ui two column stackable doubling grid">
<div class="column">
<h2>' . $post_title . '</h2>
<p>' . $post_content . '</p>
</div>
<div class="column">
<h2>' . pll__("Registration") . '</h2>';
acf_form(array(
'id' => $register_form_id,
'post_id' => 'new_post',
'new_post' => array(
'post_type' => 'ticket',
'post_status' => 'publish'
),
'field_groups' => false,
'fields' => false,
'post_title' => false,
'post_content' => false,
'form' => true,
'form_attributes' => array(
'class' => 'ui form'
),
'return' => pll__("Register Backlink"),
'html_before_fields' => '<input type="hidden" name="post_type" value="register">',
'html_after_fields' => '',
'submit_value' => pll__("Register"),
'updated_message' => pll__("Registered"),
'label_placement' => 'top',
'instruction_placement' => 'field',
'field_el' => 'div',
'uploader' => 'wp'
));
echo'</div>
</div>
</div>
</div>';
$out = ob_get_contents();
ob_end_clean();
return $out;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment